@openrouter/mcp 0.0.1 → 1.1.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.
Files changed (88) hide show
  1. package/README.md +35 -4
  2. package/esm/cache.d.ts +7 -0
  3. package/esm/cache.d.ts.map +1 -0
  4. package/esm/cache.js +2 -0
  5. package/esm/cache.js.map +1 -0
  6. package/esm/create-mcp-tools.d.ts +4 -10
  7. package/esm/create-mcp-tools.d.ts.map +1 -1
  8. package/esm/create-mcp-tools.js +3 -72
  9. package/esm/create-mcp-tools.js.map +1 -1
  10. package/esm/index.d.ts +8 -12
  11. package/esm/index.d.ts.map +1 -1
  12. package/esm/index.js +1 -10
  13. package/esm/index.js.map +1 -1
  14. package/esm/schema.d.ts +7 -0
  15. package/esm/schema.d.ts.map +1 -0
  16. package/esm/schema.js +2 -0
  17. package/esm/schema.js.map +1 -0
  18. package/esm/types.d.ts +3 -101
  19. package/esm/types.d.ts.map +1 -1
  20. package/package.json +14 -13
  21. package/esm/auth/auth-resolver.d.ts +0 -14
  22. package/esm/auth/auth-resolver.d.ts.map +0 -1
  23. package/esm/auth/auth-resolver.js +0 -27
  24. package/esm/auth/auth-resolver.js.map +0 -1
  25. package/esm/auth/auth-types.d.ts +0 -25
  26. package/esm/auth/auth-types.d.ts.map +0 -1
  27. package/esm/auth/auth-types.js +0 -4
  28. package/esm/auth/auth-types.js.map +0 -1
  29. package/esm/build-tools.d.ts +0 -27
  30. package/esm/build-tools.d.ts.map +0 -1
  31. package/esm/build-tools.js +0 -77
  32. package/esm/build-tools.js.map +0 -1
  33. package/esm/cache/cache-store.d.ts +0 -24
  34. package/esm/cache/cache-store.d.ts.map +0 -1
  35. package/esm/cache/cache-store.js +0 -20
  36. package/esm/cache/cache-store.js.map +0 -1
  37. package/esm/cache/cache-types.d.ts +0 -54
  38. package/esm/cache/cache-types.d.ts.map +0 -1
  39. package/esm/cache/cache-types.js +0 -41
  40. package/esm/cache/cache-types.js.map +0 -1
  41. package/esm/cache/serialize.d.ts +0 -25
  42. package/esm/cache/serialize.d.ts.map +0 -1
  43. package/esm/cache/serialize.js +0 -85
  44. package/esm/cache/serialize.js.map +0 -1
  45. package/esm/elicitation.d.ts +0 -11
  46. package/esm/elicitation.d.ts.map +0 -1
  47. package/esm/elicitation.js +0 -51
  48. package/esm/elicitation.js.map +0 -1
  49. package/esm/errors.d.ts +0 -35
  50. package/esm/errors.d.ts.map +0 -1
  51. package/esm/errors.js +0 -39
  52. package/esm/errors.js.map +0 -1
  53. package/esm/handle.d.ts +0 -41
  54. package/esm/handle.d.ts.map +0 -1
  55. package/esm/handle.js +0 -221
  56. package/esm/handle.js.map +0 -1
  57. package/esm/mcp-connection.d.ts +0 -35
  58. package/esm/mcp-connection.d.ts.map +0 -1
  59. package/esm/mcp-connection.js +0 -147
  60. package/esm/mcp-connection.js.map +0 -1
  61. package/esm/rehydrate.d.ts +0 -41
  62. package/esm/rehydrate.d.ts.map +0 -1
  63. package/esm/rehydrate.js +0 -173
  64. package/esm/rehydrate.js.map +0 -1
  65. package/esm/resource-tools.d.ts +0 -17
  66. package/esm/resource-tools.d.ts.map +0 -1
  67. package/esm/resource-tools.js +0 -133
  68. package/esm/resource-tools.js.map +0 -1
  69. package/esm/result-mapper.d.ts +0 -19
  70. package/esm/result-mapper.d.ts.map +0 -1
  71. package/esm/result-mapper.js +0 -40
  72. package/esm/result-mapper.js.map +0 -1
  73. package/esm/schema/json-schema-guards.d.ts +0 -14
  74. package/esm/schema/json-schema-guards.d.ts.map +0 -1
  75. package/esm/schema/json-schema-guards.js +0 -19
  76. package/esm/schema/json-schema-guards.js.map +0 -1
  77. package/esm/schema/json-schema-to-zod.d.ts +0 -20
  78. package/esm/schema/json-schema-to-zod.d.ts.map +0 -1
  79. package/esm/schema/json-schema-to-zod.js +0 -72
  80. package/esm/schema/json-schema-to-zod.js.map +0 -1
  81. package/esm/tool-wrapper.d.ts +0 -26
  82. package/esm/tool-wrapper.d.ts.map +0 -1
  83. package/esm/tool-wrapper.js +0 -118
  84. package/esm/tool-wrapper.js.map +0 -1
  85. package/esm/transport-types.d.ts +0 -3
  86. package/esm/transport-types.d.ts.map +0 -1
  87. package/esm/transport-types.js +0 -2
  88. package/esm/transport-types.js.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @openrouter/mcp
2
2
 
3
+ > [!NOTE]
4
+ > This package is a migration-only compatibility facade. New code should import
5
+ > the canonical `@openrouter/agent/mcp` subpath. Existing `@openrouter/mcp` root
6
+ > and subpath imports remain functional and would only be removed in a future
7
+ > breaking release after migration notice.
8
+
3
9
  Expose the tools of a remote [Model Context Protocol](https://modelcontextprotocol.io) server
4
10
  (Streamable HTTP or SSE) as tools you can pass straight into
5
11
  [`@openrouter/agent`](https://www.npmjs.com/package/@openrouter/agent)'s `callModel`.
@@ -14,16 +20,41 @@ Expose the tools of a remote [Model Context Protocol](https://modelcontextprotoc
14
20
 
15
21
  ## Install
16
22
 
23
+ For new code, install the agent plus the optional MCP peer:
24
+
25
+ ```bash
26
+ pnpm add @openrouter/agent @modelcontextprotocol/client
27
+ ```
28
+
29
+ Existing applications can keep installing only the compatibility package; it retains `@modelcontextprotocol/client` as a dependency, so the prior transitive-install behavior is unchanged:
30
+
17
31
  ```bash
18
- pnpm add @openrouter/mcp @openrouter/agent
32
+ pnpm add @openrouter/mcp
19
33
  ```
20
34
 
35
+ The agent package is marked `sideEffects: false`, and MCP code is exposed only
36
+ through explicit `/mcp` exports. Root and `/tool-set` imports do not statically
37
+ load MCP modules; the MCP SDK is not installed transitively for base agent users.
38
+ The `/mcp` entry point also loads the optional SDK lazily: importing it is safe
39
+ without the peer, while the first connection attempt throws an actionable
40
+ `MCPMissingPeerDependencyError` when the SDK has not been installed.
41
+
42
+ ## Compatibility subpaths
43
+
44
+ | Existing facade | Canonical replacement |
45
+ | --- | --- |
46
+ | `@openrouter/mcp` | `@openrouter/agent/mcp` |
47
+ | `@openrouter/mcp/create-mcp-tools` | `@openrouter/agent/mcp/create-mcp-tools` |
48
+ | `@openrouter/mcp/types` | `@openrouter/agent/mcp/types` |
49
+ | `@openrouter/mcp/schema` | `@openrouter/agent/mcp/schema` |
50
+ | `@openrouter/mcp/cache` | `@openrouter/agent/mcp/cache` |
51
+
21
52
  ## Quick start
22
53
 
23
54
  ```ts
24
55
  import { OpenRouter } from '@openrouter/agent';
25
56
  import { callModel } from '@openrouter/agent/call-model';
26
- import { createMCPTools } from '@openrouter/mcp';
57
+ import { createMCPTools } from '@openrouter/agent/mcp';
27
58
 
28
59
  const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY });
29
60
 
@@ -63,7 +94,7 @@ automatically.
63
94
  Persist a snapshot and rebuild later without a `listTools()` round-trip:
64
95
 
65
96
  ```ts
66
- import { createMCPTools, rehydrateMCPTools } from '@openrouter/mcp';
97
+ import { createMCPTools, rehydrateMCPTools } from '@openrouter/agent/mcp';
67
98
 
68
99
  const mcp = await createMCPTools({ url, auth, cacheCredentials: true });
69
100
  const snapshot = await mcp.serialize(); // plain JSON — store anywhere
@@ -75,7 +106,7 @@ const mcp2 = await rehydrateMCPTools({ snapshot, auth });
75
106
  Or let a store manage it (rehydrate on hit, connect + write on miss):
76
107
 
77
108
  ```ts
78
- import { InMemoryMCPCacheStore } from '@openrouter/mcp';
109
+ import { InMemoryMCPCacheStore } from '@openrouter/agent/mcp';
79
110
 
80
111
  const store = new InMemoryMCPCacheStore(); // or your own Redis/DB-backed MCPCacheStore
81
112
  const mcp = await createMCPTools({
package/esm/cache.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @deprecated Import from `@openrouter/agent/mcp/cache` instead.
3
+ * This compatibility subpath remains available for migration.
4
+ */
5
+ export type { MCPCacheStore } from '@openrouter/agent/mcp/cache';
6
+ export { defaultCacheKey, InMemoryMCPCacheStore } from '@openrouter/agent/mcp/cache';
7
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
package/esm/cache.js ADDED
@@ -0,0 +1,2 @@
1
+ export { defaultCacheKey, InMemoryMCPCacheStore } from '@openrouter/agent/mcp/cache';
2
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}
@@ -1,13 +1,7 @@
1
- import type { SerializedMCPServer } from './cache/cache-types.js';
2
- import type { CreateMCPToolsOptions, MCPToolsHandle } from './types.js';
3
1
  /**
4
- * Connect to a remote MCP server, discover its tools, and return a handle whose
5
- * `.tools` can be passed straight into `callModel({ tools })`. Auth is supplied
6
- * once and reused for discovery and every subsequent tool call.
7
- *
8
- * When `cache` is provided, a valid non-stale snapshot is rehydrated instead of
9
- * re-listing; otherwise the fresh result is written back to the cache.
2
+ * @deprecated Import from `@openrouter/agent/mcp/create-mcp-tools` instead.
3
+ * This compatibility subpath remains available for migration.
10
4
  */
11
- export declare function createMCPTools(options: CreateMCPToolsOptions): Promise<MCPToolsHandle>;
12
- export type { SerializedMCPServer };
5
+ export type { SerializedMCPServer } from '@openrouter/agent/mcp/create-mcp-tools';
6
+ export { createMCPTools } from '@openrouter/agent/mcp/create-mcp-tools';
13
7
  //# sourceMappingURL=create-mcp-tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-mcp-tools.d.ts","sourceRoot":"","sources":["../src/create-mcp-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAKlE,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExE;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,cAAc,CAAC,CAY5F;AA8DD,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"create-mcp-tools.d.ts","sourceRoot":"","sources":["../src/create-mcp-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
@@ -1,75 +1,6 @@
1
- import { defaultCacheKey } from './cache/cache-store.js';
2
- import { isSerializedMCPServer } from './cache/cache-types.js';
3
- import { freshConnect, normalizeUrl } from './handle.js';
4
- import { rehydrateMCPTools } from './rehydrate.js';
5
1
  /**
6
- * Connect to a remote MCP server, discover its tools, and return a handle whose
7
- * `.tools` can be passed straight into `callModel({ tools })`. Auth is supplied
8
- * once and reused for discovery and every subsequent tool call.
9
- *
10
- * When `cache` is provided, a valid non-stale snapshot is rehydrated instead of
11
- * re-listing; otherwise the fresh result is written back to the cache.
2
+ * @deprecated Import from `@openrouter/agent/mcp/create-mcp-tools` instead.
3
+ * This compatibility subpath remains available for migration.
12
4
  */
13
- export async function createMCPTools(options) {
14
- const url = normalizeUrl(options.url);
15
- const cacheKey = options.cache?.key ?? defaultCacheKey(url.href);
16
- if (options.cache !== undefined) {
17
- const hit = await tryCacheHit(options, options.cache.store, cacheKey);
18
- if (hit !== undefined) {
19
- return hit;
20
- }
21
- }
22
- return freshConnect(options, url, cacheKey);
23
- }
24
- // Option keys forwarded verbatim from a cache-hit `createMCPTools` call into
25
- // `rehydrateMCPTools`, so a warm handle applies the same auth, filters, prefix,
26
- // and credential-caching behavior as a cold one.
27
- const FORWARDED_REHYDRATE_KEYS = [
28
- 'auth',
29
- 'fetch',
30
- 'clientInfo',
31
- 'onUnconvertibleSchema',
32
- 'onElicitation',
33
- 'signal',
34
- 'toolNamePrefix',
35
- 'includeTools',
36
- 'excludeTools',
37
- 'resources',
38
- 'emitProgress',
39
- 'autoRefreshOnListChanged',
40
- 'cacheCredentials',
41
- ];
42
- /** Copy the defined forwarded options from `createMCPTools` into a rehydrate base. */
43
- function forwardedRehydrateOptions(options) {
44
- const out = {};
45
- for (const key of FORWARDED_REHYDRATE_KEYS) {
46
- const value = options[key];
47
- if (value !== undefined) {
48
- Object.assign(out, {
49
- [key]: value,
50
- });
51
- }
52
- }
53
- return out;
54
- }
55
- async function tryCacheHit(options, store, cacheKey) {
56
- const snapshot = await store.get(cacheKey);
57
- if (snapshot === null || snapshot === undefined || !isSerializedMCPServer(snapshot)) {
58
- return undefined;
59
- }
60
- const maxAge = options.staleness?.maxAgeMs;
61
- if (maxAge !== undefined && Date.now() - snapshot.cachedAt > maxAge) {
62
- return undefined;
63
- }
64
- // Defer to rehydrate, which reconnects and falls back to a fresh connect on
65
- // expiry.
66
- return rehydrateMCPTools({
67
- snapshot,
68
- ...forwardedRehydrateOptions(options),
69
- cache: {
70
- store,
71
- key: cacheKey,
72
- },
73
- });
74
- }
5
+ export { createMCPTools } from '@openrouter/agent/mcp/create-mcp-tools';
75
6
  //# sourceMappingURL=create-mcp-tools.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-mcp-tools.js","sourceRoot":"","sources":["../src/create-mcp-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,OAA8B;IACjE,MAAM,GAAG,GAAG,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,EAAE,GAAG,IAAI,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAEjE,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;QAChC,MAAM,GAAG,GAAG,MAAM,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtE,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC9C,CAAC;AAED,6EAA6E;AAC7E,gFAAgF;AAChF,iDAAiD;AACjD,MAAM,wBAAwB,GAAG;IAC/B,MAAM;IACN,OAAO;IACP,YAAY;IACZ,uBAAuB;IACvB,eAAe;IACf,QAAQ;IACR,gBAAgB;IAChB,cAAc;IACd,cAAc;IACd,WAAW;IACX,cAAc;IACd,0BAA0B;IAC1B,kBAAkB;CAC0E,CAAC;AAE/F,sFAAsF;AACtF,SAAS,yBAAyB,CAChC,OAA8B;IAE9B,MAAM,GAAG,GAAsC,EAAE,CAAC;IAClD,KAAK,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC3C,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACjB,CAAC,GAAG,CAAC,EAAE,KAAK;aACb,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,KAAK,UAAU,WAAW,CACxB,OAA8B,EAC9B,KAAoB,EACpB,QAAgB;IAEhB,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpF,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC;IAC3C,IAAI,MAAM,KAAK,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,QAAQ,GAAG,MAAM,EAAE,CAAC;QACpE,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,4EAA4E;IAC5E,UAAU;IACV,OAAO,iBAAiB,CAAC;QACvB,QAAQ;QACR,GAAG,yBAAyB,CAAC,OAAO,CAAC;QACrC,KAAK,EAAE;YACL,KAAK;YACL,GAAG,EAAE,QAAQ;SACd;KACF,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"create-mcp-tools.js","sourceRoot":"","sources":["../src/create-mcp-tools.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC"}
package/esm/index.d.ts CHANGED
@@ -1,13 +1,9 @@
1
- export type { MCPAuth } from './auth/auth-types.js';
2
- export type { MCPCacheStore } from './cache/cache-store.js';
3
- export { defaultCacheKey, InMemoryMCPCacheStore } from './cache/cache-store.js';
4
- export type { SerializedMCPServer, SerializedMCPToolDef, SerializedTokenSet, } from './cache/cache-types.js';
5
- export { isSerializedMCPServer } from './cache/cache-types.js';
6
- export { createMCPTools } from './create-mcp-tools.js';
7
- export { MCPCacheError, MCPConnectionError, MCPError, MCPToolCallError, } from './errors.js';
8
- export type { RehydrateMCPToolsOptions } from './rehydrate.js';
9
- export { rehydrateMCPTools } from './rehydrate.js';
10
- export type { UnconvertibleSchemaMode } from './schema/json-schema-to-zod.js';
11
- export { convertMcpInputSchema } from './schema/json-schema-to-zod.js';
12
- export type { CreateMCPToolsOptions, ElicitationHandler, ElicitationResponse, MCPToolsHandle, MCPTransportKind, ResourcesOption, } from './types.js';
1
+ /**
2
+ * Compatibility facade for the canonical `@openrouter/agent/mcp` integration.
3
+ *
4
+ * @deprecated Import from `@openrouter/agent/mcp` instead. This facade remains
5
+ * available for migration and may be removed only in a future breaking release.
6
+ */
7
+ export type { CreateMCPToolsOptions, ElicitationHandler, ElicitationResponse, MCPAuth, MCPCacheStore, MCPOAuthClientProvider, MCPProtocolNegotiation, MCPProtocolRevision, MCPToolsHandle, MCPTransportKind, RehydrateMCPToolsOptions, ResourcesOption, SerializedMCPServer, SerializedMCPToolDef, SerializedTokenSet, UnconvertibleSchemaMode, } from '@openrouter/agent/mcp';
8
+ export { convertMcpInputSchema, createMCPTools, defaultCacheKey, InMemoryMCPCacheStore, isSerializedMCPServer, MCPCacheError, MCPCacheWriteError, MCPConnectionError, MCPError, MCPMissingPeerDependencyError, MCPStaleSnapshotError, MCPToolCallError, rehydrateMCPTools, } from '@openrouter/agent/mcp';
13
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,YAAY,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAChF,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,aAAa,EACb,sBAAsB,EACtB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,6BAA6B,EAC7B,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
package/esm/index.js CHANGED
@@ -1,11 +1,2 @@
1
- // Main factory + rehydration
2
- // Cache
3
- export { defaultCacheKey, InMemoryMCPCacheStore } from './cache/cache-store.js';
4
- export { isSerializedMCPServer } from './cache/cache-types.js';
5
- export { createMCPTools } from './create-mcp-tools.js';
6
- // Errors
7
- export { MCPCacheError, MCPConnectionError, MCPError, MCPToolCallError, } from './errors.js';
8
- export { rehydrateMCPTools } from './rehydrate.js';
9
- // Schema conversion (exported for testing/reuse)
10
- export { convertMcpInputSchema } from './schema/json-schema-to-zod.js';
1
+ export { convertMcpInputSchema, createMCPTools, defaultCacheKey, InMemoryMCPCacheStore, isSerializedMCPServer, MCPCacheError, MCPCacheWriteError, MCPConnectionError, MCPError, MCPMissingPeerDependencyError, MCPStaleSnapshotError, MCPToolCallError, rehydrateMCPTools, } from '@openrouter/agent/mcp';
11
2
  //# sourceMappingURL=index.js.map
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAK7B,QAAQ;AACR,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAMhF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,SAAS;AACT,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAEnD,iDAAiD;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,qBAAqB,EACrB,qBAAqB,EACrB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,6BAA6B,EAC7B,qBAAqB,EACrB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * @deprecated Import from `@openrouter/agent/mcp/schema` instead.
3
+ * This compatibility subpath remains available for migration.
4
+ */
5
+ export type { UnconvertibleSchemaMode } from '@openrouter/agent/mcp/schema';
6
+ export { convertMcpInputSchema } from '@openrouter/agent/mcp/schema';
7
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
package/esm/schema.js ADDED
@@ -0,0 +1,2 @@
1
+ export { convertMcpInputSchema } from '@openrouter/agent/mcp/schema';
2
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC"}
package/esm/types.d.ts CHANGED
@@ -1,104 +1,6 @@
1
- import type { Tool } from '@openrouter/agent/tool-types';
2
- import type { MCPAuth } from './auth/auth-types.js';
3
- import type { MCPCacheStore } from './cache/cache-store.js';
4
- import type { UnconvertibleSchemaMode } from './schema/json-schema-to-zod.js';
5
- import type { MCPTransportKind } from './transport-types.js';
6
- export type { MCPTransportKind };
7
1
  /**
8
- * Response to a server-initiated elicitation request. `accept` must carry
9
- * `content` matching the server's `requestedSchema`.
2
+ * @deprecated Import from `@openrouter/agent/mcp/types` instead.
3
+ * This compatibility subpath remains available for migration.
10
4
  */
11
- export type ElicitationResponse = {
12
- action: 'accept';
13
- content: Record<string, unknown>;
14
- } | {
15
- action: 'decline';
16
- } | {
17
- action: 'cancel';
18
- };
19
- /**
20
- * Handler for server-initiated `elicitation/create` requests during a tool
21
- * call. If omitted from options, requests are auto-declined so a tool call
22
- * needing input fails gracefully rather than hanging.
23
- */
24
- export type ElicitationHandler = (request: {
25
- message: string;
26
- requestedSchema: Record<string, unknown>;
27
- }) => Promise<ElicitationResponse> | ElicitationResponse;
28
- /** How MCP resources are exposed to the model. */
29
- export type ResourcesOption = boolean | {
30
- mode?: 'synthetic-tools';
31
- };
32
- export interface CreateMCPToolsOptions {
33
- /** Remote MCP server endpoint. */
34
- url: string | URL;
35
- /** Transport to use; defaults to `streamableHttp` with SSE fallback. */
36
- transport?: MCPTransportKind;
37
- /** Authentication, supplied once and reused for discovery + every call. */
38
- auth?: MCPAuth;
39
- /** Custom fetch implementation for all network requests. */
40
- fetch?: typeof fetch;
41
- /** Client identity sent during `initialize`. */
42
- clientInfo?: {
43
- name: string;
44
- version: string;
45
- };
46
- /** Prefix applied to every wrapped tool name (e.g. `"github_"`). */
47
- toolNamePrefix?: string;
48
- /**
49
- * Allow-list of MCP tool names to expose. Applies to discovered MCP tools
50
- * only; synthetic `list_resources`/`read_resource` tools are controlled
51
- * exclusively by `resources`.
52
- */
53
- includeTools?: readonly string[];
54
- /**
55
- * Deny-list of MCP tool names to skip. Applies to discovered MCP tools only;
56
- * synthetic `list_resources`/`read_resource` tools are controlled
57
- * exclusively by `resources`.
58
- */
59
- excludeTools?: readonly string[];
60
- /** Behavior when a tool's JSON Schema can't be fully represented in Zod. */
61
- onUnconvertibleSchema?: UnconvertibleSchemaMode;
62
- /** Cache store + key for automatic rehydrate-on-hit / write-on-miss. */
63
- cache?: {
64
- store: MCPCacheStore;
65
- key?: string;
66
- };
67
- /** Persist resolved tokens/session into the snapshot. Off by default. */
68
- cacheCredentials?: boolean;
69
- /** Re-list tools when a cached snapshot is older than this. */
70
- staleness?: {
71
- maxAgeMs?: number;
72
- };
73
- /** Expose resources as synthetic `list_resources`/`read_resource` tools. */
74
- resources?: ResourcesOption;
75
- /** Map MCP progress notifications to generator-tool events. Default true. */
76
- emitProgress?: boolean;
77
- /** Auto-refresh tools on `tools/list_changed`. Default true when connected. */
78
- autoRefreshOnListChanged?: boolean;
79
- /** Handler for server-initiated elicitation; auto-declines when omitted. */
80
- onElicitation?: ElicitationHandler;
81
- /** Abort signal threaded into every underlying `callTool`. */
82
- signal?: AbortSignal;
83
- }
84
- /**
85
- * Handle returned by {@link createMCPTools}/`rehydrateMCPTools`. Holds a live
86
- * connection (unless rehydrated offline) and the wrapped tools.
87
- */
88
- export interface MCPToolsHandle {
89
- /** Tools ready to pass into `callModel({ tools })`. */
90
- readonly tools: readonly Tool[];
91
- readonly serverInfo?: {
92
- name?: string;
93
- version?: string;
94
- };
95
- /** Snapshot for persistence; omits credentials unless `cacheCredentials`. */
96
- serialize(): Promise<import('./cache/cache-types.js').SerializedMCPServer>;
97
- /** Force a fresh `listTools()` and rebuild the tool set. */
98
- refresh(): Promise<readonly Tool[]>;
99
- /** Subscribe to auto-refreshes triggered by `tools/list_changed`. */
100
- onToolsChanged(listener: (tools: readonly Tool[]) => void): () => void;
101
- /** Close the transport and underlying client. */
102
- close(): Promise<void>;
103
- }
5
+ export type { CreateMCPToolsOptions, ElicitationHandler, ElicitationResponse, MCPProtocolNegotiation, MCPProtocolRevision, MCPToolsHandle, MCPTransportKind, ResourcesOption, } from '@openrouter/agent/mcp/types';
104
6
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,YAAY,EACV,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,eAAe,GAChB,MAAM,6BAA6B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,9 @@
1
1
  {
2
2
  "name": "@openrouter/mcp",
3
- "version": "0.0.1",
3
+ "version": "1.1.0",
4
+ "engines": {
5
+ "node": ">=20"
6
+ },
4
7
  "author": "OpenRouter",
5
8
  "description": "Expose remote MCP server tools (Streamable HTTP / SSE) as tools for @openrouter/agent's callModel, with serializable caching and pluggable auth.",
6
9
  "keywords": [
@@ -30,12 +33,12 @@
30
33
  "default": "./esm/types.js"
31
34
  },
32
35
  "./schema": {
33
- "types": "./esm/schema/json-schema-to-zod.d.ts",
34
- "default": "./esm/schema/json-schema-to-zod.js"
36
+ "types": "./esm/schema.d.ts",
37
+ "default": "./esm/schema.js"
35
38
  },
36
39
  "./cache": {
37
- "types": "./esm/cache/cache-store.d.ts",
38
- "default": "./esm/cache/cache-store.js"
40
+ "types": "./esm/cache.d.ts",
41
+ "default": "./esm/cache.js"
39
42
  },
40
43
  "./package.json": "./package.json"
41
44
  },
@@ -54,19 +57,17 @@
54
57
  "package.json",
55
58
  "README.md"
56
59
  ],
60
+ "dependencies": {
61
+ "@modelcontextprotocol/client": "^2.0.0",
62
+ "@openrouter/agent": "0.10.0"
63
+ },
57
64
  "scripts": {
58
65
  "lint": "biome check src tests",
59
66
  "lint:fix": "biome check --write src tests",
60
67
  "build": "tsc",
61
68
  "test": "vitest --run --project unit",
62
- "test:e2e": "vitest --run --project e2e",
63
69
  "test:watch": "vitest --watch --project unit",
64
- "typecheck": "tsc --noEmit",
70
+ "typecheck": "pnpm run build && tsc --noEmit -p tsconfig.typecheck.json",
65
71
  "compile": "tsc"
66
- },
67
- "dependencies": {
68
- "@modelcontextprotocol/sdk": "^1.29.0",
69
- "@openrouter/agent": "workspace:*",
70
- "zod": "^4.0.0"
71
72
  }
72
- }
73
+ }
@@ -1,14 +0,0 @@
1
- import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
2
- import type { MCPAuth } from './auth-types.js';
3
- /**
4
- * The transport-level pieces derived from an {@link MCPAuth}: static headers to
5
- * merge into `requestInit`, and/or an OAuth provider to hand to the transport.
6
- * Both flow into the same connected client, so discovery and tool calls share
7
- * one authenticated session.
8
- */
9
- export interface ResolvedAuth {
10
- headers: Record<string, string>;
11
- authProvider?: OAuthClientProvider;
12
- }
13
- export declare function resolveAuth(auth: MCPAuth | undefined): ResolvedAuth;
14
- //# sourceMappingURL=auth-resolver.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-resolver.d.ts","sourceRoot":"","sources":["../../src/auth/auth-resolver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,YAAY,CAyBnE"}
@@ -1,27 +0,0 @@
1
- export function resolveAuth(auth) {
2
- if (auth === undefined) {
3
- return {
4
- headers: {},
5
- };
6
- }
7
- switch (auth.kind) {
8
- case 'bearer':
9
- return {
10
- headers: {
11
- Authorization: `Bearer ${auth.token}`,
12
- },
13
- };
14
- case 'headers':
15
- return {
16
- headers: {
17
- ...auth.headers,
18
- },
19
- };
20
- case 'oauth':
21
- return {
22
- headers: {},
23
- authProvider: auth.provider,
24
- };
25
- }
26
- }
27
- //# sourceMappingURL=auth-resolver.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-resolver.js","sourceRoot":"","sources":["../../src/auth/auth-resolver.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,WAAW,CAAC,IAAyB;IACnD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO;YACL,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;IACD,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,QAAQ;YACX,OAAO;gBACL,OAAO,EAAE;oBACP,aAAa,EAAE,UAAU,IAAI,CAAC,KAAK,EAAE;iBACtC;aACF,CAAC;QACJ,KAAK,SAAS;YACZ,OAAO;gBACL,OAAO,EAAE;oBACP,GAAG,IAAI,CAAC,OAAO;iBAChB;aACF,CAAC;QACJ,KAAK,OAAO;YACV,OAAO;gBACL,OAAO,EAAE,EAAE;gBACX,YAAY,EAAE,IAAI,CAAC,QAAQ;aAC5B,CAAC;IACN,CAAC;AACH,CAAC"}
@@ -1,25 +0,0 @@
1
- import type { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
2
- /**
3
- * Authentication for a remote MCP server. Supplied once and reused by the
4
- * connected client for tool discovery and every subsequent tool call.
5
- *
6
- * - `bearer`: a static bearer token sent as `Authorization: Bearer <token>`.
7
- * - `headers`: arbitrary static headers (e.g. API keys, custom auth schemes).
8
- * - `oauth`: a user-supplied {@link OAuthClientProvider} that owns token
9
- * acquisition/refresh. Preferred over caching static tokens.
10
- */
11
- export type MCPAuth = {
12
- kind: 'bearer';
13
- token: string;
14
- } | {
15
- kind: 'headers';
16
- headers: Readonly<Record<string, string>>;
17
- } | {
18
- kind: 'oauth';
19
- provider: OAuthClientProvider;
20
- };
21
- export declare function isOAuthAuth(auth: MCPAuth | undefined): auth is {
22
- kind: 'oauth';
23
- provider: OAuthClientProvider;
24
- };
25
- //# sourceMappingURL=auth-types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-types.d.ts","sourceRoot":"","sources":["../../src/auth/auth-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAEpF;;;;;;;;GAQG;AACH,MAAM,MAAM,OAAO,GACf;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,GACD;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC3C,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;CAC/B,CAAC;AAEN,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,IAAI;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,mBAAmB,CAAC;CAC/B,CAEA"}
@@ -1,4 +0,0 @@
1
- export function isOAuthAuth(auth) {
2
- return auth?.kind === 'oauth';
3
- }
4
- //# sourceMappingURL=auth-types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"auth-types.js","sourceRoot":"","sources":["../../src/auth/auth-types.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,WAAW,CAAC,IAAyB;IAInD,OAAO,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC;AAChC,CAAC"}
@@ -1,27 +0,0 @@
1
- import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
2
- import type { Tool } from '@openrouter/agent/tool-types';
3
- import type { UnconvertibleSchemaMode } from './schema/json-schema-to-zod.js';
4
- import type { McpToolDef } from './tool-wrapper.js';
5
- import type { ResourcesOption } from './types.js';
6
- export interface BuildToolsOptions {
7
- client: Client;
8
- toolDefs: readonly McpToolDef[];
9
- namePrefix?: string;
10
- includeTools?: readonly string[];
11
- excludeTools?: readonly string[];
12
- schemaMode?: UnconvertibleSchemaMode;
13
- emitProgress?: boolean;
14
- signal?: AbortSignal;
15
- resources?: ResourcesOption;
16
- /** Whether the server advertised the resources capability. */
17
- serverHasResources: boolean;
18
- }
19
- /** Apply allow/deny filters to discovered MCP tool definitions. */
20
- export declare function filterToolDefs(defs: readonly McpToolDef[], includeTools?: readonly string[], excludeTools?: readonly string[]): McpToolDef[];
21
- /**
22
- * Build the full ordered tool list for a handle: filtered + wrapped MCP tools,
23
- * plus synthetic resource tools when enabled. Throws on a name collision so two
24
- * tools never silently shadow each other in `callModel`.
25
- */
26
- export declare function buildTools(options: BuildToolsOptions): Tool[];
27
- //# sourceMappingURL=build-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"build-tools.d.ts","sourceRoot":"","sources":["../src/build-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AAGzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,UAAU,CAAC,EAAE,uBAAuB,CAAC;IACrC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,8DAA8D;IAC9D,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AASD,mEAAmE;AACnE,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,UAAU,EAAE,EAC3B,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,EAChC,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,GAC/B,UAAU,EAAE,CASd;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI,EAAE,CAqC7D"}