feat: serve the MCP server at /mcp on the local servers

Mount the local MCP server at /mcp on the development and preview
servers for clients that connect by URL. The route accepts only
requests from this machine that name a loopback host and, when an
Origin is sent, come from a loopback origin, and drains oversized
bodies so the 413 response is delivered. The provider-order regression
test now pins the route between the providers and the API fallback.
This commit is contained in:
Sameh Khamis committed 2026-10-01 12:47:44 -07:00
1 parent b6af8b34e0
commit 469b1e8d89
8 files changed
+268 -7

No files matched your search

+4 -2
View File
@@ -63,10 +63,12 @@ test('root config retains existing named exports and standalone provider order',
assert.equal(compatibility[name], value, name);
const config = standaloneConfig({ mode: 'test' });
assert.deepEqual(
config.plugins.slice(2, -1).map((plugin) => plugin.name),
config.plugins.slice(2, -2).map((plugin) => plugin.name),
providers.localProviderPlugins().map((plugin) => plugin.name),
);
assert.equal(config.plugins.at(-2).name, 'gev-key-setup');
assert.equal(config.plugins.at(-3).name, 'gev-key-setup');
// The local MCP route follows every provider and precedes the API fallback.
assert.equal(config.plugins.at(-2).name, 'local-mcp');
assert.equal(config.plugins.at(-1).name, 'api-not-found');
});