Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

fix(mcp): standardize server naming to use hyphens in configuration keys

Dev jacob58700b43922f
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.ts
index 1059800a5..a0de88c37 100644
--- a/cli/src/lib/gridLaunch.spec.ts
+++ b/cli/src/lib/gridLaunch.spec.ts
@@ -447,9 +447,9 @@ describe('web tools (grid ADR 0041)', () => {
})
it("points Codex at it through env_http_headers, which carries the WHOLE header value", () => {
- expect(codexArg('mcp_servers.grid_web.url')).toBe(`mcp_servers.grid_web.url="${MCP_URL}"`)
- expect(codexArg('mcp_servers.grid_web.env_http_headers.Authorization'))
- .toBe('mcp_servers.grid_web.env_http_headers.Authorization="GRID_MCP_AUTHORIZATION"')
+ expect(codexArg('mcp_servers.grid-web.url')).toBe(`mcp_servers.grid-web.url="${MCP_URL}"`)
+ expect(codexArg('mcp_servers.grid-web.env_http_headers.Authorization'))
+ .toBe('mcp_servers.grid-web.env_http_headers.Authorization="GRID_MCP_AUTHORIZATION"')
// Bearer included — `bearer_token_env_var` takes a bare token, this one does not, and ADR 0041
// D-d calls confusing the two a silent 401.
expect(launchOf('codex', WITH_MCP).env.GRID_MCP_AUTHORIZATION).toBe(`Bearer ${WIRE.apiKey}`)
@@ -491,6 +491,21 @@ describe('web tools (grid ADR 0041)', () => {
expect(Object.keys(JSON.parse(file.content))).toEqual(['mcp_servers'])
})
+ it('calls the server the same thing in every harness', () => {
+ // The tools are named after it — an agent sees `mcp__grid-web__web_search` — so a harness that
+ // spells it differently gets differently-named tools, and a prompt or skill naming one silently
+ // misses on the other. Codex is where this is easy to get wrong: its config keys are dotted TOML
+ // paths, which look like they could not carry a `-`. They can.
+ expect(Object.keys(claudeMcpJson().mcpServers)).toEqual(['grid-web'])
+ expect(Object.keys(opencodeConfig().mcp)).toEqual(['grid-web'])
+ expect(Object.keys(JSON.parse(launchOf('hermes', WITH_MCP).configDir!.files[0]!.content).mcp_servers))
+ .toEqual(['grid-web'])
+ for (const arg of launchOf('codex', WITH_MCP).args) {
+ expect(arg, 'codex renamed the server, and with it every tool').not.toContain('grid_web')
+ }
+ expect(codexArg('mcp_servers.grid-web.url')).toBeDefined()
+ })
+
it('never writes the key to disk or to an argv', () => {
for (const engine of ['claude', 'codex', 'opencode', 'hermes'] as const) {
const launch = launchOf(engine, WITH_MCP)
@@ -519,7 +534,7 @@ describe('web tools (grid ADR 0041)', () => {
// An older desktop, and the no-regression promise: the launch is byte-for-byte what it was.
expect(launchOf('claude', WITH_MODEL).args).toEqual([])
expect(launchOf('claude', WITH_MODEL).env.GRID_API_KEY).toBeUndefined()
- expect(codexArg('mcp_servers.grid_web.url', WITH_MODEL)).toBeUndefined()
+ expect(codexArg('mcp_servers.grid-web.url', WITH_MODEL)).toBeUndefined()
expect(launchOf('codex', WITH_MODEL).env.GRID_MCP_AUTHORIZATION).toBeUndefined()
expect(opencodeConfig(WITH_MODEL).mcp).toBeUndefined()
// Hermes had no config directory at all before web tools, so it goes back to having none.
diff --git a/cli/src/lib/gridWebMcp.ts b/cli/src/lib/gridWebMcp.ts
index e5554c817..86db52944 100644
--- a/cli/src/lib/gridWebMcp.ts
+++ b/cli/src/lib/gridWebMcp.ts
@@ -43,12 +43,6 @@
*/
export const GRID_MCP_SERVER_NAME = 'grid-web'
-/**
- * Codex's spelling of that name. Its config keys are TOML paths and `-` is not a bare TOML key,
- * which is why `grid mcp config` prints `[mcp_servers.grid_web]` too.
- */
-const GRID_MCP_CODEX_KEY = GRID_MCP_SERVER_NAME.replace(/-/g, '_')
-
/**
* The variable Codex reads its header out of.
*
@@ -92,11 +86,18 @@ export function claudeMcpConfig(mcpUrl: string, keyVar: string): string {
/**
* The same server as Codex `-c` overrides, which is how its provider is configured too — so this
* needs no config file either. Values are quoted as JSON because a `-c` value is parsed as TOML.
+ *
+ * ⚠️ The name keeps its HYPHEN here, like everywhere else. A dotted `-c` path looks like it would
+ * need `grid_web` — TOML bare keys do allow `-`, and `codex mcp add` writes `[mcp_servers.grid-web]`
+ * itself. Renaming it for this one harness would rename its TOOLS too: an agent would see
+ * `mcp__grid_web__web_search` on Codex and `mcp__grid-web__web_search` everywhere else, so a prompt
+ * or skill naming one would silently miss on the other. Measured against codex 0.144.6, which reads
+ * the hyphenated key back from `-c` without complaint.
*/
export function codexMcpArgs(mcpUrl: string): string[] {
return [
- '-c', `mcp_servers.${GRID_MCP_CODEX_KEY}.url=${JSON.stringify(mcpUrl)}`,
- '-c', `mcp_servers.${GRID_MCP_CODEX_KEY}.env_http_headers.Authorization=${JSON.stringify(GRID_MCP_AUTH_VAR)}`,
+ '-c', `mcp_servers.${GRID_MCP_SERVER_NAME}.url=${JSON.stringify(mcpUrl)}`,
+ '-c', `mcp_servers.${GRID_MCP_SERVER_NAME}.env_http_headers.Authorization=${JSON.stringify(GRID_MCP_AUTH_VAR)}`,
]
}