Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

docs(mcp-host): correct attachment limits and body budget comments

Alfredo Lopez120cb362bb9e
diff --git a/mcp-host/README.md b/mcp-host/README.md
index 8e3e74eb8..7bc8a86e7 100644
--- a/mcp-host/README.md
+++ b/mcp-host/README.md
@@ -55,7 +55,8 @@ MCP Host is a Kubernetes-native service that reads Host CRD configuration and pr
| `CLERUM_ENABLE_RESPONSE_ATTACHMENTS` | Enables attachment passthrough in runtime responses when tools return supported media. | `CLERUM_ENABLE_RESPONSE_ATTACHMENTS=true` |
| `CLERUM_ATTACHMENT_MAX_COUNT` | Maximum number of attachments returned per response. | `CLERUM_ATTACHMENT_MAX_COUNT=3` |
| `CLERUM_ATTACHMENT_MAX_BYTES` | Maximum decoded size per attachment in bytes (oversized payloads are dropped). | `CLERUM_ATTACHMENT_MAX_BYTES=52428800` |
-| `CLERUM_ATTACHMENT_FILE_MAX_BYTES` | Maximum decoded size in bytes of one incoming `kind:'file'` attachment; a larger file rejects the message with `FILE_ATTACHMENT_TOO_LARGE`. An invalid value stops the Host at startup. | `CLERUM_ATTACHMENT_FILE_MAX_BYTES=3145728` |
+| `CLERUM_ATTACHMENT_FILE_MAX_BYTES` | Maximum decoded size in bytes of one incoming `kind:'file'` attachment; one larger file rejects the message with `FILE_ATTACHMENT_TOO_LARGE`. File base64 also counts against the 6 MiB non-image body budget, so two files at the 3 MiB default get HTTP 413 before admission. An invalid value stops the Host at startup. | `CLERUM_ATTACHMENT_FILE_MAX_BYTES=3145728` |
+| `CLERUM_FILE_REFERENCE_MAX_COUNT` | Maximum number of `fileReferences` (structured Global Files selections, #666) one message may carry; more rejects the message with `FILE_REFERENCE_INVALID`. An invalid value stops the Host at startup. | `CLERUM_FILE_REFERENCE_MAX_COUNT=10` |
| `CLERUM_ATTACHMENT_TEXT_READ_MAX_BYTES` | Maximum bytes one `clerum__attachment_read` call returns; longer text is returned with `truncated:true` and read on with `offset`. An invalid value stops the Host at startup. | `CLERUM_ATTACHMENT_TEXT_READ_MAX_BYTES=262144` |
| `CLERUM_MEMORY_ENABLED` | Enables workspace memory persistence features. | `CLERUM_MEMORY_ENABLED=true` |
| `CLERUM_MEMORY_WORKSPACE_PATH` | Sets workspace directory path used when memory mode is enabled. | `CLERUM_MEMORY_WORKSPACE_PATH=/workspace` |
diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.json
index 0854ac125..144427752 100644
--- a/mcp-host/package-lock.json
+++ b/mcp-host/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.451",
+ "version": "0.1.452",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-mcp-host",
- "version": "0.1.451",
+ "version": "0.1.452",
"license": "SEE LICENSE IN LICENSE",
"dependencies": {
"@anthropic-ai/sdk": "^0.32.0",
diff --git a/mcp-host/package.json b/mcp-host/package.json
index 133f9ab58..6a7083d84 100644
--- a/mcp-host/package.json
+++ b/mcp-host/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-mcp-host",
- "version": "0.1.451",
+ "version": "0.1.452",
"description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude",
"main": "dist/main.js",
"engines": {
diff --git a/mcp-host/src/server.ts b/mcp-host/src/server.ts
index 9d45efb78..9da365783 100644
--- a/mcp-host/src/server.ts
+++ b/mcp-host/src/server.ts
@@ -129,18 +129,23 @@ export type {
} from './server/types'
/**
- * Body budgets for chat payloads carrying base64 image attachments.
+ * Body budgets for chat payloads carrying base64 attachments.
*
- * Intentional mirror of `rpc-proxy/src/app.ts`: rpc-proxy has no dependency on
- * any @clerum package, so the two services cannot share one source without a
- * new package. Both copies must change together.
+ * Intentional mirror of `rpc-proxy/src/middleware/chatJsonBody.ts`: rpc-proxy
+ * has no dependency on any @clerum package, so the two services cannot share
+ * one source without a new package. Both copies must change together.
*
* - MAX_CHAT_BODY_BYTES stays 24MiB so one exceptional 16MiB 2048 PNG
* (~21.3MiB base64) plus the 1MiB non-image share still fits. Every other
- * route keeps the 6MiB default.
+ * route keeps the 10mb ordinary JSON cap (see the parsers below).
* - MAX_NON_IMAGE_BODY_BYTES bounds that same body MINUS credited image
* base64 (16MiB per image, at most 20 images / 16MiB total). Usual product
* target remains 5 / 9 / 14 MiB at 2048 px.
+ * - `kind:'file'` attachments are never credited: their base64 (4/3 of the
+ * decoded size) counts against MAX_NON_IMAGE_BODY_BYTES with the rest of
+ * the body. One file at the 3MiB CLERUM_ATTACHMENT_FILE_MAX_BYTES default
+ * (4MiB base64) fits; two do not, and the message gets this 413 before
+ * admission can answer FILE_ATTACHMENT_TOO_LARGE for either file.
*/
const MAX_CHAT_BODY_BYTES = 24 * 1024 * 1024
const MAX_NON_IMAGE_BODY_BYTES = 6 * 1024 * 1024
@@ -307,8 +312,10 @@ export class RPCServer {
next()
})
- // Image attachments are sent as base64 in /v1/runtime/messages.
- // That route alone gets the 24 MiB ceiling. Every other Host route uses
+ // Image and file attachments are sent as base64 in /v1/runtime/messages.
+ // That route alone gets the 24 MiB ceiling; within it, only qualifying
+ // images are credited, and `kind:'file'` base64 is charged to the 6 MiB
+ // non-image budget like any other field. 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' })