| 1 | /** |
| 2 | * How each coding agent connects to g1t's MCP server, from each agent's own |
| 3 | * documentation for adding a remote MCP server. The site's copy is |
| 4 | * `apps/web/app/lib/agent-setup.ts`; keep the two in step. |
| 5 | */ |
| 6 | |
| 7 | export const MCP_URL = 'https://mcp.g1t.sh'; |
| 8 | |
| 9 | /** Installs g1t's Claude Code plugin, which adds the MCP server (as `plugin:g1t:g1t`) and records sessions. */ |
| 10 | export const PLUGIN_INSTALL = 'claude plugin marketplace add https://g1t.sh/flagon-io/g1t.git\nclaude plugin install g1t@g1t'; |
| 11 | |
| 12 | export type AgentSetup = { |
| 13 | label: string; |
| 14 | /** The file the snippet goes in, or null for a terminal command. */ |
| 15 | file: string | null; |
| 16 | lang: 'sh' | 'json' | 'toml'; |
| 17 | code: string; |
| 18 | /** What to do after; Markdown is not parsed, `code` in backticks is. */ |
| 19 | then: string; |
| 20 | }; |
| 21 | |
| 22 | const json = (value: unknown) => JSON.stringify(value, null, 2); |
| 23 | |
| 24 | export const AGENTS: AgentSetup[] = [ |
| 25 | { |
| 26 | // g1t's plugin adds the MCP server itself, and records sessions. |
| 27 | label: 'Claude Code', |
| 28 | file: null, |
| 29 | lang: 'sh', |
| 30 | code: PLUGIN_INSTALL, |
| 31 | then: `g1t's Claude Code plugin adds g1t's MCP server, and records your sessions on g1t. Start Claude Code again, run \`/mcp\` and choose \`plugin:g1t:g1t\` to sign in through your browser. With the plugin installed, skip \`claude mcp add\`: adding the server again lists every g1t tool twice. Without the plugin, \`claude mcp add --transport http g1t ${MCP_URL}\` adds the server alone.`, |
| 32 | }, |
| 33 | { |
| 34 | label: 'Codex', |
| 35 | file: null, |
| 36 | lang: 'sh', |
| 37 | code: `codex mcp add g1t --url ${MCP_URL}\ncodex mcp login g1t`, |
| 38 | then: 'The login opens your browser to sign in to g1t.', |
| 39 | }, |
| 40 | { |
| 41 | label: 'OpenCode', |
| 42 | file: 'opencode.json', |
| 43 | lang: 'json', |
| 44 | code: json({ |
| 45 | $schema: 'https://opencode.ai/config.json', |
| 46 | mcp: { g1t: { type: 'remote', url: MCP_URL, enabled: true } }, |
| 47 | }), |
| 48 | then: 'OpenCode signs you in through your browser when it first connects; `opencode mcp auth g1t` starts it by hand.', |
| 49 | }, |
| 50 | { |
| 51 | label: 'Cursor', |
| 52 | file: '.cursor/mcp.json', |
| 53 | lang: 'json', |
| 54 | code: json({ mcpServers: { g1t: { url: MCP_URL } } }), |
| 55 | then: 'Use `~/.cursor/mcp.json` for every project. Cursor signs you in through your browser when it first connects.', |
| 56 | }, |
| 57 | ]; |
| 58 | |
| 59 | /** The same, with a bearer token instead of signing in through the browser. */ |
| 60 | export const AGENTS_WITH_TOKEN: AgentSetup[] = [ |
| 61 | { |
| 62 | label: 'Claude Code', |
| 63 | file: null, |
| 64 | lang: 'sh', |
| 65 | code: `claude mcp add --transport http g1t ${MCP_URL} \\\n --header "Authorization: Bearer $G1T_TOKEN"`, |
| 66 | then: "This adds the server without g1t's plugin. With the plugin installed, which adds it too, disable the plugin's (`plugin:g1t:g1t` in `/mcp`) or skip this, so g1t's tools are not listed twice.", |
| 67 | }, |
| 68 | { |
| 69 | label: 'Codex', |
| 70 | file: '~/.codex/config.toml', |
| 71 | lang: 'toml', |
| 72 | code: `[mcp_servers.g1t]\nurl = "${MCP_URL}"\nbearer_token_env_var = "G1T_TOKEN"`, |
| 73 | then: '', |
| 74 | }, |
| 75 | { |
| 76 | label: 'OpenCode', |
| 77 | file: 'opencode.json', |
| 78 | lang: 'json', |
| 79 | code: json({ |
| 80 | $schema: 'https://opencode.ai/config.json', |
| 81 | mcp: { |
| 82 | g1t: { |
| 83 | type: 'remote', |
| 84 | url: MCP_URL, |
| 85 | oauth: false, |
| 86 | headers: { Authorization: 'Bearer {env:G1T_TOKEN}' }, |
| 87 | }, |
| 88 | }, |
| 89 | }), |
| 90 | then: '', |
| 91 | }, |
| 92 | { |
| 93 | label: 'Cursor', |
| 94 | file: '.cursor/mcp.json', |
| 95 | lang: 'json', |
| 96 | code: json({ mcpServers: { g1t: { url: MCP_URL, headers: { Authorization: 'Bearer ${env:G1T_TOKEN}' } } } }), |
| 97 | then: '', |
| 98 | }, |
| 99 | ]; |