@ttoss/http-server-mcp 0.35.0 → 0.36.0

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 CHANGED
@@ -1155,7 +1155,7 @@ test('every tool the instructions name exists', () => {
1155
1155
  });
1156
1156
  ```
1157
1157
 
1158
- Sizes are characters of `JSON.stringify({ name, description, inputSchema })`; `measureMcpSurface` answers them without judging. `total` and `perTool` have no default — they are the product's choice — while `instructions` defaults to `2048`, about what Claude Code keeps before cutting the rest silently. `findUnknownToolMentions` reads backticked names with a `-` or `_` (`` `get-next` ``); pass `pattern` when the instructions name tools another way.
1158
+ Sizes are characters of `JSON.stringify({ name, description, inputSchema })`; `measureMcpSurface` answers them without judging. `total` and `perTool` have no default — they are the product's choice. `description` (each tool's description alone) and `instructions` default to `2048`, where [Claude Code truncates both](https://code.claude.com/docs/en/mcp) without saying so; a schema is never cut, which is why `perTool` cannot stand in for `description`. `findUnknownToolMentions` reads backticked names with a `-` or `_` (`` `get-next` ``); pass `pattern` when the instructions name tools another way.
1159
1159
 
1160
1160
  ## AWS Lambda Deployment
1161
1161
 
package/dist/index.cjs CHANGED
@@ -215,11 +215,17 @@ var createMcpRequestServer = ({
215
215
  //#endregion
216
216
  //#region src/mcpSurface.ts
217
217
  /**
218
- * Claude Code keeps about this many characters of a server's instructions and
219
- * drops the rest without telling anyone, so a rule past it never reaches an
220
- * agent.
218
+ * Claude Code truncates a server's instructions at this many characters
219
+ * without telling anyone, so a rule past it never reaches an agent
220
+ * (https://code.claude.com/docs/en/mcp; a user can change it with
221
+ * `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`).
221
222
  */
222
223
  var DEFAULT_INSTRUCTIONS_LIMIT = 2048;
224
+ /**
225
+ * Claude Code truncates each tool description at the same length as the
226
+ * instructions, from the same documentation, and just as silently.
227
+ */
228
+ var DEFAULT_DESCRIPTION_LIMIT = 2048;
223
229
  var sizeOf = tool => {
224
230
  return JSON.stringify({
225
231
  name: tool.name,
@@ -254,6 +260,20 @@ var measureMcpSurface = ({
254
260
  instructions: instructions?.length ?? 0
255
261
  };
256
262
  };
263
+ var checkDescriptions = ({
264
+ tools,
265
+ limit
266
+ }) => {
267
+ return tools.flatMap(tool => {
268
+ const size = tool.description?.length ?? 0;
269
+ return size > limit ? [{
270
+ kind: "description",
271
+ name: tool.name,
272
+ size,
273
+ limit
274
+ }] : [];
275
+ });
276
+ };
257
277
  /**
258
278
  * Every limit an MCP surface exceeds, or `[]` when it fits.
259
279
  *
@@ -298,6 +318,10 @@ var checkMcpSurface = ({
298
318
  limit: budget.perTool
299
319
  });
300
320
  }
321
+ violations.push(...checkDescriptions({
322
+ tools,
323
+ limit: budget.description ?? 2048
324
+ }));
301
325
  const instructionsLimit = budget.instructions ?? 2048;
302
326
  if (report.instructions > instructionsLimit) violations.push({
303
327
  kind: "instructions",
@@ -1689,6 +1713,7 @@ var createMcpRouter = (server, options = {}) => {
1689
1713
  };
1690
1714
 
1691
1715
  //#endregion
1716
+ exports.DEFAULT_DESCRIPTION_LIMIT = DEFAULT_DESCRIPTION_LIMIT;
1692
1717
  exports.DEFAULT_INSTRUCTIONS_LIMIT = DEFAULT_INSTRUCTIONS_LIMIT;
1693
1718
  Object.defineProperty(exports, 'InMemoryServerEventBus', {
1694
1719
  enumerable: true,
package/dist/index.d.cts CHANGED
@@ -910,14 +910,21 @@ interface McpSurfaceReport {
910
910
  instructions: number;
911
911
  }
912
912
  /**
913
- * The limits a surface is checked against. Only `instructions` has a default:
914
- * the others are a product's own choice, not a property of any client.
913
+ * The limits a surface is checked against. `description` and `instructions`
914
+ * have defaults, because a client cuts them; `total` and `perTool` are a
915
+ * product's own choice, not a property of any client.
915
916
  */
916
917
  interface McpSurfaceBudget {
917
918
  /** Ceiling on the sum of every tool's size. */
918
919
  total?: number;
919
920
  /** Ceiling on any one tool's size. */
920
921
  perTool?: number;
922
+ /**
923
+ * Ceiling on any one tool's description length. Unlike `perTool`, it leaves
924
+ * out the name and input schema, which no client cuts.
925
+ * @default 2048
926
+ */
927
+ description?: number;
921
928
  /**
922
929
  * Ceiling on the instructions' length.
923
930
  * @default 2048
@@ -934,17 +941,28 @@ type McpSurfaceViolation = {
934
941
  name: string;
935
942
  size: number;
936
943
  limit: number;
944
+ } | {
945
+ kind: 'description';
946
+ name: string;
947
+ size: number;
948
+ limit: number;
937
949
  } | {
938
950
  kind: 'instructions';
939
951
  size: number;
940
952
  limit: number;
941
953
  };
942
954
  /**
943
- * Claude Code keeps about this many characters of a server's instructions and
944
- * drops the rest without telling anyone, so a rule past it never reaches an
945
- * agent.
955
+ * Claude Code truncates a server's instructions at this many characters
956
+ * without telling anyone, so a rule past it never reaches an agent
957
+ * (https://code.claude.com/docs/en/mcp; a user can change it with
958
+ * `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`).
946
959
  */
947
960
  declare const DEFAULT_INSTRUCTIONS_LIMIT = 2048;
961
+ /**
962
+ * Claude Code truncates each tool description at the same length as the
963
+ * instructions, from the same documentation, and just as silently.
964
+ */
965
+ declare const DEFAULT_DESCRIPTION_LIMIT = 2048;
948
966
  /**
949
967
  * Measures what an MCP server costs every session that connects to it: each
950
968
  * tool's name, description and input schema, and the instructions.
@@ -1829,4 +1847,4 @@ interface McpRouterOptions {
1829
1847
  */
1830
1848
  declare const createMcpRouter: (server: McpServer$1, options?: McpRouterOptions) => McpRouter;
1831
1849
  //#endregion
1832
- export { ApiCallOptions, CognitoUserPoolConfig, type CreateToolGateOptions, DEFAULT_INSTRUCTIONS_LIMIT, type DeferToolsOptions, type DefineToolParams, type GateToolParams, InMemoryServerEventBus, type JsonObjectSchema, McpAuthOptions, McpRouter, McpRouterOptions, McpServer, type McpSurfaceBudget, type McpSurfaceReport, type McpSurfaceTool, type McpSurfaceViolation, type RegisterAppResourceParams, type RegisterToolsParams, type RegisteredAppResource, type ServerEvent, type ServerEventBus, type ServerNotifier, type Tool, type ToolCallContext, type ToolCallGate, type ToolGate, type ToolIdentity, type ToolMetaParams, type ToolSchema, type ToolSearchArgs, UI_EXTENSION_ID, UI_RESOURCE_MIME_TYPE, type UiResourceCsp, type UiResourceMeta, type UiResourcePermissions, type UiToolVisibility, apiCall, checkMcpSurface, checkScopes, createMcpRouter, createToolGate, defineTool, errorBodyMessage, findUnknownToolMentions, getApiHeaders, getIdentity, getRequestLocale, measureMcpSurface, rankTools, registerAppResource, registerTools, z };
1850
+ export { ApiCallOptions, CognitoUserPoolConfig, type CreateToolGateOptions, DEFAULT_DESCRIPTION_LIMIT, DEFAULT_INSTRUCTIONS_LIMIT, type DeferToolsOptions, type DefineToolParams, type GateToolParams, InMemoryServerEventBus, type JsonObjectSchema, McpAuthOptions, McpRouter, McpRouterOptions, McpServer, type McpSurfaceBudget, type McpSurfaceReport, type McpSurfaceTool, type McpSurfaceViolation, type RegisterAppResourceParams, type RegisterToolsParams, type RegisteredAppResource, type ServerEvent, type ServerEventBus, type ServerNotifier, type Tool, type ToolCallContext, type ToolCallGate, type ToolGate, type ToolIdentity, type ToolMetaParams, type ToolSchema, type ToolSearchArgs, UI_EXTENSION_ID, UI_RESOURCE_MIME_TYPE, type UiResourceCsp, type UiResourceMeta, type UiResourcePermissions, type UiToolVisibility, apiCall, checkMcpSurface, checkScopes, createMcpRouter, createToolGate, defineTool, errorBodyMessage, findUnknownToolMentions, getApiHeaders, getIdentity, getRequestLocale, measureMcpSurface, rankTools, registerAppResource, registerTools, z };
package/dist/index.d.mts CHANGED
@@ -911,14 +911,21 @@ interface McpSurfaceReport {
911
911
  instructions: number;
912
912
  }
913
913
  /**
914
- * The limits a surface is checked against. Only `instructions` has a default:
915
- * the others are a product's own choice, not a property of any client.
914
+ * The limits a surface is checked against. `description` and `instructions`
915
+ * have defaults, because a client cuts them; `total` and `perTool` are a
916
+ * product's own choice, not a property of any client.
916
917
  */
917
918
  interface McpSurfaceBudget {
918
919
  /** Ceiling on the sum of every tool's size. */
919
920
  total?: number;
920
921
  /** Ceiling on any one tool's size. */
921
922
  perTool?: number;
923
+ /**
924
+ * Ceiling on any one tool's description length. Unlike `perTool`, it leaves
925
+ * out the name and input schema, which no client cuts.
926
+ * @default 2048
927
+ */
928
+ description?: number;
922
929
  /**
923
930
  * Ceiling on the instructions' length.
924
931
  * @default 2048
@@ -935,17 +942,28 @@ type McpSurfaceViolation = {
935
942
  name: string;
936
943
  size: number;
937
944
  limit: number;
945
+ } | {
946
+ kind: 'description';
947
+ name: string;
948
+ size: number;
949
+ limit: number;
938
950
  } | {
939
951
  kind: 'instructions';
940
952
  size: number;
941
953
  limit: number;
942
954
  };
943
955
  /**
944
- * Claude Code keeps about this many characters of a server's instructions and
945
- * drops the rest without telling anyone, so a rule past it never reaches an
946
- * agent.
956
+ * Claude Code truncates a server's instructions at this many characters
957
+ * without telling anyone, so a rule past it never reaches an agent
958
+ * (https://code.claude.com/docs/en/mcp; a user can change it with
959
+ * `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`).
947
960
  */
948
961
  declare const DEFAULT_INSTRUCTIONS_LIMIT = 2048;
962
+ /**
963
+ * Claude Code truncates each tool description at the same length as the
964
+ * instructions, from the same documentation, and just as silently.
965
+ */
966
+ declare const DEFAULT_DESCRIPTION_LIMIT = 2048;
949
967
  /**
950
968
  * Measures what an MCP server costs every session that connects to it: each
951
969
  * tool's name, description and input schema, and the instructions.
@@ -1830,4 +1848,4 @@ interface McpRouterOptions {
1830
1848
  */
1831
1849
  declare const createMcpRouter: (server: McpServer$1, options?: McpRouterOptions) => McpRouter;
1832
1850
  //#endregion
1833
- export { ApiCallOptions, CognitoUserPoolConfig, type CreateToolGateOptions, DEFAULT_INSTRUCTIONS_LIMIT, type DeferToolsOptions, type DefineToolParams, type GateToolParams, InMemoryServerEventBus, type JsonObjectSchema, McpAuthOptions, McpRouter, McpRouterOptions, McpServer, type McpSurfaceBudget, type McpSurfaceReport, type McpSurfaceTool, type McpSurfaceViolation, type RegisterAppResourceParams, type RegisterToolsParams, type RegisteredAppResource, type ServerEvent, type ServerEventBus, type ServerNotifier, type Tool, type ToolCallContext, type ToolCallGate, type ToolGate, type ToolIdentity, type ToolMetaParams, type ToolSchema, type ToolSearchArgs, UI_EXTENSION_ID, UI_RESOURCE_MIME_TYPE, type UiResourceCsp, type UiResourceMeta, type UiResourcePermissions, type UiToolVisibility, apiCall, checkMcpSurface, checkScopes, createMcpRouter, createToolGate, defineTool, errorBodyMessage, findUnknownToolMentions, getApiHeaders, getIdentity, getRequestLocale, measureMcpSurface, rankTools, registerAppResource, registerTools, z };
1851
+ export { ApiCallOptions, CognitoUserPoolConfig, type CreateToolGateOptions, DEFAULT_DESCRIPTION_LIMIT, DEFAULT_INSTRUCTIONS_LIMIT, type DeferToolsOptions, type DefineToolParams, type GateToolParams, InMemoryServerEventBus, type JsonObjectSchema, McpAuthOptions, McpRouter, McpRouterOptions, McpServer, type McpSurfaceBudget, type McpSurfaceReport, type McpSurfaceTool, type McpSurfaceViolation, type RegisterAppResourceParams, type RegisterToolsParams, type RegisteredAppResource, type ServerEvent, type ServerEventBus, type ServerNotifier, type Tool, type ToolCallContext, type ToolCallGate, type ToolGate, type ToolIdentity, type ToolMetaParams, type ToolSchema, type ToolSearchArgs, UI_EXTENSION_ID, UI_RESOURCE_MIME_TYPE, type UiResourceCsp, type UiResourceMeta, type UiResourcePermissions, type UiToolVisibility, apiCall, checkMcpSurface, checkScopes, createMcpRouter, createToolGate, defineTool, errorBodyMessage, findUnknownToolMentions, getApiHeaders, getIdentity, getRequestLocale, measureMcpSurface, rankTools, registerAppResource, registerTools, z };
package/dist/index.mjs CHANGED
@@ -212,11 +212,17 @@ var createMcpRequestServer = ({
212
212
  //#endregion
213
213
  //#region src/mcpSurface.ts
214
214
  /**
215
- * Claude Code keeps about this many characters of a server's instructions and
216
- * drops the rest without telling anyone, so a rule past it never reaches an
217
- * agent.
215
+ * Claude Code truncates a server's instructions at this many characters
216
+ * without telling anyone, so a rule past it never reaches an agent
217
+ * (https://code.claude.com/docs/en/mcp; a user can change it with
218
+ * `CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH`).
218
219
  */
219
220
  var DEFAULT_INSTRUCTIONS_LIMIT = 2048;
221
+ /**
222
+ * Claude Code truncates each tool description at the same length as the
223
+ * instructions, from the same documentation, and just as silently.
224
+ */
225
+ var DEFAULT_DESCRIPTION_LIMIT = 2048;
220
226
  var sizeOf = tool => {
221
227
  return JSON.stringify({
222
228
  name: tool.name,
@@ -251,6 +257,20 @@ var measureMcpSurface = ({
251
257
  instructions: instructions?.length ?? 0
252
258
  };
253
259
  };
260
+ var checkDescriptions = ({
261
+ tools,
262
+ limit
263
+ }) => {
264
+ return tools.flatMap(tool => {
265
+ const size = tool.description?.length ?? 0;
266
+ return size > limit ? [{
267
+ kind: "description",
268
+ name: tool.name,
269
+ size,
270
+ limit
271
+ }] : [];
272
+ });
273
+ };
254
274
  /**
255
275
  * Every limit an MCP surface exceeds, or `[]` when it fits.
256
276
  *
@@ -295,6 +315,10 @@ var checkMcpSurface = ({
295
315
  limit: budget.perTool
296
316
  });
297
317
  }
318
+ violations.push(...checkDescriptions({
319
+ tools,
320
+ limit: budget.description ?? 2048
321
+ }));
298
322
  const instructionsLimit = budget.instructions ?? 2048;
299
323
  if (report.instructions > instructionsLimit) violations.push({
300
324
  kind: "instructions",
@@ -1686,4 +1710,4 @@ var createMcpRouter = (server, options = {}) => {
1686
1710
  };
1687
1711
 
1688
1712
  //#endregion
1689
- export { DEFAULT_INSTRUCTIONS_LIMIT, InMemoryServerEventBus, McpServer, UI_EXTENSION_ID, UI_RESOURCE_MIME_TYPE, apiCall, checkMcpSurface, checkScopes, createMcpRouter, createToolGate, defineTool, errorBodyMessage, findUnknownToolMentions, getApiHeaders, getIdentity, getRequestLocale, measureMcpSurface, rankTools, registerAppResource, registerTools, z };
1713
+ export { DEFAULT_DESCRIPTION_LIMIT, DEFAULT_INSTRUCTIONS_LIMIT, InMemoryServerEventBus, McpServer, UI_EXTENSION_ID, UI_RESOURCE_MIME_TYPE, apiCall, checkMcpSurface, checkScopes, createMcpRouter, createToolGate, defineTool, errorBodyMessage, findUnknownToolMentions, getApiHeaders, getIdentity, getRequestLocale, measureMcpSurface, rankTools, registerAppResource, registerTools, z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttoss/http-server-mcp",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "description": "Model Context Protocol (MCP) server integration for @ttoss/http-server",
5
5
  "keywords": [
6
6
  "ai",
@@ -38,8 +38,8 @@
38
38
  "@modelcontextprotocol/server": "^2.0.0",
39
39
  "zod": "^4.4.3",
40
40
  "@ttoss/auth-core": "^0.17.2",
41
- "@ttoss/http-server": "^0.13.0",
42
41
  "@ttoss/i18n-core": "^0.8.1",
42
+ "@ttoss/http-server": "^0.13.0",
43
43
  "@ttoss/http-server-auth": "^0.8.5"
44
44
  },
45
45
  "devDependencies": {