@openrouter/mcp 1.0.0 → 1.1.1
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 +40 -159
- package/esm/cache.d.ts +7 -0
- package/esm/cache.d.ts.map +1 -0
- package/esm/cache.js +2 -0
- package/esm/cache.js.map +1 -0
- package/esm/create-mcp-tools.d.ts +4 -10
- package/esm/create-mcp-tools.d.ts.map +1 -1
- package/esm/create-mcp-tools.js +3 -93
- package/esm/create-mcp-tools.js.map +1 -1
- package/esm/index.d.ts +8 -12
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +1 -10
- package/esm/index.js.map +1 -1
- package/esm/schema.d.ts +7 -0
- package/esm/schema.d.ts.map +1 -0
- package/esm/schema.js +2 -0
- package/esm/schema.js.map +1 -0
- package/esm/types.d.ts +3 -150
- package/esm/types.d.ts.map +1 -1
- package/package.json +9 -12
- package/esm/auth/auth-resolver.d.ts +0 -14
- package/esm/auth/auth-resolver.d.ts.map +0 -1
- package/esm/auth/auth-resolver.js +0 -27
- package/esm/auth/auth-resolver.js.map +0 -1
- package/esm/auth/auth-types.d.ts +0 -33
- package/esm/auth/auth-types.d.ts.map +0 -1
- package/esm/auth/auth-types.js +0 -4
- package/esm/auth/auth-types.js.map +0 -1
- package/esm/build-tools.d.ts +0 -29
- package/esm/build-tools.d.ts.map +0 -1
- package/esm/build-tools.js +0 -80
- package/esm/build-tools.js.map +0 -1
- package/esm/cache/cache-store.d.ts +0 -24
- package/esm/cache/cache-store.d.ts.map +0 -1
- package/esm/cache/cache-store.js +0 -20
- package/esm/cache/cache-store.js.map +0 -1
- package/esm/cache/cache-types.d.ts +0 -71
- package/esm/cache/cache-types.d.ts.map +0 -1
- package/esm/cache/cache-types.js +0 -49
- package/esm/cache/cache-types.js.map +0 -1
- package/esm/cache/serialize.d.ts +0 -25
- package/esm/cache/serialize.d.ts.map +0 -1
- package/esm/cache/serialize.js +0 -96
- package/esm/cache/serialize.js.map +0 -1
- package/esm/close-quietly.d.ts +0 -24
- package/esm/close-quietly.d.ts.map +0 -1
- package/esm/close-quietly.js +0 -30
- package/esm/close-quietly.js.map +0 -1
- package/esm/elicitation.d.ts +0 -11
- package/esm/elicitation.d.ts.map +0 -1
- package/esm/elicitation.js +0 -51
- package/esm/elicitation.js.map +0 -1
- package/esm/errors.d.ts +0 -82
- package/esm/errors.d.ts.map +0 -1
- package/esm/errors.js +0 -80
- package/esm/errors.js.map +0 -1
- package/esm/handle.d.ts +0 -66
- package/esm/handle.d.ts.map +0 -1
- package/esm/handle.js +0 -323
- package/esm/handle.js.map +0 -1
- package/esm/mcp-connection.d.ts +0 -142
- package/esm/mcp-connection.d.ts.map +0 -1
- package/esm/mcp-connection.js +0 -477
- package/esm/mcp-connection.js.map +0 -1
- package/esm/rehydrate.d.ts +0 -76
- package/esm/rehydrate.d.ts.map +0 -1
- package/esm/rehydrate.js +0 -499
- package/esm/rehydrate.js.map +0 -1
- package/esm/resource-tools.d.ts +0 -17
- package/esm/resource-tools.d.ts.map +0 -1
- package/esm/resource-tools.js +0 -155
- package/esm/resource-tools.js.map +0 -1
- package/esm/result-mapper.d.ts +0 -19
- package/esm/result-mapper.d.ts.map +0 -1
- package/esm/result-mapper.js +0 -40
- package/esm/result-mapper.js.map +0 -1
- package/esm/schema/json-schema-guards.d.ts +0 -14
- package/esm/schema/json-schema-guards.d.ts.map +0 -1
- package/esm/schema/json-schema-guards.js +0 -19
- package/esm/schema/json-schema-guards.js.map +0 -1
- package/esm/schema/json-schema-to-zod.d.ts +0 -20
- package/esm/schema/json-schema-to-zod.d.ts.map +0 -1
- package/esm/schema/json-schema-to-zod.js +0 -72
- package/esm/schema/json-schema-to-zod.js.map +0 -1
- package/esm/tool-wrapper.d.ts +0 -41
- package/esm/tool-wrapper.d.ts.map +0 -1
- package/esm/tool-wrapper.js +0 -131
- package/esm/tool-wrapper.js.map +0 -1
- package/esm/transport-types.d.ts +0 -45
- package/esm/transport-types.d.ts.map +0 -1
- package/esm/transport-types.js +0 -2
- package/esm/transport-types.js.map +0 -1
- package/esm/version.d.ts +0 -3
- package/esm/version.d.ts.map +0 -1
- package/esm/version.js +0 -5
- package/esm/version.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/cache/serialize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,mBAAmB,EAAsB,MAAM,kBAAkB,CAAC;AAGhF,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,EAAE,SAAS,UAAU,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,YAAY,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,gBAAgB,EAAE,OAAO,CAAC;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAuED;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC,CA6CzF"}
|
package/esm/cache/serialize.js
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import { resolveAuth } from '../auth/auth-resolver.js';
|
|
2
|
-
import { isFiniteEpoch } from './cache-types.js';
|
|
3
|
-
const _expiresInStillRelative = true;
|
|
4
|
-
void _expiresInStillRelative;
|
|
5
|
-
/** Pull a serializable token set from an OAuth provider, if it has tokens. */
|
|
6
|
-
async function tokensFromProvider(provider) {
|
|
7
|
-
const tokens = await provider.tokens();
|
|
8
|
-
if (tokens === undefined) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
const expiresInMs = typeof tokens.expires_in === 'number' ? tokens.expires_in * 1000 : undefined;
|
|
12
|
-
return {
|
|
13
|
-
accessToken: tokens.access_token,
|
|
14
|
-
...(typeof tokens.token_type === 'string' && {
|
|
15
|
-
tokenType: tokens.token_type,
|
|
16
|
-
}),
|
|
17
|
-
...(typeof tokens.refresh_token === 'string' && {
|
|
18
|
-
refreshToken: tokens.refresh_token,
|
|
19
|
-
}),
|
|
20
|
-
...(typeof tokens.scope === 'string' && {
|
|
21
|
-
scope: tokens.scope,
|
|
22
|
-
}),
|
|
23
|
-
...(expiresInMs !== undefined && {
|
|
24
|
-
expiresAt: Date.now() + expiresInMs,
|
|
25
|
-
}),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
async function buildAuthBlock(auth) {
|
|
29
|
-
if (auth === undefined) {
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
if (auth.kind === 'oauth') {
|
|
33
|
-
const tokens = await tokensFromProvider(auth.provider);
|
|
34
|
-
return tokens !== undefined
|
|
35
|
-
? {
|
|
36
|
-
tokens,
|
|
37
|
-
}
|
|
38
|
-
: undefined;
|
|
39
|
-
}
|
|
40
|
-
const { headers } = resolveAuth(auth);
|
|
41
|
-
return Object.keys(headers).length > 0
|
|
42
|
-
? {
|
|
43
|
-
headers,
|
|
44
|
-
}
|
|
45
|
-
: undefined;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Build a serializable snapshot. Credentials (tokens/headers) are included only
|
|
49
|
-
* when `cacheCredentials` is true; otherwise the snapshot holds just the
|
|
50
|
-
* structural data needed to rebuild the tool set after a fresh auth. Session ids
|
|
51
|
-
* are never included — see the note in the `cacheCredentials` branch.
|
|
52
|
-
*/
|
|
53
|
-
export async function serializeServer(input) {
|
|
54
|
-
const tools = input.toolDefs.map((def) => ({
|
|
55
|
-
name: def.name,
|
|
56
|
-
...(def.description !== undefined && {
|
|
57
|
-
description: def.description,
|
|
58
|
-
}),
|
|
59
|
-
inputSchema: def.inputSchema,
|
|
60
|
-
...(def.outputSchema !== undefined && {
|
|
61
|
-
outputSchema: def.outputSchema,
|
|
62
|
-
}),
|
|
63
|
-
...(def.loopKey !== undefined && {
|
|
64
|
-
loopKey: def.loopKey,
|
|
65
|
-
}),
|
|
66
|
-
}));
|
|
67
|
-
const snapshot = {
|
|
68
|
-
version: 1,
|
|
69
|
-
url: input.url,
|
|
70
|
-
transport: input.transport,
|
|
71
|
-
...(input.serverInfo !== undefined && {
|
|
72
|
-
serverInfo: input.serverInfo,
|
|
73
|
-
}),
|
|
74
|
-
...(input.capabilities !== undefined && {
|
|
75
|
-
capabilities: input.capabilities,
|
|
76
|
-
}),
|
|
77
|
-
tools,
|
|
78
|
-
cachedAt: isFiniteEpoch(input.cachedAt) ? input.cachedAt : Date.now(),
|
|
79
|
-
};
|
|
80
|
-
if (input.cacheCredentials) {
|
|
81
|
-
const auth = await buildAuthBlock(input.auth);
|
|
82
|
-
if (auth !== undefined) {
|
|
83
|
-
snapshot.auth = auth;
|
|
84
|
-
}
|
|
85
|
-
// `sessionId` is deliberately NOT persisted. A Streamable HTTP
|
|
86
|
-
// `Mcp-Session-Id` is a bearer-equivalent handle to an authenticated server
|
|
87
|
-
// session, and nothing reads it back: the replay path stopped forwarding it
|
|
88
|
-
// once we found that a transport reporting a sessionId makes SDK v2 skip
|
|
89
|
-
// negotiation entirely, silently losing server capabilities. Writing it to an
|
|
90
|
-
// external store (Redis, a database, a file) would be attack surface for no
|
|
91
|
-
// functionality. That it was gated behind `cacheCredentials` at all reflects
|
|
92
|
-
// that it was always credential-grade.
|
|
93
|
-
}
|
|
94
|
-
return snapshot;
|
|
95
|
-
}
|
|
96
|
-
//# sourceMappingURL=serialize.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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AAC,YAAY,KAAK,SAAS,IAAI;YACtC,YAAY,EAAE,KAAK,CAAC,YAAY;SACjC,CAAC;QACF,KAAK;QACL,QAAQ,EAAE,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE;KACtE,CAAC;IAEF,IAAI,KAAK,CAAC,gBAAgB,EAAE,CAAC;QAC3B,MAAM,IAAI,GAAG,MAAM,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;QACvB,CAAC;QACD,+DAA+D;QAC/D,4EAA4E;QAC5E,4EAA4E;QAC5E,yEAAyE;QACzE,8EAA8E;QAC9E,4EAA4E;QAC5E,6EAA6E;QAC7E,uCAAuC;IACzC,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/esm/close-quietly.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Release something closeable on a path that is already failing, swallowing
|
|
3
|
-
* whatever `close()` does on the way out.
|
|
4
|
-
*
|
|
5
|
-
* The `try` matters as much as the `catch`: `close()` is not guaranteed to
|
|
6
|
-
* return a rejected promise on failure, and a *synchronous* throw never
|
|
7
|
-
* produces one — so `x.close().catch(() => {})` throws before `.catch()` is
|
|
8
|
-
* ever attached. On an unwinding path that is actively harmful in two ways: it
|
|
9
|
-
* replaces the real error (a useful "couldn't reach the server" becomes an
|
|
10
|
-
* opaque teardown failure), and it skips whatever recovery followed the close —
|
|
11
|
-
* a fallback that used to self-heal starts rejecting instead.
|
|
12
|
-
*
|
|
13
|
-
* Every teardown-on-failure site in this package goes through here, so the
|
|
14
|
-
* guarantee holds uniformly rather than depending on each caller remembering
|
|
15
|
-
* the distinction.
|
|
16
|
-
*
|
|
17
|
-
* Deliberately not exported from the package entrypoint: callers close through
|
|
18
|
-
* `MCPToolsHandle.close()` / `MCPConnection.close()`, which report failures
|
|
19
|
-
* rather than swallowing them. This is only for teardown during error unwinding.
|
|
20
|
-
*/
|
|
21
|
-
export declare function closeQuietly(closeable: {
|
|
22
|
-
close(): Promise<void>;
|
|
23
|
-
}): Promise<void>;
|
|
24
|
-
//# sourceMappingURL=close-quietly.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"close-quietly.d.ts","sourceRoot":"","sources":["../src/close-quietly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,YAAY,CAAC,SAAS,EAAE;IAAE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvF"}
|
package/esm/close-quietly.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Release something closeable on a path that is already failing, swallowing
|
|
3
|
-
* whatever `close()` does on the way out.
|
|
4
|
-
*
|
|
5
|
-
* The `try` matters as much as the `catch`: `close()` is not guaranteed to
|
|
6
|
-
* return a rejected promise on failure, and a *synchronous* throw never
|
|
7
|
-
* produces one — so `x.close().catch(() => {})` throws before `.catch()` is
|
|
8
|
-
* ever attached. On an unwinding path that is actively harmful in two ways: it
|
|
9
|
-
* replaces the real error (a useful "couldn't reach the server" becomes an
|
|
10
|
-
* opaque teardown failure), and it skips whatever recovery followed the close —
|
|
11
|
-
* a fallback that used to self-heal starts rejecting instead.
|
|
12
|
-
*
|
|
13
|
-
* Every teardown-on-failure site in this package goes through here, so the
|
|
14
|
-
* guarantee holds uniformly rather than depending on each caller remembering
|
|
15
|
-
* the distinction.
|
|
16
|
-
*
|
|
17
|
-
* Deliberately not exported from the package entrypoint: callers close through
|
|
18
|
-
* `MCPToolsHandle.close()` / `MCPConnection.close()`, which report failures
|
|
19
|
-
* rather than swallowing them. This is only for teardown during error unwinding.
|
|
20
|
-
*/
|
|
21
|
-
export async function closeQuietly(closeable) {
|
|
22
|
-
try {
|
|
23
|
-
await closeable.close();
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
// Nothing actionable: we are already unwinding a failure, and the close
|
|
27
|
-
// outcome is never the error the caller needs to see.
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=close-quietly.js.map
|
package/esm/close-quietly.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"close-quietly.js","sourceRoot":"","sources":["../src/close-quietly.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,SAAqC;IACtE,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;IAAC,MAAM,CAAC;QACP,wEAAwE;QACxE,sDAAsD;IACxD,CAAC;AACH,CAAC"}
|
package/esm/elicitation.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ElicitRequest, ElicitResult } from '@modelcontextprotocol/client';
|
|
2
|
-
import type { ElicitationHandler } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Build the `elicitation/create` request handler registered on the MCP client.
|
|
5
|
-
* Delegates to the caller's {@link ElicitationHandler}; when none is supplied,
|
|
6
|
-
* auto-declines so a tool call awaiting input fails gracefully instead of
|
|
7
|
-
* hanging. The MCP spec forbids eliciting sensitive/PII data — that contract is
|
|
8
|
-
* the server's responsibility; callers should treat requested fields as such.
|
|
9
|
-
*/
|
|
10
|
-
export declare function makeElicitationRequestHandler(handler: ElicitationHandler | undefined): (request: ElicitRequest) => Promise<ElicitResult>;
|
|
11
|
-
//# sourceMappingURL=elicitation.d.ts.map
|
package/esm/elicitation.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elicitation.d.ts","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEhF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AA4BrD;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,OAAO,EAAE,kBAAkB,GAAG,SAAS,GACtC,CAAC,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,YAAY,CAAC,CA2BnD"}
|
package/esm/elicitation.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { isJsonSchemaObject } from './schema/json-schema-guards.js';
|
|
2
|
-
/** A form-mode elicitation request carries a `requestedSchema`. */
|
|
3
|
-
function hasRequestedSchema(params) {
|
|
4
|
-
return 'requestedSchema' in params;
|
|
5
|
-
}
|
|
6
|
-
/** Narrow handler-returned content to the primitive record the spec allows. */
|
|
7
|
-
function toElicitContent(content) {
|
|
8
|
-
const out = {};
|
|
9
|
-
for (const [key, value] of Object.entries(content)) {
|
|
10
|
-
if (typeof value === 'string' ||
|
|
11
|
-
typeof value === 'number' ||
|
|
12
|
-
typeof value === 'boolean' ||
|
|
13
|
-
(Array.isArray(value) && value.every((v) => typeof v === 'string'))) {
|
|
14
|
-
out[key] = value;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return out;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Build the `elicitation/create` request handler registered on the MCP client.
|
|
21
|
-
* Delegates to the caller's {@link ElicitationHandler}; when none is supplied,
|
|
22
|
-
* auto-declines so a tool call awaiting input fails gracefully instead of
|
|
23
|
-
* hanging. The MCP spec forbids eliciting sensitive/PII data — that contract is
|
|
24
|
-
* the server's responsibility; callers should treat requested fields as such.
|
|
25
|
-
*/
|
|
26
|
-
export function makeElicitationRequestHandler(handler) {
|
|
27
|
-
return async (request) => {
|
|
28
|
-
if (handler === undefined) {
|
|
29
|
-
return {
|
|
30
|
-
action: 'decline',
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
const { params } = request;
|
|
34
|
-
const requestedSchema = hasRequestedSchema(params) ? params.requestedSchema : undefined;
|
|
35
|
-
const schema = isJsonSchemaObject(requestedSchema) ? requestedSchema : {};
|
|
36
|
-
const response = await handler({
|
|
37
|
-
message: params.message,
|
|
38
|
-
requestedSchema: schema,
|
|
39
|
-
});
|
|
40
|
-
if (response.action === 'accept') {
|
|
41
|
-
return {
|
|
42
|
-
action: 'accept',
|
|
43
|
-
content: toElicitContent(response.content),
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
return {
|
|
47
|
-
action: response.action,
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=elicitation.js.map
|
package/esm/elicitation.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elicitation.js","sourceRoot":"","sources":["../src/elicitation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAMpE,mEAAmE;AACnE,SAAS,kBAAkB,CAAC,MAA+B;IAGzD,OAAO,iBAAiB,IAAI,MAAM,CAAC;AACrC,CAAC;AAED,+EAA+E;AAC/E,SAAS,eAAe,CAAC,OAAgC;IACvD,MAAM,GAAG,GAAuC,EAAE,CAAC;IACnD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACnD,IACE,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,QAAQ;YACzB,OAAO,KAAK,KAAK,SAAS;YAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,EAChF,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACnB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAC3C,OAAuC;IAEvC,OAAO,KAAK,EAAE,OAAsB,EAAyB,EAAE;QAC7D,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO;gBACL,MAAM,EAAE,SAAS;aAClB,CAAC;QACJ,CAAC;QAED,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;QAC3B,MAAM,eAAe,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAAC;QACxF,MAAM,MAAM,GAAG,kBAAkB,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;QAE1E,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC;YAC7B,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,eAAe,EAAE,MAAM;SACxB,CAAC,CAAC;QAEH,IAAI,QAAQ,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YACjC,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC;aAC3C,CAAC;QACJ,CAAC;QACD,OAAO;YACL,MAAM,EAAE,QAAQ,CAAC,MAAM;SACxB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
package/esm/errors.d.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base error for all @openrouter/mcp failures.
|
|
3
|
-
*/
|
|
4
|
-
export declare class MCPError extends Error {
|
|
5
|
-
constructor(message: string, options?: {
|
|
6
|
-
cause?: unknown;
|
|
7
|
-
});
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Raised when an MCP tool call returns `isError: true` or when the result
|
|
11
|
-
* cannot be mapped to a usable model output.
|
|
12
|
-
*/
|
|
13
|
-
export declare class MCPToolCallError extends MCPError {
|
|
14
|
-
readonly toolName: string;
|
|
15
|
-
constructor(toolName: string, message: string, options?: {
|
|
16
|
-
cause?: unknown;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Raised when a cached snapshot cannot be validated or rehydrated.
|
|
21
|
-
*/
|
|
22
|
-
export declare class MCPCacheError extends MCPError {
|
|
23
|
-
constructor(message: string, options?: {
|
|
24
|
-
cause?: unknown;
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Raised when the tool list was read successfully but writing the snapshot back
|
|
29
|
-
* to the caller's `MCPCacheStore` failed.
|
|
30
|
-
*
|
|
31
|
-
* Distinct from the read failing, because the consequences differ completely: the
|
|
32
|
-
* connection is live and its tools are current, so the only thing lost is a cache
|
|
33
|
-
* entry. Callers who treat a store outage as fatal can catch this; callers who
|
|
34
|
-
* would rather keep working with a warm handle can ignore it.
|
|
35
|
-
*
|
|
36
|
-
* Subclasses {@link MCPCacheError}, so existing catch sites keep working.
|
|
37
|
-
*/
|
|
38
|
-
export declare class MCPCacheWriteError extends MCPCacheError {
|
|
39
|
-
constructor(message: string, options?: {
|
|
40
|
-
cause?: unknown;
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Raised when a snapshot is older than `staleness.maxAgeMs` and the re-list that
|
|
45
|
-
* would have refreshed it failed — so the only tools available are ones the
|
|
46
|
-
* caller declared too old to use.
|
|
47
|
-
*
|
|
48
|
-
* Subclasses {@link MCPCacheError}, so existing `catch (e instanceof
|
|
49
|
-
* MCPCacheError)` sites keep working. Catch this specifically to fall back to
|
|
50
|
-
* stale-but-usable tools instead of failing.
|
|
51
|
-
*/
|
|
52
|
-
export declare class MCPStaleSnapshotError extends MCPCacheError {
|
|
53
|
-
constructor(message: string, options?: {
|
|
54
|
-
cause?: unknown;
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Raised when connecting to the MCP server fails across all attempted transports.
|
|
59
|
-
*/
|
|
60
|
-
export declare class MCPConnectionError extends MCPError {
|
|
61
|
-
/**
|
|
62
|
-
* Every failure behind this one, in attempt order.
|
|
63
|
-
*
|
|
64
|
-
* `cause` holds only the last attempt, which loses information: an
|
|
65
|
-
* `UnauthorizedError` from the Streamable HTTP attempt matters even when the
|
|
66
|
-
* SSE fallback then failed for an unrelated reason (a URL that simply isn't an
|
|
67
|
-
* SSE endpoint answering 404). Named `errors` to match `AggregateError`, so it
|
|
68
|
-
* reads the way callers expect rather than as a bespoke field.
|
|
69
|
-
*
|
|
70
|
-
* Always populated: a single-attempt failure contributes its one underlying
|
|
71
|
-
* error, so `errors[errors.length - 1]` and `cause` agree and a caller can
|
|
72
|
-
* iterate `errors` alone without special-casing the single-attempt shape —
|
|
73
|
-
* which matters most on the auth short-circuit, where exactly one attempt was
|
|
74
|
-
* made and its rejection is the thing worth finding.
|
|
75
|
-
*/
|
|
76
|
-
readonly errors: readonly unknown[];
|
|
77
|
-
constructor(message: string, options?: {
|
|
78
|
-
cause?: unknown;
|
|
79
|
-
errors?: readonly unknown[];
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/esm/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;gBAE/B,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAKJ;AAED;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAGxB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAMJ;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;gBAEvC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAKJ;AAED;;;;;;;;;;GAUG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;gBAEjD,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAKJ;AAED;;;;;;;;GAQG;AACH,qBAAa,qBAAsB,SAAQ,aAAa;gBAEpD,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB;CAKJ;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,QAAQ;IAC9C;;;;;;;;;;;;;;OAcG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC;gBAGlC,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QACR,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;KAC7B;CAcJ"}
|
package/esm/errors.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base error for all @openrouter/mcp failures.
|
|
3
|
-
*/
|
|
4
|
-
export class MCPError extends Error {
|
|
5
|
-
constructor(message, options) {
|
|
6
|
-
super(message, options);
|
|
7
|
-
this.name = 'MCPError';
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Raised when an MCP tool call returns `isError: true` or when the result
|
|
12
|
-
* cannot be mapped to a usable model output.
|
|
13
|
-
*/
|
|
14
|
-
export class MCPToolCallError extends MCPError {
|
|
15
|
-
constructor(toolName, message, options) {
|
|
16
|
-
super(message, options);
|
|
17
|
-
this.name = 'MCPToolCallError';
|
|
18
|
-
this.toolName = toolName;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Raised when a cached snapshot cannot be validated or rehydrated.
|
|
23
|
-
*/
|
|
24
|
-
export class MCPCacheError extends MCPError {
|
|
25
|
-
constructor(message, options) {
|
|
26
|
-
super(message, options);
|
|
27
|
-
this.name = 'MCPCacheError';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Raised when the tool list was read successfully but writing the snapshot back
|
|
32
|
-
* to the caller's `MCPCacheStore` failed.
|
|
33
|
-
*
|
|
34
|
-
* Distinct from the read failing, because the consequences differ completely: the
|
|
35
|
-
* connection is live and its tools are current, so the only thing lost is a cache
|
|
36
|
-
* entry. Callers who treat a store outage as fatal can catch this; callers who
|
|
37
|
-
* would rather keep working with a warm handle can ignore it.
|
|
38
|
-
*
|
|
39
|
-
* Subclasses {@link MCPCacheError}, so existing catch sites keep working.
|
|
40
|
-
*/
|
|
41
|
-
export class MCPCacheWriteError extends MCPCacheError {
|
|
42
|
-
constructor(message, options) {
|
|
43
|
-
super(message, options);
|
|
44
|
-
this.name = 'MCPCacheWriteError';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Raised when a snapshot is older than `staleness.maxAgeMs` and the re-list that
|
|
49
|
-
* would have refreshed it failed — so the only tools available are ones the
|
|
50
|
-
* caller declared too old to use.
|
|
51
|
-
*
|
|
52
|
-
* Subclasses {@link MCPCacheError}, so existing `catch (e instanceof
|
|
53
|
-
* MCPCacheError)` sites keep working. Catch this specifically to fall back to
|
|
54
|
-
* stale-but-usable tools instead of failing.
|
|
55
|
-
*/
|
|
56
|
-
export class MCPStaleSnapshotError extends MCPCacheError {
|
|
57
|
-
constructor(message, options) {
|
|
58
|
-
super(message, options);
|
|
59
|
-
this.name = 'MCPStaleSnapshotError';
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Raised when connecting to the MCP server fails across all attempted transports.
|
|
64
|
-
*/
|
|
65
|
-
export class MCPConnectionError extends MCPError {
|
|
66
|
-
constructor(message, options) {
|
|
67
|
-
super(message, options);
|
|
68
|
-
this.name = 'MCPConnectionError';
|
|
69
|
-
// Default a single-attempt failure to its own cause, so `errors` is a
|
|
70
|
-
// uniform "every attempt" list rather than empty-unless-multi.
|
|
71
|
-
this.errors =
|
|
72
|
-
options?.errors ??
|
|
73
|
-
(options?.cause !== undefined
|
|
74
|
-
? [
|
|
75
|
-
options.cause,
|
|
76
|
-
]
|
|
77
|
-
: []);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
//# sourceMappingURL=errors.js.map
|
package/esm/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACjC,YACE,OAAe,EACf,OAEC;QAED,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;IAG5C,YACE,QAAgB,EAChB,OAAe,EACf,OAEC;QAED,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;QAC/B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACzC,YACE,OAAe,EACf,OAEC;QAED,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED;;;;;;;;;;GAUG;AACH,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACnD,YACE,OAAe,EACf,OAEC;QAED,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACnC,CAAC;CACF;AAED;;;;;;;;GAQG;AACH,MAAM,OAAO,qBAAsB,SAAQ,aAAa;IACtD,YACE,OAAe,EACf,OAEC;QAED,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,QAAQ;IAkB9C,YACE,OAAe,EACf,OAGC;QAED,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,sEAAsE;QACtE,+DAA+D;QAC/D,IAAI,CAAC,MAAM;YACT,OAAO,EAAE,MAAM;gBACf,CAAC,OAAO,EAAE,KAAK,KAAK,SAAS;oBAC3B,CAAC,CAAC;wBACE,OAAO,CAAC,KAAK;qBACd;oBACH,CAAC,CAAC,EAAE,CAAC,CAAC;IACZ,CAAC;CACF"}
|
package/esm/handle.d.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { MCPConnection } from './mcp-connection.js';
|
|
2
|
-
import type { McpToolDef } from './tool-wrapper.js';
|
|
3
|
-
import type { MCPTransportKind } from './transport-types.js';
|
|
4
|
-
import type { CreateMCPToolsOptions, MCPToolsHandle } from './types.js';
|
|
5
|
-
export declare function normalizeUrl(url: string | URL): URL;
|
|
6
|
-
/**
|
|
7
|
-
* Read the discovered tools off the live connection into our internal shape.
|
|
8
|
-
*
|
|
9
|
-
* `tools/list` is paginated: each response may carry a `nextCursor` that must be
|
|
10
|
-
* passed back as `{ cursor }` to fetch the next page. We accumulate every page so
|
|
11
|
-
* servers that paginate their tool list aren't silently truncated.
|
|
12
|
-
*
|
|
13
|
-
* Always `cacheMode: 'refresh'`. SDK v2 keeps a per-client response cache
|
|
14
|
-
* honouring the server's `ttlMs` on `tools/list` (up to 24h), so the default
|
|
15
|
-
* `'use'` would serve a still-fresh cached list without a round trip. That is
|
|
16
|
-
* fine for an opportunistic read but wrong for every caller here: `refresh()`
|
|
17
|
-
* documents a forced re-read, `freshConnect` is establishing the tool set for the
|
|
18
|
-
* first time, and the stale-replay path exists precisely because the age of the
|
|
19
|
-
* cached list is no longer acceptable. `'refresh'` fetches and re-stores, so the
|
|
20
|
-
* cache stays warm for the SDK's own readers.
|
|
21
|
-
*
|
|
22
|
-
* `'refresh'` rather than `'bypass'` deliberately — bypass would skip the write
|
|
23
|
-
* too, leaving a stale entry behind for anything that later reads with `'use'`.
|
|
24
|
-
*/
|
|
25
|
-
export declare function listToolDefs(connection: MCPConnection, signal: AbortSignal | undefined): Promise<McpToolDef[]>;
|
|
26
|
-
interface HandleContext {
|
|
27
|
-
url: URL;
|
|
28
|
-
transport: MCPTransportKind;
|
|
29
|
-
cacheKey: string;
|
|
30
|
-
}
|
|
31
|
-
export interface MakeHandleArgs {
|
|
32
|
-
connection: MCPConnection;
|
|
33
|
-
options: CreateMCPToolsOptions;
|
|
34
|
-
context: HandleContext;
|
|
35
|
-
initialToolDefs: McpToolDef[];
|
|
36
|
-
/**
|
|
37
|
-
* `cachedAt` to carry forward when `initialToolDefs` came from a snapshot
|
|
38
|
-
* rather than a live `listTools()`. Omit on a cold connect so the write
|
|
39
|
-
* stamps now.
|
|
40
|
-
*
|
|
41
|
-
* Without this a replay would restamp `cachedAt` on the write-back below,
|
|
42
|
-
* resetting the staleness clock on a tool set that was never re-listed —
|
|
43
|
-
* so `staleness.maxAgeMs` could never fire on a repeatedly-rehydrated
|
|
44
|
-
* snapshot. Age tracks when the tools were last actually discovered, not
|
|
45
|
-
* when they were last replayed. `refresh()` clears it, because that path
|
|
46
|
-
* does re-list.
|
|
47
|
-
*/
|
|
48
|
-
replayedCachedAt?: number;
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Connect, discover tools via `listTools()`, and build a handle WITHOUT
|
|
52
|
-
* consulting the cache for a hit. The cache (when present on `options`) is still
|
|
53
|
-
* written through `makeHandle`, so refreshes persist. This is the cold cache-miss
|
|
54
|
-
* path, and is also called directly by `rehydrateMCPTools`'s fallback: routing
|
|
55
|
-
* the fallback here instead of back through `createMCPTools` is what prevents the
|
|
56
|
-
* cache-fallback loop — re-reading the same snapshot would re-enter rehydrate and
|
|
57
|
-
* recurse without bound.
|
|
58
|
-
*/
|
|
59
|
-
export declare function freshConnect(options: CreateMCPToolsOptions, url: URL, cacheKey: string): Promise<MCPToolsHandle>;
|
|
60
|
-
/**
|
|
61
|
-
* Construct an {@link MCPToolsHandle} around a live connection, wiring refresh,
|
|
62
|
-
* serialize, list_changed listeners, and cache writes.
|
|
63
|
-
*/
|
|
64
|
-
export declare function makeHandle(args: MakeHandleArgs): Promise<MCPToolsHandle>;
|
|
65
|
-
export {};
|
|
66
|
-
//# sourceMappingURL=handle.d.ts.map
|
package/esm/handle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handle.d.ts","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAExE,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,GAAG,GAAG,CAEnD;AAiCD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,aAAa,EACzB,MAAM,EAAE,WAAW,GAAG,SAAS,GAC9B,OAAO,CAAC,UAAU,EAAE,CAAC,CA0CvB;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