@tempoxyz/mercator 0.0.356 → 0.0.387
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -4
- package/dist/client-selection.d.ts +11 -0
- package/dist/client-selection.js +50 -0
- package/dist/client-selection.js.map +1 -0
- package/dist/clients.d.ts +27 -1
- package/dist/clients.js +196 -219
- package/dist/clients.js.map +1 -1
- package/dist/globe.d.ts +2 -0
- package/dist/globe.js +13 -2
- package/dist/globe.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +88 -10
- package/dist/index.js.map +1 -1
- package/dist/plugin-bundle/skills/mercator/SKILL.md +5 -3
- package/dist/prompt-input.d.ts +2 -0
- package/dist/prompt-input.js +22 -0
- package/dist/prompt-input.js.map +1 -1
- package/dist/setup-progress.d.ts +2 -0
- package/dist/setup-progress.js +15 -2
- package/dist/setup-progress.js.map +1 -1
- package/dist/setup-telemetry.d.ts +45 -0
- package/dist/setup-telemetry.js +115 -0
- package/dist/setup-telemetry.js.map +1 -0
- package/dist/wallet.d.ts +2 -2
- package/dist/wallet.js +2 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -37,8 +37,12 @@ and verifies the protected endpoint. The default route is `/mcp/auth`. Native OA
|
|
|
37
37
|
Account on first use; Grok setup opens Tempo Wallet immediately and stores its bounded bearer in
|
|
38
38
|
Grok's user MCP configuration. Existing Mercator registrations using `/mcp` are upgraded
|
|
39
39
|
automatically; unrelated custom endpoints are preserved. No wallet key or API key is printed or
|
|
40
|
-
copied.
|
|
41
|
-
the
|
|
40
|
+
copied. In an interactive terminal, every detected client starts checked and can be toggled before
|
|
41
|
+
setup continues. Detection and selection show the human client name and whether setup installs MCP
|
|
42
|
+
alone or a plugin plus MCP. The final summary distinguishes installed, already configured, skipped,
|
|
43
|
+
and failed work, preserves successful integrations when another target fails, and ends with three
|
|
44
|
+
copyable prompts for the first Mercator run. The desktop plugin includes a focused Mercator skill by
|
|
45
|
+
default. Pass setup options through the bootstrap command after `sh -s --`:
|
|
42
46
|
|
|
43
47
|
```sh
|
|
44
48
|
curl -fsSL https://mercator.tempo.xyz/install.sh | sh -s -- --client codex --no-skill
|
|
@@ -58,15 +62,21 @@ Setup is best-effort: failures in one client or optional plugin, guidance, clien
|
|
|
58
62
|
or readiness phase are reported without undoing successful work. Run `mercator doctor` for a
|
|
59
63
|
strict readiness check.
|
|
60
64
|
|
|
65
|
+
Setup sends anonymous, finite funnel events through Mercator to PostHog: CLI version, platform,
|
|
66
|
+
architecture, installation channel, interaction mode, selected client IDs, bounded outcomes, and
|
|
67
|
+
elapsed time. It never sends account identity, hostname, paths, configuration content, wallet data,
|
|
68
|
+
or raw errors. Disable it with `MERCATOR_TELEMETRY=off` or `DO_NOT_TRACK=1`; it is also disabled in
|
|
69
|
+
CI and for custom MCP endpoints.
|
|
70
|
+
|
|
61
71
|
### Setup controls
|
|
62
72
|
|
|
63
73
|
| Option | Behavior |
|
|
64
74
|
| --- | --- |
|
|
65
|
-
| No option | Install the desktop plugin
|
|
75
|
+
| No option | Install the desktop plugin. Interactive setup shows every detected client checked by default; non-interactive setup configures all detected clients. |
|
|
66
76
|
| `--client <name>` | Configure one client; repeat for several. Supported IDs: `claude`, `cline`, `codex`, `continue`, `cursor`, `gemini`, `grok`, `hermes`, `kiro`, `lmstudio`, `openclaw`, `vscode`, `windsurf`, and `zed`. |
|
|
67
77
|
| `--url <url>` | Use another Mercator MCP endpoint, including a local development endpoint. |
|
|
68
78
|
| `--dry-run` | Preview all setup work without writing changes. |
|
|
69
|
-
| `--yes` |
|
|
79
|
+
| `--yes` | Configure every detected client and apply without interactive prompts. |
|
|
70
80
|
| `--force` | Recreate MCP registrations; Grok repeats Account authorization. |
|
|
71
81
|
| `--color` / `--no-color` | Enable or disable color in interactive output. `NO_COLOR` is also supported. |
|
|
72
82
|
| `--plugin` / `--no-plugin` | Enable or disable the local Codex/ChatGPT desktop plugin. Enabled by default. |
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import checkbox from '@inquirer/checkbox';
|
|
2
|
+
import { type ClientId } from './clients.js';
|
|
3
|
+
type ClientSelectionStreams = {
|
|
4
|
+
readonly input: NodeJS.ReadableStream;
|
|
5
|
+
readonly interactive: boolean;
|
|
6
|
+
readonly output: NodeJS.WritableStream;
|
|
7
|
+
readonly prompt: typeof checkbox;
|
|
8
|
+
};
|
|
9
|
+
/** Lets interactive users narrow detected clients, with every client selected by default. */
|
|
10
|
+
export declare function selectSetupClients(clients: readonly ClientId[], overrides?: Partial<ClientSelectionStreams>): Promise<readonly ClientId[]>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import checkbox from '@inquirer/checkbox';
|
|
2
|
+
import { clientIntegrationLabel } from './clients.js';
|
|
3
|
+
import { openKeypressInput } from './prompt-input.js';
|
|
4
|
+
/** Resolves process-backed client-selection streams for the current invocation. */
|
|
5
|
+
const defaultStreams = () => ({
|
|
6
|
+
input: process.stdin,
|
|
7
|
+
interactive: Boolean(process.stdout.isTTY),
|
|
8
|
+
output: process.stdout,
|
|
9
|
+
prompt: checkbox,
|
|
10
|
+
});
|
|
11
|
+
/** Lets interactive users narrow detected clients, with every client selected by default. */
|
|
12
|
+
export async function selectSetupClients(clients, overrides = {}) {
|
|
13
|
+
const uniqueClients = [...new Set(clients)];
|
|
14
|
+
const streams = { ...defaultStreams(), ...overrides };
|
|
15
|
+
if (!streams.interactive || uniqueClients.length === 0)
|
|
16
|
+
return uniqueClients;
|
|
17
|
+
const promptInput = overrides.input
|
|
18
|
+
? { close: () => undefined, input: streams.input }
|
|
19
|
+
: openKeypressInput();
|
|
20
|
+
if (!promptInput)
|
|
21
|
+
return uniqueClients;
|
|
22
|
+
try {
|
|
23
|
+
return await streams.prompt({
|
|
24
|
+
choices: uniqueClients.map((client) => ({
|
|
25
|
+
checked: true,
|
|
26
|
+
name: clientIntegrationLabel(client),
|
|
27
|
+
value: client,
|
|
28
|
+
})),
|
|
29
|
+
loop: false,
|
|
30
|
+
message: 'Select clients to configure',
|
|
31
|
+
required: false,
|
|
32
|
+
shortcuts: { all: 'a', invert: 'i' },
|
|
33
|
+
theme: {
|
|
34
|
+
icon: {
|
|
35
|
+
checked: '[x]',
|
|
36
|
+
cursor: '>',
|
|
37
|
+
unchecked: '[ ]',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}, {
|
|
41
|
+
clearPromptOnDone: false,
|
|
42
|
+
input: promptInput.input,
|
|
43
|
+
output: streams.output,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
promptInput.close();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=client-selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-selection.js","sourceRoot":"","sources":["../src/client-selection.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,oBAAoB,CAAA;AAEzC,OAAO,EAAiB,sBAAsB,EAAE,MAAM,cAAc,CAAA;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AASrD,mFAAmF;AACnF,MAAM,cAAc,GAAG,GAA2B,EAAE,CAAC,CAAC;IACrD,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;IAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;IACtB,MAAM,EAAE,QAAQ;CAChB,CAAC,CAAA;AAEF,6FAA6F;AAC7F,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACvC,OAA4B,EAC5B,YAA6C,EAAE;IAE/C,MAAM,aAAa,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IAC3C,MAAM,OAAO,GAAG,EAAE,GAAG,cAAc,EAAE,EAAE,GAAG,SAAS,EAAE,CAAA;IACrD,IAAI,CAAC,OAAO,CAAC,WAAW,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,aAAa,CAAA;IAE5E,MAAM,WAAW,GAAG,SAAS,CAAC,KAAK;QAClC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE;QAClD,CAAC,CAAC,iBAAiB,EAAE,CAAA;IACtB,IAAI,CAAC,WAAW;QAAE,OAAO,aAAa,CAAA;IACtC,IAAI,CAAC;QACJ,OAAO,MAAM,OAAO,CAAC,MAAM,CAC1B;YACC,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;gBACvC,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE,sBAAsB,CAAC,MAAM,CAAC;gBACpC,KAAK,EAAE,MAAM;aACb,CAAC,CAAC;YACH,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,6BAA6B;YACtC,QAAQ,EAAE,KAAK;YACf,SAAS,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE;YACpC,KAAK,EAAE;gBACN,IAAI,EAAE;oBACL,OAAO,EAAE,KAAK;oBACd,MAAM,EAAE,GAAG;oBACX,SAAS,EAAE,KAAK;iBAChB;aACD;SACD,EACD;YACC,iBAAiB,EAAE,KAAK;YACxB,KAAK,EAAE,WAAW,CAAC,KAAK;YACxB,MAAM,EAAE,OAAO,CAAC,MAAM;SACtB,CACD,CAAA;IACF,CAAC;YAAS,CAAC;QACV,WAAW,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;AACF,CAAC"}
|
package/dist/clients.d.ts
CHANGED
|
@@ -53,9 +53,35 @@ export type RemovalPlan = {
|
|
|
53
53
|
};
|
|
54
54
|
export type ConfigurationState = 'current' | 'different' | 'legacy' | 'missing' | 'unavailable' | 'unknown';
|
|
55
55
|
type RunCheck = (check: CommandCheck) => Promise<CommandResult>;
|
|
56
|
-
|
|
56
|
+
type SetupPlanOptions = {
|
|
57
|
+
readonly authorization?: string;
|
|
58
|
+
readonly cwd: string;
|
|
59
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
60
|
+
readonly home: string;
|
|
61
|
+
readonly platform: NodeJS.Platform;
|
|
62
|
+
readonly url: string;
|
|
63
|
+
};
|
|
64
|
+
type RemovalPlanOptions = Omit<SetupPlanOptions, 'authorization' | 'url'>;
|
|
65
|
+
type ClientDefinition = {
|
|
66
|
+
readonly command?: string;
|
|
67
|
+
readonly configFootprints?: (options: RemovalPlanOptions) => readonly string[];
|
|
68
|
+
readonly desktop?: {
|
|
69
|
+
readonly macos: string;
|
|
70
|
+
readonly windows: string;
|
|
71
|
+
};
|
|
72
|
+
readonly integration: 'MCP' | 'plugin + MCP';
|
|
73
|
+
readonly label: string;
|
|
74
|
+
readonly remove: (options: RemovalPlanOptions) => RemovalPlan;
|
|
75
|
+
readonly setup: (options: SetupPlanOptions) => SetupPlan;
|
|
76
|
+
};
|
|
77
|
+
/** Authoritative metadata and operations for every supported client. */
|
|
78
|
+
export declare const CLIENT_DEFINITIONS: Readonly<Record<ClientId, ClientDefinition>>;
|
|
79
|
+
/** Stable client IDs in setup and display order. */
|
|
80
|
+
export declare const CLIENT_IDS: ClientId[];
|
|
57
81
|
/** Returns the human-readable product label for an agent client. */
|
|
58
82
|
export declare function clientLabel(client: ClientId): string;
|
|
83
|
+
/** Human-readable setup mechanism for one supported client. */
|
|
84
|
+
export declare function clientIntegrationLabel(client: ClientId): string;
|
|
59
85
|
export declare function setupPlan(client: ClientId, url: string, options?: {
|
|
60
86
|
authorization?: string;
|
|
61
87
|
cwd?: string;
|
package/dist/clients.js
CHANGED
|
@@ -20,121 +20,181 @@ export const Client = {
|
|
|
20
20
|
Windsurf: 'windsurf',
|
|
21
21
|
Zed: 'zed',
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
/** Authoritative metadata and operations for every supported client. */
|
|
24
|
+
export const CLIENT_DEFINITIONS = {
|
|
25
|
+
claude: {
|
|
26
|
+
command: 'claude',
|
|
27
|
+
integration: 'plugin + MCP',
|
|
28
|
+
label: 'Claude Code',
|
|
29
|
+
remove: () => commandRemoval('claude', ['mcp', 'remove', '--scope', 'user', 'mercator']),
|
|
30
|
+
setup: ({ url }) => commandPlan('claude', ['mcp', 'add', '--scope', 'user', '--transport', 'http', 'mercator', url], { args: ['mcp', 'get', 'mercator'], command: 'claude', url }),
|
|
31
|
+
},
|
|
32
|
+
cline: {
|
|
33
|
+
command: 'cline',
|
|
34
|
+
configFootprints: ({ cwd }) => [join(cwd, '.cline')],
|
|
35
|
+
integration: 'MCP',
|
|
36
|
+
label: 'Cline',
|
|
37
|
+
remove: ({ cwd }) => fileRemoval(join(cwd, '.cline', 'mcp.json'), 'mcpServers'),
|
|
38
|
+
setup: ({ cwd, url }) => filePlan(join(cwd, '.cline', 'mcp.json'), 'mcpServers', {
|
|
39
|
+
mcpServers: { mercator: { type: 'streamableHttp', url } },
|
|
40
|
+
}),
|
|
41
|
+
},
|
|
42
|
+
codex: {
|
|
43
|
+
command: 'codex',
|
|
44
|
+
integration: 'MCP',
|
|
45
|
+
label: 'Codex',
|
|
46
|
+
remove: () => commandRemoval('codex', ['mcp', 'remove', 'mercator']),
|
|
47
|
+
setup: ({ url }) => commandPlan('codex', ['mcp', 'add', 'mercator', '--url', url, '--oauth-client-registration', 'dcr'], { args: ['mcp', 'get', 'mercator'], command: 'codex', url }),
|
|
48
|
+
},
|
|
49
|
+
continue: {
|
|
50
|
+
configFootprints: ({ cwd }) => [join(cwd, '.continue')],
|
|
51
|
+
integration: 'MCP',
|
|
52
|
+
label: 'Continue',
|
|
53
|
+
remove: ({ cwd }) => fileRemoval(join(cwd, '.continue', 'mcpServers', 'mercator.json'), 'mcpServers'),
|
|
54
|
+
setup: ({ cwd, url }) => filePlan(join(cwd, '.continue', 'mcpServers', 'mercator.json'), 'mcpServers', {
|
|
55
|
+
mcpServers: { mercator: { type: 'streamable-http', url } },
|
|
56
|
+
}),
|
|
57
|
+
},
|
|
58
|
+
cursor: {
|
|
59
|
+
command: 'cursor',
|
|
60
|
+
configFootprints: ({ home }) => [join(home, '.cursor')],
|
|
61
|
+
desktop: { macos: 'Cursor', windows: 'cursor' },
|
|
62
|
+
integration: 'MCP',
|
|
63
|
+
label: 'Cursor',
|
|
64
|
+
remove: ({ home }) => fileRemoval(join(home, '.cursor', 'mcp.json'), 'mcpServers'),
|
|
65
|
+
setup: ({ home, url }) => filePlan(join(home, '.cursor', 'mcp.json'), 'mcpServers', {
|
|
66
|
+
mcpServers: { mercator: { url } },
|
|
67
|
+
}),
|
|
68
|
+
},
|
|
69
|
+
gemini: {
|
|
70
|
+
command: 'gemini',
|
|
71
|
+
integration: 'MCP',
|
|
72
|
+
label: 'Gemini CLI',
|
|
73
|
+
remove: () => commandRemoval('gemini', ['mcp', 'remove', 'mercator']),
|
|
74
|
+
setup: ({ url }) => commandPlan('gemini', ['mcp', 'add', 'mercator', url, '--transport', 'http', '--scope', 'user'], { args: ['mcp', 'list'], command: 'gemini', serverName: 'mercator', url }),
|
|
75
|
+
},
|
|
76
|
+
grok: {
|
|
77
|
+
command: 'grok',
|
|
78
|
+
integration: 'plugin + MCP',
|
|
79
|
+
label: 'Grok',
|
|
80
|
+
remove: () => commandRemoval('grok', ['mcp', 'remove', 'mercator']),
|
|
81
|
+
setup: ({ authorization, url }) => commandPlan('grok', [
|
|
82
|
+
'mcp',
|
|
83
|
+
'add',
|
|
84
|
+
'--scope',
|
|
85
|
+
'user',
|
|
86
|
+
'--transport',
|
|
87
|
+
'http',
|
|
88
|
+
'mercator',
|
|
89
|
+
url,
|
|
90
|
+
...(authorization ? ['--header', `Authorization: ${authorization}`] : []),
|
|
91
|
+
], {
|
|
92
|
+
args: ['mcp', 'doctor', 'mercator', '--json'],
|
|
93
|
+
command: 'grok',
|
|
94
|
+
requireHealthy: true,
|
|
95
|
+
serverName: 'mercator',
|
|
96
|
+
url,
|
|
97
|
+
}),
|
|
98
|
+
},
|
|
99
|
+
hermes: {
|
|
100
|
+
command: 'hermes',
|
|
101
|
+
integration: 'MCP',
|
|
102
|
+
label: 'Hermes',
|
|
103
|
+
remove: () => commandRemoval('hermes', ['mcp', 'remove', 'mercator']),
|
|
104
|
+
setup: ({ url }) => commandPlan('hermes', ['mcp', 'add', 'mercator', '--url', url], {
|
|
105
|
+
args: ['mcp', 'list'],
|
|
106
|
+
command: 'hermes',
|
|
107
|
+
serverName: 'mercator',
|
|
108
|
+
url,
|
|
109
|
+
}),
|
|
110
|
+
},
|
|
111
|
+
kiro: {
|
|
112
|
+
command: 'kiro-cli',
|
|
113
|
+
configFootprints: ({ home }) => [join(home, '.kiro')],
|
|
114
|
+
desktop: { macos: 'Kiro', windows: 'Kiro' },
|
|
115
|
+
integration: 'MCP',
|
|
116
|
+
label: 'Kiro',
|
|
117
|
+
remove: ({ home }) => fileRemoval(join(home, '.kiro', 'settings', 'mcp.json'), 'mcpServers'),
|
|
118
|
+
setup: ({ home, url }) => filePlan(join(home, '.kiro', 'settings', 'mcp.json'), 'mcpServers', {
|
|
119
|
+
mcpServers: { mercator: { url } },
|
|
120
|
+
}),
|
|
121
|
+
},
|
|
122
|
+
lmstudio: {
|
|
123
|
+
command: 'lms',
|
|
124
|
+
configFootprints: ({ home }) => [join(home, '.lmstudio')],
|
|
125
|
+
desktop: { macos: 'LM Studio', windows: 'LM Studio' },
|
|
126
|
+
integration: 'MCP',
|
|
127
|
+
label: 'LM Studio',
|
|
128
|
+
remove: ({ home }) => fileRemoval(join(home, '.lmstudio', 'mcp.json'), 'mcpServers'),
|
|
129
|
+
setup: ({ home, url }) => filePlan(join(home, '.lmstudio', 'mcp.json'), 'mcpServers', {
|
|
130
|
+
mcpServers: { mercator: { url } },
|
|
131
|
+
}),
|
|
132
|
+
},
|
|
133
|
+
openclaw: {
|
|
134
|
+
command: 'openclaw',
|
|
135
|
+
integration: 'MCP',
|
|
136
|
+
label: 'OpenClaw',
|
|
137
|
+
remove: () => commandRemoval('openclaw', ['mcp', 'unset', 'mercator']),
|
|
138
|
+
setup: ({ url }) => commandPlan('openclaw', ['mcp', 'add', 'mercator', '--url', url, '--transport', 'streamable-http'], { args: ['mcp', 'show', 'mercator', '--json'], command: 'openclaw', url }, 'openclaw mcp unset mercator'),
|
|
139
|
+
},
|
|
140
|
+
vscode: {
|
|
141
|
+
command: 'code',
|
|
142
|
+
desktop: { macos: 'Visual Studio Code', windows: 'Microsoft VS Code' },
|
|
143
|
+
integration: 'MCP',
|
|
144
|
+
label: 'Visual Studio Code',
|
|
145
|
+
remove: ({ home, platform }) => vscodeRemovalPlan(home, platform),
|
|
146
|
+
setup: ({ url }) => ({
|
|
147
|
+
args: ['--add-mcp', JSON.stringify({ name: 'mercator', type: 'http', url })],
|
|
148
|
+
command: 'code',
|
|
149
|
+
kind: 'command',
|
|
150
|
+
undo: 'Remove Mercator from the MCP: Open User Configuration command.',
|
|
151
|
+
}),
|
|
152
|
+
},
|
|
153
|
+
windsurf: {
|
|
154
|
+
command: 'windsurf',
|
|
155
|
+
configFootprints: ({ home }) => [join(home, '.codeium', 'windsurf')],
|
|
156
|
+
desktop: { macos: 'Windsurf', windows: 'Windsurf' },
|
|
157
|
+
integration: 'MCP',
|
|
158
|
+
label: 'Windsurf',
|
|
159
|
+
remove: ({ home }) => fileRemoval(join(home, '.codeium', 'windsurf', 'mcp_config.json'), 'mcpServers'),
|
|
160
|
+
setup: ({ home, url }) => filePlan(join(home, '.codeium', 'windsurf', 'mcp_config.json'), 'mcpServers', {
|
|
161
|
+
mcpServers: { mercator: { serverUrl: url } },
|
|
162
|
+
}),
|
|
163
|
+
},
|
|
164
|
+
zed: {
|
|
165
|
+
command: 'zed',
|
|
166
|
+
configFootprints: ({ env, home, platform }) => [
|
|
167
|
+
dirname(zedSettingsPath(home, platform, env)),
|
|
168
|
+
],
|
|
169
|
+
desktop: { macos: 'Zed', windows: 'Zed' },
|
|
170
|
+
integration: 'MCP',
|
|
171
|
+
label: 'Zed',
|
|
172
|
+
remove: ({ env, home, platform }) => fileRemoval(zedSettingsPath(home, platform, env), 'context_servers'),
|
|
173
|
+
setup: ({ env, home, platform, url }) => filePlan(zedSettingsPath(home, platform, env), 'context_servers', {
|
|
174
|
+
context_servers: { mercator: { url } },
|
|
175
|
+
}),
|
|
176
|
+
},
|
|
40
177
|
};
|
|
178
|
+
/** Stable client IDs in setup and display order. */
|
|
179
|
+
export const CLIENT_IDS = Object.keys(CLIENT_DEFINITIONS);
|
|
41
180
|
/** Returns the human-readable product label for an agent client. */
|
|
42
181
|
export function clientLabel(client) {
|
|
43
|
-
return
|
|
182
|
+
return CLIENT_DEFINITIONS[client].label;
|
|
183
|
+
}
|
|
184
|
+
/** Human-readable setup mechanism for one supported client. */
|
|
185
|
+
export function clientIntegrationLabel(client) {
|
|
186
|
+
const definition = CLIENT_DEFINITIONS[client];
|
|
187
|
+
return `${definition.label} (${definition.integration})`;
|
|
44
188
|
}
|
|
45
189
|
export function setupPlan(client, url, options = {}) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
args: ['mcp', 'get', 'mercator'],
|
|
55
|
-
command: 'codex',
|
|
56
|
-
url,
|
|
57
|
-
});
|
|
58
|
-
case Client.Claude:
|
|
59
|
-
return commandPlan('claude', ['mcp', 'add', '--scope', 'user', '--transport', 'http', 'mercator', url], {
|
|
60
|
-
args: ['mcp', 'get', 'mercator'],
|
|
61
|
-
command: 'claude',
|
|
62
|
-
url,
|
|
63
|
-
});
|
|
64
|
-
case Client.Gemini:
|
|
65
|
-
return commandPlan('gemini', ['mcp', 'add', 'mercator', url, '--transport', 'http', '--scope', 'user'], {
|
|
66
|
-
args: ['mcp', 'list'],
|
|
67
|
-
command: 'gemini',
|
|
68
|
-
serverName: 'mercator',
|
|
69
|
-
url,
|
|
70
|
-
});
|
|
71
|
-
case Client.Grok:
|
|
72
|
-
return commandPlan('grok', [
|
|
73
|
-
'mcp',
|
|
74
|
-
'add',
|
|
75
|
-
'--scope',
|
|
76
|
-
'user',
|
|
77
|
-
'--transport',
|
|
78
|
-
'http',
|
|
79
|
-
'mercator',
|
|
80
|
-
url,
|
|
81
|
-
...(options.authorization
|
|
82
|
-
? ['--header', `Authorization: ${options.authorization}`]
|
|
83
|
-
: []),
|
|
84
|
-
], {
|
|
85
|
-
args: ['mcp', 'doctor', 'mercator', '--json'],
|
|
86
|
-
command: 'grok',
|
|
87
|
-
requireHealthy: true,
|
|
88
|
-
serverName: 'mercator',
|
|
89
|
-
url,
|
|
90
|
-
});
|
|
91
|
-
case Client.OpenClaw:
|
|
92
|
-
return commandPlan('openclaw', ['mcp', 'add', 'mercator', '--url', url, '--transport', 'streamable-http'], {
|
|
93
|
-
args: ['mcp', 'show', 'mercator', '--json'],
|
|
94
|
-
command: 'openclaw',
|
|
95
|
-
url,
|
|
96
|
-
}, 'openclaw mcp unset mercator');
|
|
97
|
-
case Client.Hermes:
|
|
98
|
-
return commandPlan('hermes', ['mcp', 'add', 'mercator', '--url', url], {
|
|
99
|
-
args: ['mcp', 'list'],
|
|
100
|
-
command: 'hermes',
|
|
101
|
-
serverName: 'mercator',
|
|
102
|
-
url,
|
|
103
|
-
});
|
|
104
|
-
case Client.Kiro:
|
|
105
|
-
return filePlan(join(home, '.kiro', 'settings', 'mcp.json'), 'mcpServers', {
|
|
106
|
-
mcpServers,
|
|
107
|
-
});
|
|
108
|
-
case Client.LmStudio:
|
|
109
|
-
return filePlan(join(home, '.lmstudio', 'mcp.json'), 'mcpServers', {
|
|
110
|
-
mcpServers,
|
|
111
|
-
});
|
|
112
|
-
case Client.VsCode:
|
|
113
|
-
return {
|
|
114
|
-
args: ['--add-mcp', JSON.stringify({ name: 'mercator', type: 'http', url })],
|
|
115
|
-
command: 'code',
|
|
116
|
-
kind: 'command',
|
|
117
|
-
undo: 'Remove Mercator from the MCP: Open User Configuration command.',
|
|
118
|
-
};
|
|
119
|
-
case Client.Cursor:
|
|
120
|
-
return filePlan(join(home, '.cursor', 'mcp.json'), 'mcpServers', { mcpServers });
|
|
121
|
-
case Client.Windsurf:
|
|
122
|
-
return filePlan(join(home, '.codeium', 'windsurf', 'mcp_config.json'), 'mcpServers', {
|
|
123
|
-
mcpServers: { mercator: { serverUrl: url } },
|
|
124
|
-
});
|
|
125
|
-
case Client.Cline:
|
|
126
|
-
return filePlan(join(cwd, '.cline', 'mcp.json'), 'mcpServers', {
|
|
127
|
-
mcpServers: { mercator: { type: 'streamableHttp', url } },
|
|
128
|
-
});
|
|
129
|
-
case Client.Continue:
|
|
130
|
-
return filePlan(join(cwd, '.continue', 'mcpServers', 'mercator.json'), 'mcpServers', {
|
|
131
|
-
mcpServers: { mercator: { type: 'streamable-http', url } },
|
|
132
|
-
});
|
|
133
|
-
case Client.Zed:
|
|
134
|
-
return filePlan(zedSettingsPath(home, platform, env), 'context_servers', {
|
|
135
|
-
context_servers: { mercator: { url } },
|
|
136
|
-
});
|
|
137
|
-
}
|
|
190
|
+
return CLIENT_DEFINITIONS[client].setup({
|
|
191
|
+
...(options.authorization ? { authorization: options.authorization } : {}),
|
|
192
|
+
cwd: options.cwd ?? process.cwd(),
|
|
193
|
+
env: options.env ?? process.env,
|
|
194
|
+
home: options.home ?? homedir(),
|
|
195
|
+
platform: options.platform ?? process.platform,
|
|
196
|
+
url,
|
|
197
|
+
});
|
|
138
198
|
}
|
|
139
199
|
/** Restricts Grok's user configuration after it receives a bearer header. */
|
|
140
200
|
export async function protectGrokConfig(home = homedir()) {
|
|
@@ -144,43 +204,12 @@ export async function protectGrokConfig(home = homedir()) {
|
|
|
144
204
|
}
|
|
145
205
|
/** Builds a conservative removal plan that never includes wallet state. */
|
|
146
206
|
export function removalPlan(client, options = {}) {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
args: ['mcp', 'remove', '--scope', 'user', 'mercator'],
|
|
154
|
-
command: 'claude',
|
|
155
|
-
kind: 'command',
|
|
156
|
-
};
|
|
157
|
-
case Client.Gemini:
|
|
158
|
-
return { args: ['mcp', 'remove', 'mercator'], command: 'gemini', kind: 'command' };
|
|
159
|
-
case Client.Grok:
|
|
160
|
-
return { args: ['mcp', 'remove', 'mercator'], command: 'grok', kind: 'command' };
|
|
161
|
-
case Client.OpenClaw:
|
|
162
|
-
return { args: ['mcp', 'unset', 'mercator'], command: 'openclaw', kind: 'command' };
|
|
163
|
-
case Client.Hermes:
|
|
164
|
-
return { args: ['mcp', 'remove', 'mercator'], command: 'hermes', kind: 'command' };
|
|
165
|
-
case Client.VsCode:
|
|
166
|
-
return vscodeRemovalPlan(home, options.platform ?? process.platform);
|
|
167
|
-
case Client.Kiro:
|
|
168
|
-
case Client.LmStudio:
|
|
169
|
-
case Client.Cursor:
|
|
170
|
-
case Client.Windsurf:
|
|
171
|
-
case Client.Cline:
|
|
172
|
-
case Client.Continue:
|
|
173
|
-
case Client.Zed: {
|
|
174
|
-
const plan = setupPlan(client, '', options);
|
|
175
|
-
if (plan.kind !== 'file')
|
|
176
|
-
throw new Error(`Expected a file plan for ${client}`);
|
|
177
|
-
return {
|
|
178
|
-
kind: 'file',
|
|
179
|
-
path: plan.path,
|
|
180
|
-
serverContainer: plan.serverContainer,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
}
|
|
207
|
+
return CLIENT_DEFINITIONS[client].remove({
|
|
208
|
+
cwd: options.cwd ?? process.cwd(),
|
|
209
|
+
env: options.env ?? process.env,
|
|
210
|
+
home: options.home ?? homedir(),
|
|
211
|
+
platform: options.platform ?? process.platform,
|
|
212
|
+
});
|
|
184
213
|
}
|
|
185
214
|
export async function configurationState(plan, runCheck = runCommandCheck) {
|
|
186
215
|
if (plan.kind === 'file')
|
|
@@ -210,40 +239,20 @@ export async function installedClients(options = {}) {
|
|
|
210
239
|
const cwd = options.cwd ?? process.cwd();
|
|
211
240
|
const env = options.env ?? process.env;
|
|
212
241
|
const platform = options.platform ?? process.platform;
|
|
213
|
-
const commands =
|
|
214
|
-
[
|
|
215
|
-
[
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
[Client.Grok, 'grok'],
|
|
219
|
-
[Client.Hermes, 'hermes'],
|
|
220
|
-
[Client.Kiro, 'kiro-cli'],
|
|
221
|
-
[Client.LmStudio, 'lms'],
|
|
222
|
-
[Client.OpenClaw, 'openclaw'],
|
|
223
|
-
[Client.VsCode, 'code'],
|
|
224
|
-
[Client.Cursor, 'cursor'],
|
|
225
|
-
[Client.Windsurf, 'windsurf'],
|
|
226
|
-
[Client.Zed, 'zed'],
|
|
227
|
-
];
|
|
228
|
-
const commandPresence = await Promise.all(commands.map(async ([client, command]) => ({
|
|
242
|
+
const commands = CLIENT_IDS.flatMap((client) => {
|
|
243
|
+
const command = CLIENT_DEFINITIONS[client].command;
|
|
244
|
+
return command ? [{ client, command }] : [];
|
|
245
|
+
});
|
|
246
|
+
const commandPresence = await Promise.all(commands.map(async ({ client, command }) => ({
|
|
229
247
|
client,
|
|
230
248
|
present: await isCommandAvailable(command),
|
|
231
249
|
})));
|
|
232
250
|
const detected = new Set(commandPresence.filter(({ present }) => present).map(({ client }) => client));
|
|
233
|
-
|
|
234
|
-
Client.Cline,
|
|
235
|
-
Client.Continue,
|
|
236
|
-
Client.Cursor,
|
|
237
|
-
Client.Kiro,
|
|
238
|
-
Client.LmStudio,
|
|
239
|
-
Client.VsCode,
|
|
240
|
-
Client.Windsurf,
|
|
241
|
-
Client.Zed,
|
|
242
|
-
];
|
|
243
|
-
await Promise.all(footprintClients.map(async (client) => {
|
|
251
|
+
await Promise.all(CLIENT_IDS.map(async (client) => {
|
|
244
252
|
const paths = [
|
|
245
|
-
...
|
|
246
|
-
|
|
253
|
+
...(CLIENT_DEFINITIONS[client].configFootprints?.({ cwd, env, home, platform }) ??
|
|
254
|
+
[]),
|
|
255
|
+
...desktopClientPaths(CLIENT_DEFINITIONS[client], home, platform, env),
|
|
247
256
|
];
|
|
248
257
|
if ((await Promise.all(paths.map(isPathAvailable))).some(Boolean)) {
|
|
249
258
|
detected.add(client);
|
|
@@ -328,6 +337,12 @@ function commandPlan(command, args, check, undo = `${command} mcp remove mercato
|
|
|
328
337
|
undo,
|
|
329
338
|
};
|
|
330
339
|
}
|
|
340
|
+
function commandRemoval(command, args) {
|
|
341
|
+
return { args, command, kind: 'command' };
|
|
342
|
+
}
|
|
343
|
+
function fileRemoval(path, serverContainer) {
|
|
344
|
+
return { kind: 'file', path, serverContainer };
|
|
345
|
+
}
|
|
331
346
|
async function writeJsonFile(path, content) {
|
|
332
347
|
let target = path;
|
|
333
348
|
let mode = 0o600;
|
|
@@ -451,57 +466,19 @@ function zedSettingsPath(home, platform, env) {
|
|
|
451
466
|
}
|
|
452
467
|
return join(env.XDG_CONFIG_HOME ?? join(home, '.config'), 'zed', 'settings.json');
|
|
453
468
|
}
|
|
454
|
-
function desktopClientPaths(
|
|
455
|
-
|
|
456
|
-
[Client.Cursor]: 'Cursor',
|
|
457
|
-
[Client.Kiro]: 'Kiro',
|
|
458
|
-
[Client.LmStudio]: 'LM Studio',
|
|
459
|
-
[Client.VsCode]: 'Visual Studio Code',
|
|
460
|
-
[Client.Windsurf]: 'Windsurf',
|
|
461
|
-
[Client.Zed]: 'Zed',
|
|
462
|
-
};
|
|
463
|
-
const name = names[client];
|
|
464
|
-
if (!name)
|
|
469
|
+
function desktopClientPaths(definition, home, platform, env) {
|
|
470
|
+
if (!definition.desktop)
|
|
465
471
|
return [];
|
|
466
472
|
if (platform === 'darwin') {
|
|
467
473
|
return [
|
|
468
|
-
join('/Applications', `${
|
|
469
|
-
join(home, 'Applications', `${
|
|
474
|
+
join('/Applications', `${definition.desktop.macos}.app`),
|
|
475
|
+
join(home, 'Applications', `${definition.desktop.macos}.app`),
|
|
470
476
|
];
|
|
471
477
|
}
|
|
472
478
|
if (platform !== 'win32')
|
|
473
479
|
return [];
|
|
474
480
|
const localAppData = env.LOCALAPPDATA ?? join(home, 'AppData', 'Local');
|
|
475
|
-
|
|
476
|
-
[Client.Cursor]: 'cursor',
|
|
477
|
-
[Client.Kiro]: 'Kiro',
|
|
478
|
-
[Client.LmStudio]: 'LM Studio',
|
|
479
|
-
[Client.VsCode]: 'Microsoft VS Code',
|
|
480
|
-
[Client.Windsurf]: 'Windsurf',
|
|
481
|
-
[Client.Zed]: 'Zed',
|
|
482
|
-
};
|
|
483
|
-
const directory = windowsDirectories[client];
|
|
484
|
-
return directory ? [join(localAppData, 'Programs', directory)] : [];
|
|
485
|
-
}
|
|
486
|
-
function clientConfigFootprints(client, cwd, home, platform, env) {
|
|
487
|
-
switch (client) {
|
|
488
|
-
case Client.Cline:
|
|
489
|
-
return [join(cwd, '.cline')];
|
|
490
|
-
case Client.Continue:
|
|
491
|
-
return [join(cwd, '.continue')];
|
|
492
|
-
case Client.Cursor:
|
|
493
|
-
return [join(home, '.cursor')];
|
|
494
|
-
case Client.Kiro:
|
|
495
|
-
return [join(home, '.kiro')];
|
|
496
|
-
case Client.LmStudio:
|
|
497
|
-
return [join(home, '.lmstudio')];
|
|
498
|
-
case Client.Windsurf:
|
|
499
|
-
return [join(home, '.codeium', 'windsurf')];
|
|
500
|
-
case Client.Zed:
|
|
501
|
-
return [dirname(zedSettingsPath(home, platform, env))];
|
|
502
|
-
default:
|
|
503
|
-
return [];
|
|
504
|
-
}
|
|
481
|
+
return [join(localAppData, 'Programs', definition.desktop.windows)];
|
|
505
482
|
}
|
|
506
483
|
async function pathAvailable(path) {
|
|
507
484
|
try {
|