Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

mcpApps.ts

216 lines7.1 KB

1import chatgptLogo from "./logos/chatgpt.png";
2import claudeLogo from "./logos/claude.png";
3import geminiLogo from "./logos/gemini.png";
4import grokBotLogo from "./logos/grokbot.png";
5import hermesLogo from "./logos/hermes.png";
6import instinctLogo from "./logos/instinct.png";
7import museLogo from "./logos/muse.png";
8import openClawLogo from "./logos/openclaw.png";
9import pokeLogo from "./logos/poke.png";
10​
11/** How the Connect step hands T3 Code's MCP URL to an app. Every `link` is https. */
12export type McpAppHandoff =
13 /** Opens the app's add form with T3 Code filled in. */
14 | { readonly kind: "open"; readonly link: (mcpUrl: string) => string }
15 /** Copies the URL, then opens the page it goes on. */
16 | { readonly kind: "copy-url"; readonly link: string }
17 /** Copies a message for the app's chat, then opens the app. */
18 | {
19 readonly kind: "copy-message";
20 readonly link: string;
21 /**
22 * Opens the installed app first, given the message; `link` is the fallback. The desktop
23 * app opens only the link shapes `isAppLaunchUrl` in ElectronShell accepts.
24 */
25 readonly appLink?: (message: string) => string;
26 readonly message: (mcpUrl: string) => string;
27 }
28 /** Commands to run where the app runs. */
29 | { readonly kind: "commands"; readonly commands: (mcpUrl: string) => readonly string[] };
30​
31export interface McpApp {
32 readonly id: string;
33 readonly name: string;
34 readonly logo: string;
35 readonly handoff: McpAppHandoff;
36 /** "Set up another way", next to the URL. */
37 readonly steps: readonly string[];
38 /** One line under the primary action. */
39 readonly note?: string;
40 readonly docs?: string;
41 /** Kept out of the grid until its sign-in works. */
42 readonly hidden?: boolean;
44​
45const encoded = encodeURIComponent;
46​
47export const MCP_APPS: readonly McpApp[] = [
48 {
49 id: "poke",
50 name: "Poke",
51 logo: pokeLogo,
52 handoff: {
53 kind: "open",
54 link: (url) => `https://poke.com/integrations/new?name=T3%20Code&url=${encoded(url)}`,
55 },
56 steps: ["Open poke.com/integrations/new.", "Paste the URL and add the integration."],
57 docs: "https://poke.com/docs/mcp-servers",
58 },
59 {
60 id: "claude",
61 name: "Claude",
62 logo: claudeLogo,
63 handoff: {
64 kind: "open",
65 link: (url) =>
66 `https://claude.ai/customize/connectors?modal=add-custom-connector&connectorName=T3%20Code&connectorUrl=${encoded(url)}`,
67 },
68 steps: [
69 "In Claude, open Customize, then Connectors.",
70 "Choose Add custom connector and paste the URL.",
71 "The Free plan allows one custom connector.",
72 ],
73 docs: "https://claude.com/docs/connectors/building/directory-vs-custom",
74 },
75 {
76 id: "chatgpt",
77 name: "ChatGPT",
78 logo: chatgptLogo,
79 handoff: { kind: "copy-url", link: "https://chatgpt.com/plugins" },
80 steps: [
81 "Open chatgpt.com/plugins on the web, then + and Add custom MCP server.",
82 "Paste the URL. Choose OAuth.",
83 "Create it as a plugin, then install it.",
84 ],
85 docs: "https://developers.openai.com/api/docs/guides/custom-mcp-server",
86 },
87 {
88 id: "grok-bot",
89 name: "Grok Bot",
90 logo: grokBotLogo,
91 // No web chat. The app link prefills the message only into an empty box, so it is copied too.
92 handoff: {
93 kind: "copy-message",
94 link: "https://x.ai/bot",
95 appLink: (message) => `grokbot://app/v1/prompt?text=${encoded(message)}`,
96 message: (url) => `Add the MCP server ${url} and connect it.`,
97 },
98 steps: ["Send this message to any of your Grok Bots."],
99 note: "Shared with all your Grok Bots.",
100 docs: "https://docs.x.ai/grok-bot/computer-and-apps",
101 },
102 {
103 id: "gemini",
104 name: "Gemini",
105 logo: geminiLogo,
106 handoff: { kind: "copy-url", link: "https://gemini.google.com/apps" },
107 steps: [
108 "In Gemini, open Settings, then Connected apps.",
109 "Choose Custom apps, then Add, and paste the URL.",
110 ],
111 docs: "https://support.google.com/gemini/answer/17209137",
112 // Gemini's sign-in and its tool schema checks do not work with T3 Code yet.
113 hidden: true,
114 },
115 {
116 id: "muse",
117 name: "Muse",
118 logo: museLogo,
119 handoff: {
120 kind: "copy-message",
121 link: "https://muse.ai",
122 message: (url) => `Create a custom connector for the MCP server ${url}.`,
123 },
124 steps: ["Send this message to Muse."],
125 docs: "https://www.meta.com/help/artificial-intelligence/1687253048996149/",
126 },
127 {
128 id: "instinct",
129 name: "Instinct",
130 logo: instinctLogo,
131 handoff: {
132 kind: "copy-message",
133 link: "https://app.instinct.com",
134 message: (url) => `Connect the MCP server ${url}.`,
135 },
136 steps: ["In Instinct, open Settings, then MCP connections, if your account has it."],
137 },
138 {
139 id: "openclaw",
140 name: "OpenClaw",
141 logo: openClawLogo,
142 handoff: {
143 kind: "commands",
144 commands: (url) => [
145 // Its MCP commands refuse to write while the Gateway runs.
146 "openclaw gateway stop",
147 `openclaw mcp add t3code --url ${url} --transport streamable-http --auth oauth`,
148 "openclaw mcp login t3code",
149 "openclaw gateway start",
150 ],
151 },
152 steps: [
153 "Open the Control UI, then + and Plugins, and choose Add MCP server.",
154 "Paste the URL, and choose Streamable HTTP and OAuth.",
155 "Select Sign in for it under Settings → MCP.",
156 ],
157 docs: "https://docs.openclaw.ai/tools/mcp",
158 },
159 {
160 id: "hermes-agent",
161 name: "Hermes Agent",
162 logo: hermesLogo,
163 handoff: {
164 kind: "commands",
165 commands: (url) => [
166 // `add` signs in on its first connection (30 s by default, too short to get a code);
167 // `login` would clear that sign-in and need a second code.
168 `hermes mcp add t3code --url ${url} --auth oauth --connect-timeout 315`,
169 ],
170 },
171 steps: [
172 "Add t3code under mcp_servers in ~/.hermes/config.yaml, with the URL and auth: oauth.",
173 "Run hermes mcp login t3code.",
174 ],
175 note: "On a remote host, paste the final URL back when asked.",
176 docs: "https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp",
177 },
178];
179​
180/** The "Something else…" choice: the URL and general steps only. */
181export const OTHER_MCP_APP_STEPS = ["Add a remote MCP server with OAuth."] as const;
182​
183/**
184 * The primary button for `app`: its label, the https page it opens, and what it copies first.
185 * Null for apps set up with commands. It never copies the approval code.
186 */
187export function mcpHandoffAction(app: McpApp, mcpUrl: string) {
188 const { handoff } = app;
189 switch (handoff.kind) {
190 case "open":
191 return {
192 label: `Open in ${app.name}`,
193 link: handoff.link(mcpUrl),
194 appLink: null,
195 copy: null,
196 };
197 case "copy-url":
198 return {
199 label: `Copy URL and open ${app.name}`,
200 link: handoff.link,
201 appLink: null,
202 copy: { text: mcpUrl, title: "URL copied" },
203 };
204 case "copy-message": {
205 const message = handoff.message(mcpUrl);
206 return {
207 label: `Copy message and open ${app.name}`,
208 link: handoff.link,
209 appLink: handoff.appLink?.(message) ?? null,
210 copy: { text: message, title: "Message copied" },
211 };
212 }
213 case "commands":
214 return null;
215 }