| 1 | import { AGENTS as SHARED_AGENTS, AGENT_IDS } from "@g1t/contracts/agent-setup"; |
| 2 | import { MCP_URL } from '@g1t/contracts/agent-setup'; |
| 3 | export { MCP_URL, PLUGIN_INSTALL } from '@g1t/contracts/agent-setup'; |
| 4 | |
| 5 | export type AgentSetup = { |
| 6 | label: string; |
| 7 | /** The file the snippet goes in, or null for a terminal command. */ |
| 8 | file: string | null; |
| 9 | lang: 'sh' | 'json' | 'toml'; |
| 10 | code: string; |
| 11 | /** What to do after; Markdown is not parsed, `code` in backticks is. */ |
| 12 | then: string; |
| 13 | }; |
| 14 | |
| 15 | const json = (value: unknown) => JSON.stringify(value, null, 2); |
| 16 | |
| 17 | export const AGENTS = AGENT_IDS.map((id) => SHARED_AGENTS[id]); |
| 18 | |
| 19 | /** The same, with a bearer token instead of signing in through the browser. */ |
| 20 | export const AGENTS_WITH_TOKEN: AgentSetup[] = [ |
| 21 | { |
| 22 | label: 'Claude Code', |
| 23 | file: null, |
| 24 | lang: 'sh', |
| 25 | code: `claude mcp add --transport http g1t ${MCP_URL} \\\n --header "Authorization: Bearer $G1T_TOKEN"`, |
| 26 | 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.", |
| 27 | }, |
| 28 | { |
| 29 | label: 'Codex', |
| 30 | file: '~/.codex/config.toml', |
| 31 | lang: 'toml', |
| 32 | code: `[mcp_servers.g1t]\nurl = "${MCP_URL}"\nbearer_token_env_var = "G1T_TOKEN"`, |
| 33 | then: '', |
| 34 | }, |
| 35 | { |
| 36 | label: 'OpenCode', |
| 37 | file: 'opencode.json', |
| 38 | lang: 'json', |
| 39 | code: json({ |
| 40 | $schema: 'https://opencode.ai/config.json', |
| 41 | mcp: { |
| 42 | g1t: { |
| 43 | type: 'remote', |
| 44 | url: MCP_URL, |
| 45 | oauth: false, |
| 46 | headers: { Authorization: 'Bearer {env:G1T_TOKEN}' }, |
| 47 | }, |
| 48 | }, |
| 49 | }), |
| 50 | then: '', |
| 51 | }, |
| 52 | { |
| 53 | label: 'Cursor', |
| 54 | file: '.cursor/mcp.json', |
| 55 | lang: 'json', |
| 56 | code: json({ mcpServers: { g1t: { url: MCP_URL, headers: { Authorization: 'Bearer ${env:G1T_TOKEN}' } } } }), |
| 57 | then: '', |
| 58 | }, |
| 59 | ]; |