Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(mcp-host): keep Host non-chat JSON on the 10mb parser
Alfredo Lopez2e4179042733
diff --git a/docs/architecture/codex-subscription-transport-contract.md b/docs/architecture/codex-subscription-transport-contract.mdindex eb74e672b..811f2f205 100644--- a/docs/architecture/codex-subscription-transport-contract.md+++ b/docs/architecture/codex-subscription-transport-contract.md@@ -62,8 +62,9 @@ the shared visual envelope budget refuses to start.Desktop enforces the 16 MiB individual and 16 MiB combined hard attachmentbudgets (usual target remains 5 / 9 MiB).-RPC and Host permit a 24 MiB JSON body only on their message POST routes; their-6 MiB budget for other content and routes remains unchanged. The proxy's larger+RPC and Host permit a 24 MiB JSON body only on their message POST routes; chat+non-image bytes stay on the 6 MiB share. Non-chat rpc-proxy and Host control+routes keep the 10 MB ordinary JSON cap. The proxy's largerparser requires a valid platform identity on the visual completion route.Admin and unauthenticated requests retain the ordinary configured body limit.`CODEX_LLM_PROXY_MAX_VISUAL_BODY_BYTES` controls the visual transport ceiling;diff --git a/docs/testing/codex-subscription-validation.md b/docs/testing/codex-subscription-validation.mdindex af321107b..b74549aba 100644--- a/docs/testing/codex-subscription-validation.md+++ b/docs/testing/codex-subscription-validation.md@@ -14,7 +14,7 @@ Capacity checks cover the usual 5 / 9 / 14 MiB target and the hard 16 MiBper-image / 16 MiB aggregate / 24 MiB envelope ceiling, plus the 2048 pxmodel bound. Exercise 5 MiB, 12 MiB (exceptional, above 10 MiB), 10+5 MiBand 3x5 MiB acceptance, plus overflow above 16 MiB. V1 and V2 non-image fields keep a 1 MiB ceiling;-unrelated RPC/Host routes keep 6 MiB. The larger proxy parser must not admit an+chat non-image bytes stay at 6 MiB; unrelated rpc-proxy and Host control routes keep the 10 MB ordinary JSON cap. The larger proxy parser must not admit ananonymous, wrong-scope or admin request, or enlarge V1's effective body limit.Changing these budgets does not change OAuth, grants, ticket binding, origins,fallback, or connection selection. Local capacity evidence is separate fromdiff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex a366bc26f..cd947ff9e 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.367",+ "version": "0.1.368","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.367",+ "version": "0.1.368","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 957c51bd2..3dc925d7b 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.367",+ "version": "0.1.368","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/__tests__/bodylimits.test.ts b/mcp-host/src/__tests__/bodylimits.test.tsindex 51a2ace6b..22471a7dd 100644--- a/mcp-host/src/__tests__/bodylimits.test.ts+++ b/mcp-host/src/__tests__/bodylimits.test.ts@@ -8,7 +8,8 @@* - The attachments arrive byte-identical: nothing is dropped, truncated or* re-encoded on the way through the parser.* - The larger ceiling is NOT a general text allowance: non-image bytes stay- * capped at 6MiB, and every other route keeps its 6MiB parser.+ * capped at 6MiB. Every other Host route keeps the 10mb ordinary JSON+ * parser, matching rpc-proxy `jsonBody`.** The auth boundary is exercised in its documented "auth disabled" test mode* (`CLERUM_ENABLE_AUTH=false`), matching server.attachments.test.ts; the edge@@ -329,12 +330,19 @@ describe('mcp-host runtime message body budget', () => {expect(captured).toHaveLength(0)})- it('keeps the 6MiB parser on every other POST route', async () => {- const response = await fetch(`${baseUrl}/v1/runtime/model`, {+ it('keeps the 10mb parser on every other POST route', async () => {+ const over = await fetch(`${baseUrl}/v1/runtime/model`, {+ method: 'POST',+ headers: rpcProxyEdgeHeaders(),+ body: JSON.stringify({ model: 'x'.repeat(11 * MIB) }),+ })+ expect(over.status).toBe(413)++ const under = await fetch(`${baseUrl}/v1/runtime/model`, {method: 'POST',headers: rpcProxyEdgeHeaders(),body: JSON.stringify({ model: 'x'.repeat(7 * MIB) }),})- expect(response.status).toBe(413)+ expect(under.status).not.toBe(413)})})diff --git a/mcp-host/src/server.ts b/mcp-host/src/server.tsindex 854de7be3..9d45efb78 100644--- a/mcp-host/src/server.ts+++ b/mcp-host/src/server.ts@@ -308,9 +308,10 @@ export class RPCServer {})// Image attachments are sent as base64 in /v1/runtime/messages.- // That route alone gets the 24 MiB ceiling. Every other route uses this- // PR's 6mb non-image default (not the historical 10mb parser).- const jsonParser = express.json({ limit: '6mb' })+ // That route alone gets the 24 MiB ceiling. Every other Host route uses+ // the same 10mb ordinary JSON cap as rpc-proxy `jsonBody`, so a future+ // non-chat control body cannot 413 here and pass the proxy.+ const jsonParser = express.json({ limit: '10mb' })const chatJsonParser = express.json({limit: MAX_CHAT_BODY_BYTES,verify: (req, _res, buffer) => {