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

mcpApps.ts

217 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 `APP_LAUNCH_URLS` in ElectronShell lists.
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, and no link that prefills a message yet (Grok Bot plans one), so the app
92 // opens bare and the copied message is pasted in.
93 handoff: {
94 kind: "copy-message",
95 link: "https://x.ai/bot",
96 appLink: () => "grokbot://app",
97 message: (url) => `Add the MCP server ${url} and connect it.`,
98 },
99 steps: ["Send this message to any of your Grok Bots."],
100 note: "Shared with all your Grok Bots.",
101 docs: "https://docs.x.ai/grok-bot/computer-and-apps",
102 },
103 {
104 id: "gemini",
105 name: "Gemini",
106 logo: geminiLogo,
107 handoff: { kind: "copy-url", link: "https://gemini.google.com/apps" },
108 steps: [
109 "In Gemini, open Settings, then Connected apps.",
110 "Choose Custom apps, then Add, and paste the URL.",
111 ],
112 docs: "https://support.google.com/gemini/answer/17209137",
113 // Gemini's sign-in and its tool schema checks do not work with T3 Code yet.
114 hidden: true,
115 },
116 {
117 id: "muse",
118 name: "Muse",
119 logo: museLogo,
120 handoff: {
121 kind: "copy-message",
122 link: "https://muse.ai",
123 message: (url) => `Create a custom connector for the MCP server ${url}.`,
124 },
125 steps: ["Send this message to Muse."],
126 docs: "https://www.meta.com/help/artificial-intelligence/1687253048996149/",
127 },
128 {
129 id: "instinct",
130 name: "Instinct",
131 logo: instinctLogo,
132 handoff: {
133 kind: "copy-message",
134 link: "https://app.instinct.com",
135 message: (url) => `Connect the MCP server ${url}.`,
136 },
137 steps: ["In Instinct, open Settings, then MCP connections, if your account has it."],
138 },
139 {
140 id: "openclaw",
141 name: "OpenClaw",
142 logo: openClawLogo,
143 handoff: {
144 kind: "commands",
145 commands: (url) => [
146 // Its MCP commands refuse to write while the Gateway runs.
147 "openclaw gateway stop",
148 `openclaw mcp add t3code --url ${url} --transport streamable-http --auth oauth`,
149 "openclaw mcp login t3code",
150 "openclaw gateway start",
151 ],
152 },
153 steps: [
154 "Open the Control UI, then + and Plugins, and choose Add MCP server.",
155 "Paste the URL, and choose Streamable HTTP and OAuth.",
156 "Select Sign in for it under Settings → MCP.",
157 ],
158 docs: "https://docs.openclaw.ai/tools/mcp",
159 },
160 {
161 id: "hermes-agent",
162 name: "Hermes Agent",
163 logo: hermesLogo,
164 handoff: {
165 kind: "commands",
166 commands: (url) => [
167 // `add` signs in on its first connection (30 s by default, too short to get a code);
168 // `login` would clear that sign-in and need a second code.
169 `hermes mcp add t3code --url ${url} --auth oauth --connect-timeout 315`,
170 ],
171 },
172 steps: [
173 "Add t3code under mcp_servers in ~/.hermes/config.yaml, with the URL and auth: oauth.",
174 "Run hermes mcp login t3code.",
175 ],
176 note: "On a remote host, paste the final URL back when asked.",
177 docs: "https://hermes-agent.nousresearch.com/docs/user-guide/features/mcp",
178 },
179];
180​
181/** The "Something else…" choice: the URL and general steps only. */
182export const OTHER_MCP_APP_STEPS = ["Add a remote MCP server with OAuth."] as const;
183​
184/**
185 * The primary button for `app`: its label, the https page it opens, and what it copies first.
186 * Null for apps set up with commands. It never copies the approval code.
187 */
188export function mcpHandoffAction(app: McpApp, mcpUrl: string) {
189 const { handoff } = app;
190 switch (handoff.kind) {
191 case "open":
192 return {
193 label: `Open in ${app.name}`,
194 link: handoff.link(mcpUrl),
195 appLink: null,
196 copy: null,
197 };
198 case "copy-url":
199 return {
200 label: `Copy URL and open ${app.name}`,
201 link: handoff.link,
202 appLink: null,
203 copy: { text: mcpUrl, title: "URL copied" },
204 };
205 case "copy-message": {
206 const message = handoff.message(mcpUrl);
207 return {
208 label: `Copy message and open ${app.name}`,
209 link: handoff.link,
210 appLink: handoff.appLink?.(message) ?? null,
211 copy: { text: message, title: "Message copied" },
212 };
213 }
214 case "commands":
215 return null;
216 }