@agent-native/core 0.49.22 → 0.49.24

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.
Files changed (79) hide show
  1. package/dist/agent/production-agent.d.ts +1 -0
  2. package/dist/agent/production-agent.d.ts.map +1 -1
  3. package/dist/agent/production-agent.js +15 -0
  4. package/dist/agent/production-agent.js.map +1 -1
  5. package/dist/agent/tool-search.d.ts.map +1 -1
  6. package/dist/agent/tool-search.js +32 -7
  7. package/dist/agent/tool-search.js.map +1 -1
  8. package/dist/cli/connect.d.ts +2 -3
  9. package/dist/cli/connect.d.ts.map +1 -1
  10. package/dist/cli/connect.js +60 -37
  11. package/dist/cli/connect.js.map +1 -1
  12. package/dist/cli/pr-visual-recap-workflow.d.ts +5 -7
  13. package/dist/cli/pr-visual-recap-workflow.d.ts.map +1 -1
  14. package/dist/cli/pr-visual-recap-workflow.js +5 -7
  15. package/dist/cli/pr-visual-recap-workflow.js.map +1 -1
  16. package/dist/cli/recap.d.ts +44 -52
  17. package/dist/cli/recap.d.ts.map +1 -1
  18. package/dist/cli/recap.js +441 -414
  19. package/dist/cli/recap.js.map +1 -1
  20. package/dist/client/AssistantChat.d.ts +6 -3
  21. package/dist/client/AssistantChat.d.ts.map +1 -1
  22. package/dist/client/AssistantChat.js +1 -1
  23. package/dist/client/AssistantChat.js.map +1 -1
  24. package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
  25. package/dist/client/MultiTabAssistantChat.js +23 -3
  26. package/dist/client/MultiTabAssistantChat.js.map +1 -1
  27. package/dist/client/agent-chat.d.ts +8 -0
  28. package/dist/client/agent-chat.d.ts.map +1 -1
  29. package/dist/client/agent-chat.js +43 -1
  30. package/dist/client/agent-chat.js.map +1 -1
  31. package/dist/client/blocks/library/AnnotatedCodeBlock.d.ts.map +1 -1
  32. package/dist/client/blocks/library/AnnotatedCodeBlock.js +4 -1
  33. package/dist/client/blocks/library/AnnotatedCodeBlock.js.map +1 -1
  34. package/dist/client/blocks/library/DiffBlock.d.ts.map +1 -1
  35. package/dist/client/blocks/library/DiffBlock.js +20 -7
  36. package/dist/client/blocks/library/DiffBlock.js.map +1 -1
  37. package/dist/client/blocks/library/annotation-rail.js +5 -5
  38. package/dist/client/blocks/library/annotation-rail.js.map +1 -1
  39. package/dist/client/builder-frame.d.ts +2 -0
  40. package/dist/client/builder-frame.d.ts.map +1 -1
  41. package/dist/client/builder-frame.js +2 -0
  42. package/dist/client/builder-frame.js.map +1 -1
  43. package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
  44. package/dist/client/composer/TiptapComposer.js +15 -2
  45. package/dist/client/composer/TiptapComposer.js.map +1 -1
  46. package/dist/client/mcp-app-host.d.ts +3 -0
  47. package/dist/client/mcp-app-host.d.ts.map +1 -1
  48. package/dist/client/mcp-app-host.js +13 -0
  49. package/dist/client/mcp-app-host.js.map +1 -1
  50. package/dist/coding-tools/run-code.d.ts.map +1 -1
  51. package/dist/coding-tools/run-code.js +69 -17
  52. package/dist/coding-tools/run-code.js.map +1 -1
  53. package/dist/integrations/plugin.d.ts.map +1 -1
  54. package/dist/integrations/plugin.js +2 -0
  55. package/dist/integrations/plugin.js.map +1 -1
  56. package/dist/mcp/build-server.d.ts +12 -10
  57. package/dist/mcp/build-server.d.ts.map +1 -1
  58. package/dist/mcp/build-server.js +53 -89
  59. package/dist/mcp/build-server.js.map +1 -1
  60. package/dist/mcp/connect-route.d.ts.map +1 -1
  61. package/dist/mcp/connect-route.js +5 -4
  62. package/dist/mcp/connect-route.js.map +1 -1
  63. package/dist/mcp/oauth-token.d.ts +6 -5
  64. package/dist/mcp/oauth-token.d.ts.map +1 -1
  65. package/dist/mcp/oauth-token.js.map +1 -1
  66. package/dist/mcp/stdio.d.ts.map +1 -1
  67. package/dist/mcp/stdio.js +9 -2
  68. package/dist/mcp/stdio.js.map +1 -1
  69. package/dist/provider-api/staging.d.ts.map +1 -1
  70. package/dist/provider-api/staging.js +6 -4
  71. package/dist/provider-api/staging.js.map +1 -1
  72. package/dist/server/agent-chat-plugin.d.ts +10 -7
  73. package/dist/server/agent-chat-plugin.d.ts.map +1 -1
  74. package/dist/server/agent-chat-plugin.js.map +1 -1
  75. package/docs/content/actions.md +1 -1
  76. package/docs/content/external-agents.md +53 -40
  77. package/docs/content/mcp-protocol.md +16 -11
  78. package/docs/content/pr-visual-recap.md +1 -1
  79. package/package.json +1 -1
@@ -74,20 +74,22 @@ export interface MCPConfig {
74
74
  * Curated allow-list of action names served to **external connector** clients
75
75
  * on a hosted multi-tenant deployment.
76
76
  *
77
- * When `AGENT_NATIVE_CONNECTOR_CATALOG=1` is set and this list is non-empty,
78
- * the MCP server trims both the advertised tool list *and* the callable
77
+ * Whenever this list is non-empty it is active by default for **every**
78
+ * caller hosted connectors, code/stdio clients, and the local CLI alike.
79
+ * The MCP server trims both the advertised tool list *and* the callable
79
80
  * surface to exactly these names (plus any builtin cross-app tools such as
80
81
  * `list_apps` / `open_app`). Any tool call for a name **not** in the list is
81
82
  * rejected — it is not merely hidden. This prevents the ~105-tool full
82
83
  * catalog from landing in every external agent's context window and removes
83
84
  * footguns (db-exec, seed-*, extension tools, browser-session tools, etc.)
84
- * from multi-tenant hosted connectors.
85
+ * from connectors. It is no longer gated behind an environment variable, and
86
+ * the catalog is never inferred from the client name/user-agent.
85
87
  *
86
- * Callers who need the full surface can opt up with
87
- * `agent-native connect --full-catalog`, which embeds a `catalog_scope: "full"`
88
- * claim in their connect-minted JWT. Local/dev deployments without
89
- * `AGENT_NATIVE_CONNECTOR_CATALOG=1` are unaffected they always see the
90
- * full surface.
88
+ * `tool-search` stays available in the compact catalog so any trimmed tool is
89
+ * reachable on demand. Callers who need the full surface up front opt in
90
+ * explicitly with `agent-native connect --full-catalog` (embeds a
91
+ * `catalog_scope: "full"` claim in the connect-minted JWT) or the
92
+ * deployment-wide `AGENT_NATIVE_MCP_FULL_CATALOG=1` env override.
91
93
  *
92
94
  * Declare this in your template's `createAgentChatPlugin` options rather than
93
95
  * setting it on `MCPConfig` directly; the plugin copies it through.
@@ -235,8 +237,8 @@ export declare function verifyAuth(authHeader: string | undefined, ownerEmailHea
235
237
  /**
236
238
  * The caller explicitly opted up to the full connector catalog by minting
237
239
  * their token with `--full-catalog` (or equivalent). When `true`, the
238
- * connector-catalog tier filter is bypassed even when
239
- * `AGENT_NATIVE_CONNECTOR_CATALOG=1` is set. Derived from a
240
+ * compact/connector-catalog tier filter (active by default whenever a
241
+ * `connectorCatalog` is declared) is bypassed for this caller. Derived from a
240
242
  * `catalog_scope: "full"` claim in the verified A2A/connect JWT.
241
243
  */
242
244
  fullCatalog?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"build-server.d.ts","sourceRoot":"","sources":["../../src/mcp/build-server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAsChE,MAAM,WAAW,SAAS;IACxB,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,KAAK,CAAC,EAAE,KAAK,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;KAC1B,CAAC,CAAC;IACH,uCAAuC;IACvC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACrC;;;;;;;;;;;OAWG;IACH,iBAAiB,CAAC,EA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SAAS,EACrC,OAAO,GAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;CAAO,GACxE,OAAO,CAAC;IACT,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC,CAyID;AAED,wBAAsB,sBAAsB,CAC1C,SAAS,EAAE,MAAM,GAAG,SAAS,GAC5B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAS7B"}
@@ -39,6 +39,10 @@ const COMPACT_MCP_APP_CATALOG_BUILTINS = new Set([
39
39
  "open_app",
40
40
  "ask_app",
41
41
  "create_embed_session",
42
+ // `tool-search` MUST stay in every compact/connector surface: it is how a
43
+ // compacted client discovers and loads any action on demand, which is what
44
+ // makes "small catalog by default" safe instead of limiting.
45
+ "tool-search",
42
46
  ]);
43
47
  function isActionAdvertisedInCompactMcpAppCatalog(name, entry, config) {
44
48
  if (COMPACT_MCP_APP_CATALOG_BUILTINS.has(name))
@@ -52,71 +56,38 @@ function isActionAdvertisedInCompactMcpAppCatalog(name, entry, config) {
52
56
  }
53
57
  return false;
54
58
  }
55
- const MCP_APP_OAUTH_CLIENT_RE = /\b(chatgpt|openai|claude|anthropic)\b/i;
56
- const NON_APP_OAUTH_CLIENT_RE = /\b(code|cli|cursor|codex|goose|postman|mcpjam|inspector)\b/i;
57
- const MCP_APP_OAUTH_REDIRECT_HOST_RE = /(^|\.)((chatgpt|openai)\.com|claude\.ai|anthropic\.com)$/i;
58
- const FULL_CATALOG_CLIENT_RE = /\b(agent-native-mcp-(proxy|stdio|standalone)|code|cli|cursor|codex|goose|postman|mcpjam|inspector)\b/i;
59
- async function isKnownMcpAppOAuthClient(identity) {
60
- const clientId = identity?.oauthClientId?.trim();
61
- if (!clientId)
62
- return false;
63
- function isKnownAppClientName(value) {
64
- if (!value)
65
- return false;
66
- return (MCP_APP_OAUTH_CLIENT_RE.test(value) &&
67
- !NON_APP_OAUTH_CLIENT_RE.test(value));
68
- }
69
- function isKnownNonAppClientName(value) {
70
- return Boolean(value && NON_APP_OAUTH_CLIENT_RE.test(value));
71
- }
72
- function isKnownMcpAppRedirectUri(uri) {
73
- try {
74
- const url = new URL(uri);
75
- return (url.protocol === "https:" &&
76
- MCP_APP_OAUTH_REDIRECT_HOST_RE.test(url.hostname));
77
- }
78
- catch {
79
- return false;
80
- }
81
- }
82
- if (isKnownAppClientName(clientId))
83
- return true;
84
- if (isKnownNonAppClientName(clientId))
85
- return false;
86
- try {
87
- const { getOAuthClient } = await import("./oauth-store.js");
88
- const client = await getOAuthClient(clientId);
89
- // If the token carries an OAuth client id but its registration is missing,
90
- // keep the model on the compact MCP Apps surface instead of exposing every
91
- // private action/schema.
92
- if (!client)
93
- return true;
94
- if (isKnownAppClientName(client.clientName))
95
- return true;
96
- if (isKnownNonAppClientName(client.clientName))
97
- return false;
98
- if (client.redirectUris.some(isKnownMcpAppRedirectUri))
99
- return true;
100
- // Most OAuth hosts are UI-oriented MCP clients. Preserve the full catalog
101
- // only for known code/CLI clients so unknown browser hosts cannot trigger
102
- // massive resources/list payloads.
103
- return true;
104
- }
105
- catch {
106
- // On metadata lookup errors, fail compact instead of falling back to the
107
- // full action surface; ChatGPT/Claude old tokens otherwise get huge lists.
108
- return true;
109
- }
110
- }
111
59
  function explicitlyRequestsFullMcpCatalog(requestMeta) {
60
+ // Full catalog is a deliberate, rare opt-in — NEVER a default, and NEVER
61
+ // inferred from the client name / user-agent. It is reached only by an
62
+ // explicit deployment env or a token minted with
63
+ // `agent-native connect --full-catalog` (which embeds `catalog_scope: "full"`,
64
+ // surfaced here as requestMeta.fullCatalog). Dumping ~105 tool schemas
65
+ // (100k+ tokens) into a context window just because a client called itself
66
+ // "code"/"cursor"/"codex" was a recurring footgun. Everything else gets the
67
+ // connector/compact catalog plus `tool-search`, which keeps every tool
68
+ // reachable on demand.
112
69
  if (process.env.AGENT_NATIVE_MCP_FULL_CATALOG === "1")
113
70
  return true;
114
- if (requestMeta?.fullCatalog === true)
115
- return true;
116
- if (requestMeta?.clientHint) {
117
- return FULL_CATALOG_CLIENT_RE.test(requestMeta.clientHint);
118
- }
119
- return FULL_CATALOG_CLIENT_RE.test(requestMeta?.clientName ?? "");
71
+ return requestMeta?.fullCatalog === true;
72
+ }
73
+ const warnedFullCatalogKeys = new Set();
74
+ /**
75
+ * Loud, deduped warning emitted whenever the full MCP catalog is actually
76
+ * served. Full catalog is a deliberate, rare opt-in (env or a `--full-catalog`
77
+ * token claim); logging it makes an accidental ~100k-token tool dump visible
78
+ * instead of silent, so a regression can't quietly reintroduce the footgun.
79
+ */
80
+ function warnFullCatalogServed(toolCount) {
81
+ const source = process.env.AGENT_NATIVE_MCP_FULL_CATALOG === "1"
82
+ ? "AGENT_NATIVE_MCP_FULL_CATALOG=1"
83
+ : "a token minted with --full-catalog (catalog_scope:full)";
84
+ const key = `${source}:${toolCount}`;
85
+ if (warnedFullCatalogKeys.has(key))
86
+ return;
87
+ warnedFullCatalogKeys.add(key);
88
+ console.warn(`[agent-native] Serving the FULL MCP tool catalog (${toolCount} tools) via ${source}. ` +
89
+ `This is a large context payload meant to be a rare, explicit opt-in — most ` +
90
+ `clients should use the default compact/connector catalog + tool-search instead.`);
120
91
  }
121
92
  /**
122
93
  * Returns true when the given action name is in the template's connector
@@ -132,18 +103,6 @@ function isActionInConnectorCatalog(name, config) {
132
103
  return false;
133
104
  return config.connectorCatalog.includes(name);
134
105
  }
135
- function shouldUseCompactMcpCatalogByDefault(identity, requestMeta) {
136
- if (explicitlyRequestsFullMcpCatalog(requestMeta))
137
- return false;
138
- // OAuth callers are classified through `isKnownMcpAppOAuthClient`: unknown
139
- // OAuth clients compact by default, while known code/CLI clients stay full.
140
- if (identity?.oauthClientId)
141
- return false;
142
- // A real authenticated remote HTTP caller with no OAuth client metadata is
143
- // usually a chat-host static-token connector. Keep it on the app-facing
144
- // verbs so a host cannot dump every action schema into a giant tool card.
145
- return requestMeta?.fullSurface === true;
146
- }
147
106
  function metadataObject(value) {
148
107
  return value && typeof value === "object" && !Array.isArray(value)
149
108
  ? value
@@ -844,25 +803,27 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
844
803
  : config.actions;
845
804
  const actions = mergeBuiltinTools(config, baseActions, requestMeta);
846
805
  const visibleActions = Object.fromEntries(Object.entries(actions).filter(([, entry]) => isActionVisibleForOAuthScope(entry, effectiveIdentity?.oauthScopes)));
847
- const compactMcpAppCatalog = explicitlyRequestsFullMcpCatalog(requestMeta)
848
- ? false
849
- : (Array.isArray(effectiveIdentity?.oauthScopes) &&
850
- hasMcpOAuthScope(effectiveIdentity.oauthScopes, "mcp:apps")) ||
851
- (await isKnownMcpAppOAuthClient(effectiveIdentity)) ||
852
- shouldUseCompactMcpCatalogByDefault(effectiveIdentity, requestMeta);
806
+ const fullCatalogRequested = explicitlyRequestsFullMcpCatalog(requestMeta);
807
+ // Compact/connector is the DEFAULT for every caller — hosted connectors,
808
+ // code clients (Claude Code / Cursor / Codex), and the local CLI alike. The
809
+ // full ~105-tool catalog is served only on the explicit opt-in above, so a
810
+ // host can never dump every action schema into one giant tool card. The
811
+ // `mcp:apps` scope still lands on this compact MCP-Apps surface; with no
812
+ // opt-in, everyone else does too.
813
+ const compactMcpAppCatalog = !fullCatalogRequested;
853
814
  const advertisedActionsBeforeConnector = compactMcpAppCatalog
854
815
  ? Object.fromEntries(Object.entries(visibleActions).filter(([name, entry]) => isActionAdvertisedInCompactMcpAppCatalog(name, entry, config)))
855
816
  : visibleActions;
856
- // Connector-catalog tier: on hosted multi-tenant deployments (signalled by
857
- // AGENT_NATIVE_CONNECTOR_CATALOG=1) restrict external callers to the
858
- // template-declared allow-list unless the token was minted with
859
- // --full-catalog (catalog_scope: "full"). This prevents the ~105-tool full
860
- // catalog from bloating every external agent's context window and removes
861
- // db-exec / seed-* / extension / browser-session footguns.
862
- const connectorCatalogActive = process.env.AGENT_NATIVE_CONNECTOR_CATALOG === "1" &&
863
- Array.isArray(config.connectorCatalog) &&
817
+ // Connector-catalog tier: when a template declares a connector allow-list,
818
+ // serve exactly that curated surface (+ cross-app builtins + tool-search) to
819
+ // external callers unless they explicitly opted into the full catalog. This
820
+ // is active by default whenever a catalog is declared no env flag required —
821
+ // so the ~105-tool full catalog can never leak just because a deployment
822
+ // forgot to set one. It also keeps db-exec / seed-* / extension /
823
+ // browser-session footguns off the external surface.
824
+ const connectorCatalogActive = Array.isArray(config.connectorCatalog) &&
864
825
  config.connectorCatalog.length > 0 &&
865
- !explicitlyRequestsFullMcpCatalog(requestMeta);
826
+ !fullCatalogRequested;
866
827
  // When the connector catalog is active, filter directly from visibleActions
867
828
  // rather than advertisedActionsBeforeConnector. This ensures the connector
868
829
  // tier is an independent, template-declared surface that doesn't accidentally
@@ -871,6 +832,9 @@ export async function createMCPServerForRequest(config, identity, requestMeta) {
871
832
  const advertisedActions = connectorCatalogActive
872
833
  ? Object.fromEntries(Object.entries(visibleActions).filter(([name]) => isActionInConnectorCatalog(name, config)))
873
834
  : advertisedActionsBeforeConnector;
835
+ if (fullCatalogRequested) {
836
+ warnFullCatalogServed(Object.keys(advertisedActions).length);
837
+ }
874
838
  const supportsMcpApps = compactMcpAppCatalog ||
875
839
  Object.values(advertisedActions).some((entry) => Boolean(entry.mcpApp?.resource));
876
840
  const server = new Server(mcpServerInfo(config, requestMeta), {