@effect-uai/mcp 0.18.0 → 0.19.0-dev-20261109183959
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/dist/Client.d.mts +2 -2
- package/dist/Toolkit.d.mts +9 -5
- package/dist/Toolkit.d.mts.map +1 -1
- package/dist/Toolkit.mjs +42 -24
- package/dist/Toolkit.mjs.map +1 -1
- package/dist/auth-CRIPfiPB.d.mts +47 -0
- package/dist/auth-CRIPfiPB.d.mts.map +1 -0
- package/dist/internal/auth.d.mts +1 -1
- package/dist/internal/httpTransport.d.mts +2 -2
- package/dist/internal/protocol.d.mts +1 -1
- package/dist/internal/protocols/2025-06-18.d.mts +1 -1
- package/dist/internal/protocols/2026-07-28.d.mts +1 -1
- package/dist/internal/rpc.d.mts +1 -1
- package/dist/internal/schema.d.mts +2 -2
- package/dist/internal/schema.mjs +39 -5
- package/dist/internal/schema.mjs.map +1 -1
- package/dist/internal/stdioTransport.d.mts +1 -1
- package/dist/{protocol-kjC3iAMb.d.mts → protocol-C3L9kaRW.d.mts} +3 -3
- package/dist/{protocol-kjC3iAMb.d.mts.map → protocol-C3L9kaRW.d.mts.map} +1 -1
- package/dist/{rpc-Bq95Lio9.d.mts → rpc-Bs2BCLha.d.mts} +2 -2
- package/dist/{rpc-Bq95Lio9.d.mts.map → rpc-Bs2BCLha.d.mts.map} +1 -1
- package/dist/{schema-D2oUNuo5.d.mts → schema-tDws3q4j.d.mts} +158 -11
- package/dist/schema-tDws3q4j.d.mts.map +1 -0
- package/package.json +6 -6
- package/src/Toolkit.test.ts +83 -0
- package/src/Toolkit.ts +65 -34
- package/src/internal/schema.ts +44 -5
- package/dist/auth-ZDvsxpCo.d.mts +0 -126
- package/dist/auth-ZDvsxpCo.d.mts.map +0 -1
- package/dist/schema-D2oUNuo5.d.mts.map +0 -1
package/dist/Client.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as McpError } from "./McpError-DWg9BlW5.mjs";
|
|
2
|
-
import { n as TokenSource, t as Auth } from "./auth-
|
|
3
|
-
import {
|
|
2
|
+
import { n as TokenSource, t as Auth } from "./auth-CRIPfiPB.mjs";
|
|
3
|
+
import { A as ServerInfo, D as ProtocolVersion, M as ToolInfo, s as CallToolResult } from "./schema-tDws3q4j.mjs";
|
|
4
4
|
import { Context, Effect, Layer, Scope } from "effect";
|
|
5
5
|
import { HttpClient } from "effect/http";
|
|
6
6
|
import { ChildProcessSpawner } from "effect/process";
|
package/dist/Toolkit.d.mts
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
import { i as McpError } from "./McpError-DWg9BlW5.mjs";
|
|
2
2
|
import { McpClient } from "./Client.mjs";
|
|
3
|
-
import { Effect } from "effect";
|
|
3
|
+
import { Effect, Schema } from "effect";
|
|
4
4
|
import * as CoreToolkit from "@effect-uai/core/Toolkit";
|
|
5
5
|
declare namespace Toolkit_d_exports {
|
|
6
|
-
export { McpToolkitOptions, mcpToolkit };
|
|
6
|
+
export { McpToolFailed, McpToolkitOptions, mcpToolkit };
|
|
7
7
|
}
|
|
8
8
|
type McpToolkitOptions = {
|
|
9
9
|
/** Namespace every tool as `<prefix>__<name>`; recommended when composing servers. */
|
|
10
10
|
readonly prefix?: string;
|
|
11
11
|
};
|
|
12
|
+
declare const McpToolFailed_base: Schema.Class<McpToolFailed, Schema.TaggedStruct<"McpToolFailed", {
|
|
13
|
+
readonly message: Schema.String;
|
|
14
|
+
}>, import("effect/Cause").YieldableError>;
|
|
15
|
+
/** The server reported an error (`isError`); the model sees its content as `message`. */
|
|
16
|
+
declare class McpToolFailed extends McpToolFailed_base {}
|
|
12
17
|
/**
|
|
13
18
|
* Build a `Toolkit` from the server's advertised tools. The list is snapshotted
|
|
14
|
-
* here; a tool that later vanishes surfaces
|
|
15
|
-
* `unknown_tool` path.
|
|
19
|
+
* here; a tool that later vanishes surfaces as `Toolkit.run`'s `UnknownTool`.
|
|
16
20
|
*/
|
|
17
21
|
declare const mcpToolkit: (client: McpClient, options?: McpToolkitOptions) => Effect.Effect<CoreToolkit.Toolkit, McpError>;
|
|
18
22
|
//#endregion
|
|
19
|
-
export { McpToolkitOptions, mcpToolkit, Toolkit_d_exports as t };
|
|
23
|
+
export { McpToolFailed, McpToolkitOptions, mcpToolkit, Toolkit_d_exports as t };
|
|
20
24
|
//# sourceMappingURL=Toolkit.d.mts.map
|
package/dist/Toolkit.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolkit.d.mts","names":[],"sources":["../src/Toolkit.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Toolkit.d.mts","names":[],"sources":["../src/Toolkit.ts"],"mappings":";;;;;;;KAsBY;;WAED;;;;;;cAIE,sBAAsB;;;;;cAiGtB,aAAU,QACb,WAAS,UACP,sBACT,OAAO,OAAO,YAAY,SAAS"}
|
package/dist/Toolkit.mjs
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
|
|
2
2
|
import { McpProtocolError } from "./McpError.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { Effect, Option } from "effect";
|
|
3
|
+
import { isKnownContent } from "./internal/schema.mjs";
|
|
4
|
+
import { Effect, Match, Option, Schema } from "effect";
|
|
5
|
+
import * as Content from "@effect-uai/core/Content";
|
|
6
|
+
import { fileBase64, fileUrl } from "@effect-uai/core/File";
|
|
7
|
+
import { imageBase64 } from "@effect-uai/core/Image";
|
|
5
8
|
import * as Tool from "@effect-uai/core/Tool";
|
|
6
9
|
import * as CoreToolkit from "@effect-uai/core/Toolkit";
|
|
10
|
+
import * as ToolOutput from "@effect-uai/core/ToolOutput";
|
|
7
11
|
//#region src/Toolkit.ts
|
|
8
12
|
/**
|
|
9
|
-
* Turn a connected MCP server into a core `Toolkit`, one
|
|
13
|
+
* Turn a connected MCP server into a core `Toolkit`, one local tool per MCP
|
|
10
14
|
* tool. Effectful because the tool list is fetched; composes with
|
|
11
15
|
* `Toolkit.compose` like any other kit.
|
|
12
16
|
*/
|
|
13
|
-
var Toolkit_exports = /* @__PURE__ */ __exportAll({
|
|
17
|
+
var Toolkit_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
+
McpToolFailed: () => McpToolFailed,
|
|
19
|
+
mcpToolkit: () => mcpToolkit
|
|
20
|
+
});
|
|
21
|
+
/** The server reported an error (`isError`); the model sees its content as `message`. */
|
|
22
|
+
var McpToolFailed = class extends Schema.TaggedError("@betalyra/effect-uai/mcp/McpToolFailed")("McpToolFailed", { message: Schema.String }) {};
|
|
14
23
|
/**
|
|
15
24
|
* The server owns validation, so the input schema is a passthrough: it carries
|
|
16
25
|
* the server's JSON Schema verbatim (the model sees the real thing) and
|
|
@@ -26,45 +35,54 @@ const passthroughSchema = (tool) => ({ "~standard": {
|
|
|
26
35
|
output: () => ({ type: "object" })
|
|
27
36
|
}
|
|
28
37
|
} });
|
|
29
|
-
const
|
|
38
|
+
const knownValue = Match.type().pipe(Match.discriminatorsExhaustive("type")({
|
|
39
|
+
text: (b) => b.text,
|
|
40
|
+
image: (b) => Content.image(imageBase64(b.data, b.mimeType)),
|
|
41
|
+
audio: (b) => Content.file(fileBase64(b.data, b.mimeType)),
|
|
42
|
+
resource_link: (b) => Content.file(fileUrl(b.uri, b.mimeType), b.name),
|
|
43
|
+
resource: ({ resource }) => "text" in resource ? resource.text : Content.file(fileBase64(resource.blob, resource.mimeType ?? "application/octet-stream"))
|
|
44
|
+
}));
|
|
45
|
+
const valueOf = (block) => isKnownContent(block) ? knownValue(block) : `[${block.type} content omitted]`;
|
|
30
46
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* a short placeholder until the loop grows a multimodal tool-output path.
|
|
47
|
+
* A result as the tool's value: `structuredContent` when the server provides it
|
|
48
|
+
* (its text blocks usually repeat it), plus any media; otherwise every block.
|
|
34
49
|
*/
|
|
35
|
-
const outputOf = (result) =>
|
|
50
|
+
const outputOf = (result) => {
|
|
51
|
+
const values = (result.content ?? []).map(valueOf);
|
|
52
|
+
return Option.match(Option.fromNullishOr(result.structuredContent), {
|
|
53
|
+
onNone: () => ToolOutput.single(values),
|
|
54
|
+
onSome: (structured) => ToolOutput.single([structured, ...values.filter(Content.isMedia)])
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const messageOf = (result) => (result.content ?? []).map(valueOf).filter((v) => typeof v === "string").join("\n");
|
|
36
58
|
/**
|
|
37
59
|
* Two failure channels, deliberately: `isError` is the server telling the
|
|
38
|
-
* model it went wrong, so it becomes
|
|
60
|
+
* model it went wrong, so it becomes the declared `McpToolFailed`; an
|
|
39
61
|
* `input_required` result is a protocol capability gap the model cannot fix,
|
|
40
|
-
* so it stays a typed `McpError
|
|
62
|
+
* so it stays a typed `McpError` and fails the run.
|
|
41
63
|
*/
|
|
42
|
-
const interpret = (name, result) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
reason: `${name} requires interactive input (MRTR), unsupported by this client`
|
|
47
|
-
}));
|
|
48
|
-
return Effect.succeed(outputOf(result));
|
|
49
|
-
};
|
|
50
|
-
const runTool = (client, name) => (input) => client.callTool(name, input).pipe(Effect.flatMap((result) => interpret(name, result)));
|
|
64
|
+
const interpret = (name, result) => Match.value(result).pipe(Match.when({ isError: true }, (r) => Effect.fail(new McpToolFailed({ message: messageOf(r) }))), Match.when({ resultType: "input_required" }, () => Effect.fail(new McpProtocolError({
|
|
65
|
+
method: "tools/call",
|
|
66
|
+
reason: `${name} requires interactive input (MRTR), unsupported by this client`
|
|
67
|
+
}))), Match.orElse((r) => Effect.succeed(outputOf(r))));
|
|
51
68
|
const toLocalTool = (client, info) => Tool.make({
|
|
52
69
|
name: info.name,
|
|
53
70
|
description: info.description ?? info.name,
|
|
54
71
|
inputSchema: passthroughSchema(info),
|
|
55
|
-
|
|
72
|
+
outputSchema: Content.Value,
|
|
73
|
+
failureSchema: McpToolFailed,
|
|
74
|
+
run: (input) => client.callTool(info.name, input).pipe(Effect.flatMap((r) => interpret(info.name, r))),
|
|
56
75
|
strict: false
|
|
57
76
|
});
|
|
58
77
|
/**
|
|
59
78
|
* Build a `Toolkit` from the server's advertised tools. The list is snapshotted
|
|
60
|
-
* here; a tool that later vanishes surfaces
|
|
61
|
-
* `unknown_tool` path.
|
|
79
|
+
* here; a tool that later vanishes surfaces as `Toolkit.run`'s `UnknownTool`.
|
|
62
80
|
*/
|
|
63
81
|
const mcpToolkit = (client, options) => client.listTools.pipe(Effect.map((tools) => CoreToolkit.fromArray(tools.map((info) => toLocalTool(client, info)))), Effect.map((kit) => Option.fromNullishOr(options?.prefix).pipe(Option.match({
|
|
64
82
|
onNone: () => kit,
|
|
65
83
|
onSome: (prefix) => CoreToolkit.namespace(prefix, kit)
|
|
66
84
|
}))));
|
|
67
85
|
//#endregion
|
|
68
|
-
export { mcpToolkit, Toolkit_exports as t };
|
|
86
|
+
export { McpToolFailed, mcpToolkit, Toolkit_exports as t };
|
|
69
87
|
|
|
70
88
|
//# sourceMappingURL=Toolkit.mjs.map
|
package/dist/Toolkit.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Toolkit.mjs","names":[],"sources":["../src/Toolkit.ts"],"sourcesContent":["/**\n * Turn a connected MCP server into a core `Toolkit`, one
|
|
1
|
+
{"version":3,"file":"Toolkit.mjs","names":[],"sources":["../src/Toolkit.ts"],"sourcesContent":["/**\n * Turn a connected MCP server into a core `Toolkit`, one local tool per MCP\n * tool. Effectful because the tool list is fetched; composes with\n * `Toolkit.compose` like any other kit.\n */\nimport { Effect, Match, Option, Schema } from \"effect\"\nimport * as Content from \"@effect-uai/core/Content\"\nimport { fileBase64, fileUrl } from \"@effect-uai/core/File\"\nimport { imageBase64 } from \"@effect-uai/core/Image\"\nimport * as Tool from \"@effect-uai/core/Tool\"\nimport * as CoreToolkit from \"@effect-uai/core/Toolkit\"\nimport * as ToolOutput from \"@effect-uai/core/ToolOutput\"\nimport type { McpClient } from \"./Client.js\"\nimport { type McpError, McpProtocolError } from \"./McpError.js\"\nimport {\n type CallToolResult,\n type ContentBlock,\n isKnownContent,\n type KnownContent,\n type ToolInfo,\n} from \"./internal/schema.js\"\n\nexport type McpToolkitOptions = {\n /** Namespace every tool as `<prefix>__<name>`; recommended when composing servers. */\n readonly prefix?: string\n}\n\n/** The server reported an error (`isError`); the model sees its content as `message`. */\nexport class McpToolFailed extends Schema.TaggedError<McpToolFailed>(\n \"@betalyra/effect-uai/mcp/McpToolFailed\",\n)(\"McpToolFailed\", { message: Schema.String }) {}\n\n/**\n * The server owns validation, so the input schema is a passthrough: it carries\n * the server's JSON Schema verbatim (the model sees the real thing) and\n * accepts whatever the model produced. `strict: false` because server schemas\n * are not written to OpenAI strict rules.\n */\nconst passthroughSchema = (tool: ToolInfo): Tool.ToolInputSchema<unknown> => ({\n \"~standard\": {\n version: 1,\n vendor: \"effect-uai-mcp\",\n validate: (value: unknown) => ({ value }),\n jsonSchema: {\n input: () => tool.inputSchema,\n output: () => ({ type: \"object\" }),\n },\n },\n})\n\n// A blob without a MIME type is opaque bytes.\nconst knownValue = Match.type<KnownContent>().pipe(\n Match.discriminatorsExhaustive(\"type\")({\n text: (b): string | Content.Media => b.text,\n image: (b) => Content.image(imageBase64(b.data, b.mimeType)),\n audio: (b) => Content.file(fileBase64(b.data, b.mimeType)),\n resource_link: (b) => Content.file(fileUrl(b.uri, b.mimeType), b.name),\n resource: ({ resource }) =>\n \"text\" in resource\n ? resource.text\n : Content.file(fileBase64(resource.blob, resource.mimeType ?? \"application/octet-stream\")),\n }),\n)\n\nconst valueOf = (block: ContentBlock): string | Content.Media =>\n isKnownContent(block) ? knownValue(block) : `[${block.type} content omitted]`\n\n/**\n * A result as the tool's value: `structuredContent` when the server provides it\n * (its text blocks usually repeat it), plus any media; otherwise every block.\n */\nconst outputOf = (result: CallToolResult): Content.Value => {\n const values: ReadonlyArray<Schema.Json | Content.Media> = (result.content ?? []).map(valueOf)\n return Option.match(Option.fromNullishOr(result.structuredContent), {\n onNone: () => ToolOutput.single(values),\n onSome: (structured) => ToolOutput.single([structured, ...values.filter(Content.isMedia)]),\n })\n}\n\nconst messageOf = (result: CallToolResult): string =>\n (result.content ?? [])\n .map(valueOf)\n .filter((v): v is string => typeof v === \"string\")\n .join(\"\\n\")\n\n/**\n * Two failure channels, deliberately: `isError` is the server telling the\n * model it went wrong, so it becomes the declared `McpToolFailed`; an\n * `input_required` result is a protocol capability gap the model cannot fix,\n * so it stays a typed `McpError` and fails the run.\n */\nconst interpret = (\n name: string,\n result: CallToolResult,\n): Effect.Effect<Content.Value, McpError | McpToolFailed> =>\n Match.value(result).pipe(\n Match.when({ isError: true }, (r) => Effect.fail(new McpToolFailed({ message: messageOf(r) }))),\n Match.when({ resultType: \"input_required\" }, () =>\n Effect.fail(\n new McpProtocolError({\n method: \"tools/call\",\n reason: `${name} requires interactive input (MRTR), unsupported by this client`,\n }),\n ),\n ),\n Match.orElse((r) => Effect.succeed(outputOf(r))),\n )\n\nconst toLocalTool = (client: McpClient, info: ToolInfo) =>\n Tool.make({\n name: info.name,\n description: info.description ?? info.name,\n inputSchema: passthroughSchema(info),\n // Known only at runtime: any mix of text, JSON and media.\n outputSchema: Content.Value,\n failureSchema: McpToolFailed,\n run: (input) =>\n client.callTool(info.name, input).pipe(Effect.flatMap((r) => interpret(info.name, r))),\n strict: false,\n })\n\n/**\n * Build a `Toolkit` from the server's advertised tools. The list is snapshotted\n * here; a tool that later vanishes surfaces as `Toolkit.run`'s `UnknownTool`.\n */\nexport const mcpToolkit = (\n client: McpClient,\n options?: McpToolkitOptions,\n): Effect.Effect<CoreToolkit.Toolkit, McpError> =>\n client.listTools.pipe(\n Effect.map((tools) => CoreToolkit.fromArray(tools.map((info) => toLocalTool(client, info)))),\n Effect.map((kit) =>\n Option.fromNullishOr(options?.prefix).pipe(\n Option.match({\n onNone: () => kit,\n onSome: (prefix) => CoreToolkit.namespace(prefix, kit),\n }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Z,QAAQ,MAAmB,OAAO,MAAM,QAAQ,CAAC,CACjD,KAAK,IAAI;;;;;;;AAQd,MAAM,aACJ,MACA,WAEA,MAAM,MAAM,MAAM,CAAC,CAAC,KAClB,MAAM,KAAK,EAAE,SAAS,KAAK,IAAI,MAAM,OAAO,KAAK,IAAI,cAAc,EAAE,SAAS,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,GAC9F,MAAM,KAAK,EAAE,YAAY,iBAAiB,SACxC,OAAO,KACL,IAAI,iBAAiB;CACnB,QAAQ;CACR,QAAQ,GAAG,KAAK;AAClB,CAAC,CACH,CACF,GACA,MAAM,QAAQ,MAAM,OAAO,QAAQ,SAAS,CAAC,CAAC,CAAC,CACjD;AAEF,MAAM,eAAe,QAAmB,SACtC,KAAK,KAAK;CACR,MAAM,KAAK;CACX,aAAa,KAAK,eAAe,KAAK;CACtC,aAAa,kBAAkB,IAAI;CAEnC,cAAc,QAAQ;CACtB,eAAe;CACf,MAAM,UACJ,OAAO,SAAS,KAAK,MAAM,KAAK,CAAC,CAAC,KAAK,OAAO,SAAS,MAAM,UAAU,KAAK,MAAM,CAAC,CAAC,CAAC;CACvF,QAAQ;AACV,CAAC;;;;;AAMH,MAAa,cACX,QACA,YAEA,OAAO,UAAU,KACf,OAAO,KAAK,UAAU,YAAY,UAAU,MAAM,KAAK,SAAS,YAAY,QAAQ,IAAI,CAAC,CAAC,CAAC,GAC3F,OAAO,KAAK,QACV,OAAO,cAAc,SAAS,MAAM,CAAC,CAAC,KACpC,OAAO,MAAM;CACX,cAAc;CACd,SAAS,WAAW,YAAY,UAAU,QAAQ,GAAG;AACvD,CAAC,CACH,CACF,CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { t as McpAuthError } from "./McpError-DWg9BlW5.mjs";
|
|
2
|
+
import { Data, Effect, Option, Redacted } from "effect";
|
|
3
|
+
//#region src/internal/auth.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* An Effect yielding a bearer token. Any external OAuth, vault, or secret
|
|
6
|
+
* manager plugs in here. Read per request, so a producer minting expensive
|
|
7
|
+
* tokens caches internally (as `OAuth.clientCredentials` does).
|
|
8
|
+
*/
|
|
9
|
+
type TokenSource = Effect.Effect<Redacted.Redacted<string>, McpAuthError>;
|
|
10
|
+
type Auth = Data.TaggedEnum<{
|
|
11
|
+
/** A fixed token: the turnkey case for a token-gated server. */
|
|
12
|
+
Static: {
|
|
13
|
+
readonly token: Redacted.Redacted<string>;
|
|
14
|
+
readonly scheme?: string;
|
|
15
|
+
};
|
|
16
|
+
/** Bring your own, re-read before every request. */
|
|
17
|
+
TokenSource: {
|
|
18
|
+
readonly token: TokenSource;
|
|
19
|
+
readonly scheme?: string;
|
|
20
|
+
};
|
|
21
|
+
/** Built-in OAuth 2.1, which produces a `TokenSource` and rides the same seam. */
|
|
22
|
+
OAuth: {
|
|
23
|
+
readonly source: TokenSource;
|
|
24
|
+
readonly scheme?: string;
|
|
25
|
+
};
|
|
26
|
+
}>;
|
|
27
|
+
declare const Auth: Data.TaggedEnum.Constructor<{
|
|
28
|
+
readonly _tag: "OAuth";
|
|
29
|
+
readonly source: TokenSource;
|
|
30
|
+
readonly scheme?: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly _tag: "Static";
|
|
33
|
+
readonly token: Redacted.Redacted<string>;
|
|
34
|
+
readonly scheme?: string;
|
|
35
|
+
} | {
|
|
36
|
+
readonly _tag: "TokenSource";
|
|
37
|
+
readonly token: TokenSource;
|
|
38
|
+
readonly scheme?: string;
|
|
39
|
+
}>;
|
|
40
|
+
/**
|
|
41
|
+
* The `Authorization` header for one request, or none for a public server.
|
|
42
|
+
* `Redacted.value` is unwrapped only here.
|
|
43
|
+
*/
|
|
44
|
+
declare const authHeaders: (auth: Option.Option<Auth>) => Effect.Effect<Record<string, string>, McpAuthError>;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { TokenSource as n, authHeaders as r, Auth as t };
|
|
47
|
+
//# sourceMappingURL=auth-CRIPfiPB.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-CRIPfiPB.d.mts","names":[],"sources":["../src/internal/auth.ts"],"mappings":";;;;;;;;KAaY,cAAc,OAAO,OAAO,SAAS,kBAAkB;KAEvD,OAAO,KAAK;;EAEtB;aAAmB,OAAO,SAAS;aAA2B;;;EAE9D;aAAwB,OAAO;aAAsB;;;EAErD;aAAkB,QAAQ;aAAsB;;;cAGrC,MAAI,KAAA,WAAA;;WAHW,QAAA;WAA+B;;;WAJ/B,OAAA,SAAS;WAAoC;;;WAExC,OAAA;WAA+B;;;;;;cAiBnD,cAAW,MAChB,OAAO,OAAO,UACnB,OAAO,OAAO,wBAAwB"}
|
package/dist/internal/auth.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as TokenSource, r as authHeaders, t as Auth } from "../auth-
|
|
1
|
+
import { n as TokenSource, r as authHeaders, t as Auth } from "../auth-CRIPfiPB.mjs";
|
|
2
2
|
export { Auth, TokenSource, authHeaders };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as McpError } from "../McpError-DWg9BlW5.mjs";
|
|
2
|
-
import { t as Auth } from "../auth-
|
|
3
|
-
import { i as Transport } from "../rpc-
|
|
2
|
+
import { t as Auth } from "../auth-CRIPfiPB.mjs";
|
|
3
|
+
import { i as Transport } from "../rpc-Bs2BCLha.mjs";
|
|
4
4
|
import { Effect, Scope } from "effect";
|
|
5
5
|
import { HttpClient } from "effect/http";
|
|
6
6
|
//#region src/internal/httpTransport.d.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as modernRejection, n as Protocol, r as ProtocolProbe, t as ModernRejection } from "../protocol-
|
|
1
|
+
import { i as modernRejection, n as Protocol, r as ProtocolProbe, t as ModernRejection } from "../protocol-C3L9kaRW.mjs";
|
|
2
2
|
export { ModernRejection, Protocol, ProtocolProbe, modernRejection };
|
package/dist/internal/rpc.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as open, i as Transport, n as McpConnection, r as SendMeta, t as Inbound } from "../rpc-
|
|
1
|
+
import { a as open, i as Transport, n as McpConnection, r as SendMeta, t as Inbound } from "../rpc-Bs2BCLha.mjs";
|
|
2
2
|
export { Inbound, McpConnection, SendMeta, Transport, open };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { CLIENT_INFO, CODE_HEADER_MISMATCH, CODE_METHOD_NOT_FOUND, CODE_MISSING_CLIENT_CAPABILITY, CODE_UNSUPPORTED_PROTOCOL_VERSION, CallToolResult, ContentBlock, DiscoverResult, InboundMessage, InitializeResult, JsonRpcErrorObject, JsonRpcId, LATEST_VERSION, LEGACY_VERSION, ListToolsResult, META_CLIENT_CAPABILITIES, META_CLIENT_INFO, META_PROTOCOL_VERSION, META_SERVER_INFO, MODERN_ERROR_CODES, McpMethod, OtherContent, ProtocolVersion, ResultMeta, ServerInfo, TextContent, ToolInfo, UnsupportedVersionData, asProtocolVersion, decodeCallToolResult, decodeDiscoverResult, decodeInboundMessage, decodeInitializeResult, decodeListToolsResult, decodeUnsupportedVersionData, errorFrame,
|
|
1
|
+
import { A as ServerInfo, B as decodeUnsupportedVersionData, C as META_SERVER_INFO, D as ProtocolVersion, E as OtherContent, F as decodeCallToolResult, G as resultFrame, H as isKnownContent, I as decodeDiscoverResult, L as decodeInboundMessage, M as ToolInfo, N as UnsupportedVersionData, O as ResourceLink, P as asProtocolVersion, R as decodeInitializeResult, S as META_PROTOCOL_VERSION, T as McpMethod, U as notificationFrame, V as errorFrame, W as requestFrame, _ as LATEST_VERSION, a as CODE_MISSING_CLIENT_CAPABILITY, b as META_CLIENT_CAPABILITIES, c as ContentBlock, d as ImageContent, f as InboundMessage, g as KnownContent, h as JsonRpcId, i as CODE_METHOD_NOT_FOUND, j as TextContent, k as ResultMeta, l as DiscoverResult, m as JsonRpcErrorObject, n as CLIENT_INFO, o as CODE_UNSUPPORTED_PROTOCOL_VERSION, p as InitializeResult, r as CODE_HEADER_MISMATCH, s as CallToolResult, t as AudioContent, u as EmbeddedResource, v as LEGACY_VERSION, w as MODERN_ERROR_CODES, x as META_CLIENT_INFO, y as ListToolsResult, z as decodeListToolsResult } from "../schema-tDws3q4j.mjs";
|
|
2
|
+
export { AudioContent, CLIENT_INFO, CODE_HEADER_MISMATCH, CODE_METHOD_NOT_FOUND, CODE_MISSING_CLIENT_CAPABILITY, CODE_UNSUPPORTED_PROTOCOL_VERSION, CallToolResult, ContentBlock, DiscoverResult, EmbeddedResource, ImageContent, InboundMessage, InitializeResult, JsonRpcErrorObject, JsonRpcId, KnownContent, LATEST_VERSION, LEGACY_VERSION, ListToolsResult, META_CLIENT_CAPABILITIES, META_CLIENT_INFO, META_PROTOCOL_VERSION, META_SERVER_INFO, MODERN_ERROR_CODES, McpMethod, OtherContent, ProtocolVersion, ResourceLink, ResultMeta, ServerInfo, TextContent, ToolInfo, UnsupportedVersionData, asProtocolVersion, decodeCallToolResult, decodeDiscoverResult, decodeInboundMessage, decodeInitializeResult, decodeListToolsResult, decodeUnsupportedVersionData, errorFrame, isKnownContent, notificationFrame, requestFrame, resultFrame };
|
package/dist/internal/schema.mjs
CHANGED
|
@@ -120,14 +120,48 @@ const TextContent = Schema.Struct({
|
|
|
120
120
|
type: Schema.Literal("text"),
|
|
121
121
|
text: Schema.String
|
|
122
122
|
});
|
|
123
|
-
|
|
123
|
+
const ImageContent = Schema.Struct({
|
|
124
|
+
type: Schema.Literal("image"),
|
|
125
|
+
data: Schema.String,
|
|
126
|
+
mimeType: Schema.String
|
|
127
|
+
});
|
|
128
|
+
const AudioContent = Schema.Struct({
|
|
129
|
+
type: Schema.Literal("audio"),
|
|
130
|
+
data: Schema.String,
|
|
131
|
+
mimeType: Schema.String
|
|
132
|
+
});
|
|
133
|
+
const ResourceLink = Schema.Struct({
|
|
134
|
+
type: Schema.Literal("resource_link"),
|
|
135
|
+
uri: Schema.String,
|
|
136
|
+
name: Schema.optional(Schema.String),
|
|
137
|
+
mimeType: Schema.optional(Schema.String)
|
|
138
|
+
});
|
|
139
|
+
const EmbeddedResource = Schema.Struct({
|
|
140
|
+
type: Schema.Literal("resource"),
|
|
141
|
+
resource: Schema.Union([Schema.Struct({
|
|
142
|
+
uri: Schema.String,
|
|
143
|
+
text: Schema.String
|
|
144
|
+
}), Schema.Struct({
|
|
145
|
+
uri: Schema.String,
|
|
146
|
+
blob: Schema.String,
|
|
147
|
+
mimeType: Schema.optional(Schema.String)
|
|
148
|
+
})])
|
|
149
|
+
});
|
|
150
|
+
/** A block type this client does not know; summarized for the model. */
|
|
124
151
|
const OtherContent = Schema.Struct({ type: Schema.String });
|
|
125
|
-
const
|
|
126
|
-
|
|
152
|
+
const KnownContent = Schema.Union([
|
|
153
|
+
TextContent,
|
|
154
|
+
ImageContent,
|
|
155
|
+
AudioContent,
|
|
156
|
+
ResourceLink,
|
|
157
|
+
EmbeddedResource
|
|
158
|
+
]);
|
|
159
|
+
const isKnownContent = Schema.is(KnownContent);
|
|
160
|
+
const ContentBlock = Schema.Union([KnownContent, OtherContent]);
|
|
127
161
|
const CallToolResult = Schema.Struct({
|
|
128
162
|
content: Schema.optionalKey(Schema.Array(ContentBlock)),
|
|
129
163
|
isError: Schema.optional(Schema.Boolean),
|
|
130
|
-
structuredContent: Schema.optional(Schema.
|
|
164
|
+
structuredContent: Schema.optional(Schema.Json),
|
|
131
165
|
resultType: Schema.optional(Schema.String)
|
|
132
166
|
});
|
|
133
167
|
const decodeCallToolResult = Schema.decodeUnknownEffect(CallToolResult);
|
|
@@ -163,6 +197,6 @@ const InitializeResult = Schema.Struct({
|
|
|
163
197
|
});
|
|
164
198
|
const decodeInitializeResult = Schema.decodeUnknownEffect(InitializeResult);
|
|
165
199
|
//#endregion
|
|
166
|
-
export { CLIENT_INFO, CODE_HEADER_MISMATCH, CODE_METHOD_NOT_FOUND, CODE_MISSING_CLIENT_CAPABILITY, CODE_UNSUPPORTED_PROTOCOL_VERSION, CallToolResult, ContentBlock, DiscoverResult, InboundMessage, InitializeResult, JsonRpcErrorObject, JsonRpcId, LATEST_VERSION, LEGACY_VERSION, ListToolsResult, META_CLIENT_CAPABILITIES, META_CLIENT_INFO, META_PROTOCOL_VERSION, META_SERVER_INFO, MODERN_ERROR_CODES, McpMethod, OtherContent, ProtocolVersion, ResultMeta, ServerInfo, TextContent, ToolInfo, UnsupportedVersionData, asProtocolVersion, decodeCallToolResult, decodeDiscoverResult, decodeInboundMessage, decodeInitializeResult, decodeListToolsResult, decodeUnsupportedVersionData, errorFrame,
|
|
200
|
+
export { AudioContent, CLIENT_INFO, CODE_HEADER_MISMATCH, CODE_METHOD_NOT_FOUND, CODE_MISSING_CLIENT_CAPABILITY, CODE_UNSUPPORTED_PROTOCOL_VERSION, CallToolResult, ContentBlock, DiscoverResult, EmbeddedResource, ImageContent, InboundMessage, InitializeResult, JsonRpcErrorObject, JsonRpcId, KnownContent, LATEST_VERSION, LEGACY_VERSION, ListToolsResult, META_CLIENT_CAPABILITIES, META_CLIENT_INFO, META_PROTOCOL_VERSION, META_SERVER_INFO, MODERN_ERROR_CODES, McpMethod, OtherContent, ProtocolVersion, ResourceLink, ResultMeta, ServerInfo, TextContent, ToolInfo, UnsupportedVersionData, asProtocolVersion, decodeCallToolResult, decodeDiscoverResult, decodeInboundMessage, decodeInitializeResult, decodeListToolsResult, decodeUnsupportedVersionData, errorFrame, isKnownContent, notificationFrame, requestFrame, resultFrame };
|
|
167
201
|
|
|
168
202
|
//# sourceMappingURL=schema.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.mjs","names":[],"sources":["../../src/internal/schema.ts"],"sourcesContent":["/**\n * Self-contained MCP wire schemas, both protocol eras. The single source of\n * truth for the wire format; nothing MCP-shaped is imported from effect.\n * Decodes are deliberately loose (unknown extra fields pass through) so\n * spec-compliant servers with richer payloads never fail the client.\n */\nimport { Option, Schema } from \"effect\"\n\n// ---------------------------------------------------------------------------\n// Protocol versions\n// ---------------------------------------------------------------------------\n\n/** Every protocol version this client can speak. */\nexport const ProtocolVersion = Schema.Literals([\"2026-07-28\", \"2025-11-25\", \"2025-06-18\"])\nexport type ProtocolVersion = typeof ProtocolVersion.Type\n\n/** Newest version we speak: the stateless protocol, and what the probe tries first. */\nexport const LATEST_VERSION = \"2026-07-28\" satisfies ProtocolVersion\n\n/** The legacy handshake era we negotiate; 2025-11-25 is wire-compatible. */\nexport const LEGACY_VERSION = \"2025-06-18\" satisfies ProtocolVersion\n\nconst isProtocolVersion = Schema.is(ProtocolVersion)\n\n/** Narrow a server-offered version string to one we support. */\nexport const asProtocolVersion = (raw: string): Option.Option<ProtocolVersion> =>\n isProtocolVersion(raw) ? Option.some(raw) : Option.none()\n\n/**\n * The JSON-RPC methods this client issues. Not to be confused with an HTTP\n * method: on Streamable HTTP every one of these travels as a POST, and the\n * name is mirrored into the `Mcp-Method` header.\n */\nexport const McpMethod = Schema.Literals([\n \"server/discover\",\n \"initialize\",\n \"tools/list\",\n \"tools/call\",\n])\nexport type McpMethod = typeof McpMethod.Type\n\n/** Modern `_meta` keys (SEP-2575): every request self-describes its protocol. */\nexport const META_PROTOCOL_VERSION = \"io.modelcontextprotocol/protocolVersion\"\nexport const META_CLIENT_INFO = \"io.modelcontextprotocol/clientInfo\"\nexport const META_CLIENT_CAPABILITIES = \"io.modelcontextprotocol/clientCapabilities\"\n/** Servers identify themselves in each *result's* `_meta`, not at the top level. */\nexport const META_SERVER_INFO = \"io.modelcontextprotocol/serverInfo\"\n\nexport const CLIENT_INFO = { name: \"@effect-uai/mcp\", version: \"0.12.1\" }\n\n/** Modern JSON-RPC error codes. */\nexport const CODE_HEADER_MISMATCH = -32020\nexport const CODE_MISSING_CLIENT_CAPABILITY = -32021\nexport const CODE_UNSUPPORTED_PROTOCOL_VERSION = -32022\nexport const CODE_METHOD_NOT_FOUND = -32601\n\n/**\n * A reply carrying one of these proves the server speaks a modern version, so\n * era detection corrects and retries instead of falling back to `initialize`.\n */\nexport const MODERN_ERROR_CODES: ReadonlySet<number> = new Set([\n CODE_HEADER_MISMATCH,\n CODE_MISSING_CLIENT_CAPABILITY,\n CODE_UNSUPPORTED_PROTOCOL_VERSION,\n])\n\n// ---------------------------------------------------------------------------\n// JSON-RPC envelope\n// ---------------------------------------------------------------------------\n\nexport const JsonRpcId = Schema.Union([Schema.Number, Schema.String])\nexport type JsonRpcId = typeof JsonRpcId.Type\n\nexport const JsonRpcErrorObject = Schema.Struct({\n code: Schema.Number,\n message: Schema.optional(Schema.String),\n data: Schema.optional(Schema.Unknown),\n})\nexport type JsonRpcErrorObject = typeof JsonRpcErrorObject.Type\n\n/**\n * Any inbound frame: a reply (`id` + `result`/`error`), a server-initiated\n * request (`method` + `id`), or a notification (`method`, no `id`). One\n * loose struct so the reader can classify without a union decode.\n */\nexport const InboundMessage = Schema.Struct({\n // Null is legal and meaningful: JSON-RPC uses it for errors raised before a\n // request could be attributed. Rejecting it would drop the frame entirely.\n id: Schema.optional(Schema.NullOr(JsonRpcId)),\n result: Schema.optional(Schema.Unknown),\n error: Schema.optional(JsonRpcErrorObject),\n method: Schema.optional(Schema.String),\n params: Schema.optional(Schema.Unknown),\n})\nexport type InboundMessage = typeof InboundMessage.Type\n\nexport const decodeInboundMessage = Schema.decodeUnknownEffect(InboundMessage)\n\n// --- outbound frame builders -----------------------------------------------\n\nexport const requestFrame = (id: JsonRpcId, method: string, params: unknown): string =>\n JSON.stringify({ jsonrpc: \"2.0\", id, method, params: params ?? {} })\n\nexport const notificationFrame = (method: string, params?: unknown): string =>\n JSON.stringify(\n params === undefined ? { jsonrpc: \"2.0\", method } : { jsonrpc: \"2.0\", method, params },\n )\n\nexport const resultFrame = (id: JsonRpcId, result: unknown): string =>\n JSON.stringify({ jsonrpc: \"2.0\", id, result })\n\nexport const errorFrame = (id: JsonRpcId, code: number, message: string): string =>\n JSON.stringify({ jsonrpc: \"2.0\", id, error: { code, message } })\n\n// ---------------------------------------------------------------------------\n// Shared: tools\n// ---------------------------------------------------------------------------\n\nexport const ToolInfo = Schema.Struct({\n name: Schema.String,\n description: Schema.optional(Schema.String),\n inputSchema: Schema.Record(Schema.String, Schema.Unknown),\n})\nexport type ToolInfo = typeof ToolInfo.Type\n\n/**\n * Modern list results may carry cache metadata (`ttlMs` / `cacheScope`);\n * v1 reads but does not act on them (input for a later refresh feature).\n */\nexport const ListToolsResult = Schema.Struct({\n tools: Schema.Array(ToolInfo),\n nextCursor: Schema.optional(Schema.String),\n ttlMs: Schema.optional(Schema.Number),\n cacheScope: Schema.optional(Schema.String),\n})\nexport type ListToolsResult = typeof ListToolsResult.Type\n\nexport const decodeListToolsResult = Schema.decodeUnknownEffect(ListToolsResult)\n\n// --- content blocks ---------------------------------------------------------\n\nexport const TextContent = Schema.Struct({\n type: Schema.Literal(\"text\"),\n text: Schema.String,\n})\nexport type TextContent = typeof TextContent.Type\n\n/** Non-text blocks (image / audio / resource) are placeholder-summarized in v1. */\nexport const OtherContent = Schema.Struct({\n type: Schema.String,\n})\n\nexport const ContentBlock = Schema.Union([TextContent, OtherContent])\nexport type ContentBlock = typeof ContentBlock.Type\n\nexport const isTextContent = Schema.is(TextContent)\n\nexport const CallToolResult = Schema.Struct({\n content: Schema.optionalKey(Schema.Array(ContentBlock)),\n isError: Schema.optional(Schema.Boolean),\n structuredContent: Schema.optional(Schema.Unknown),\n // Required on modern results; absent on legacy ones.\n resultType: Schema.optional(Schema.String),\n})\nexport type CallToolResult = typeof CallToolResult.Type\n\nexport const decodeCallToolResult = Schema.decodeUnknownEffect(CallToolResult)\n\n// ---------------------------------------------------------------------------\n// Modern era (2026-07-28)\n// ---------------------------------------------------------------------------\n\nexport const ServerInfo = Schema.Struct({\n name: Schema.String,\n version: Schema.optional(Schema.String),\n title: Schema.optional(Schema.String),\n})\nexport type ServerInfo = typeof ServerInfo.Type\n\n/** The subset of a result's `_meta` we read. */\nexport const ResultMeta = Schema.Struct({\n [META_SERVER_INFO]: Schema.optional(ServerInfo),\n})\nexport type ResultMeta = typeof ResultMeta.Type\n\nexport const DiscoverResult = Schema.Struct({\n supportedVersions: Schema.Array(Schema.String),\n capabilities: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n // Spec-conformant servers put identity in `_meta`; a top-level `serverInfo`\n // is accepted too, since that is where the legacy handshake carries it.\n _meta: Schema.optional(ResultMeta),\n serverInfo: Schema.optional(ServerInfo),\n instructions: Schema.optional(Schema.String),\n})\nexport type DiscoverResult = typeof DiscoverResult.Type\n\nexport const decodeDiscoverResult = Schema.decodeUnknownEffect(DiscoverResult)\n\n/**\n * `data` of a `-32022` UnsupportedProtocolVersionError reply. Decoded, not\n * hand-parsed: the shape is server-controlled and may carry extra fields.\n */\nexport const UnsupportedVersionData = Schema.Struct({\n supported: Schema.optional(Schema.Array(Schema.String)),\n requested: Schema.optional(Schema.NullOr(Schema.String)),\n})\nexport type UnsupportedVersionData = typeof UnsupportedVersionData.Type\n\nexport const decodeUnsupportedVersionData = Schema.decodeUnknownOption(UnsupportedVersionData)\n\n// ---------------------------------------------------------------------------\n// Legacy era (2025-06-18 / 2025-11-25)\n// ---------------------------------------------------------------------------\n\nexport const InitializeResult = Schema.Struct({\n protocolVersion: Schema.String,\n capabilities: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n serverInfo: Schema.optional(ServerInfo),\n instructions: Schema.optional(Schema.String),\n})\nexport type InitializeResult = typeof InitializeResult.Type\n\nexport const decodeInitializeResult = Schema.decodeUnknownEffect(InitializeResult)\n"],"mappings":";;;;;;;;;AAaA,MAAa,kBAAkB,OAAO,SAAS;CAAC;CAAc;CAAc;AAAY,CAAC;;AAIzF,MAAa,iBAAiB;;AAG9B,MAAa,iBAAiB;AAE9B,MAAM,oBAAoB,OAAO,GAAG,eAAe;;AAGnD,MAAa,qBAAqB,QAChC,kBAAkB,GAAG,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK;;;;;;AAO1D,MAAa,YAAY,OAAO,SAAS;CACvC;CACA;CACA;CACA;AACF,CA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U;CACjC,YAAY,OAAO,SAAS,UAAU;CACtC,cAAc,OAAO,SAAS,OAAO,MAAM;AAC7C,CAAC;AAGD,MAAa,uBAAuB,OAAO,oBAAoB,cAAc;;;;;AAM7E,MAAa,yBAAyB,OAAO,OAAO;CAClD,WAAW,OAAO,SAAS,OAAO,MAAM,OAAO,MAAM,CAAC;CACtD,WAAW,OAAO,SAAS,OAAO,OAAO,OAAO,MAAM,CAAC;AACzD,CAAC;AAGD,MAAa,+BAA+B,OAAO,oBAAoB,sBAAsB;AAM7F,MAAa,mBAAmB,OAAO,OAAO;CAC5C,iBAAiB,OAAO;CACxB,cAAc,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC;CAC1E,YAAY,OAAO,SAAS,UAAU;CACtC,cAAc,OAAO,SAAS,OAAO,MAAM;AAC7C,CAAC;AAGD,MAAa,yBAAyB,OAAO,oBAAoB,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"schema.mjs","names":[],"sources":["../../src/internal/schema.ts"],"sourcesContent":["/**\n * Self-contained MCP wire schemas, both protocol eras. The single source of\n * truth for the wire format; nothing MCP-shaped is imported from effect.\n * Decodes are deliberately loose (unknown extra fields pass through) so\n * spec-compliant servers with richer payloads never fail the client.\n */\nimport { Option, Schema } from \"effect\"\n\n// ---------------------------------------------------------------------------\n// Protocol versions\n// ---------------------------------------------------------------------------\n\n/** Every protocol version this client can speak. */\nexport const ProtocolVersion = Schema.Literals([\"2026-07-28\", \"2025-11-25\", \"2025-06-18\"])\nexport type ProtocolVersion = typeof ProtocolVersion.Type\n\n/** Newest version we speak: the stateless protocol, and what the probe tries first. */\nexport const LATEST_VERSION = \"2026-07-28\" satisfies ProtocolVersion\n\n/** The legacy handshake era we negotiate; 2025-11-25 is wire-compatible. */\nexport const LEGACY_VERSION = \"2025-06-18\" satisfies ProtocolVersion\n\nconst isProtocolVersion = Schema.is(ProtocolVersion)\n\n/** Narrow a server-offered version string to one we support. */\nexport const asProtocolVersion = (raw: string): Option.Option<ProtocolVersion> =>\n isProtocolVersion(raw) ? Option.some(raw) : Option.none()\n\n/**\n * The JSON-RPC methods this client issues. Not to be confused with an HTTP\n * method: on Streamable HTTP every one of these travels as a POST, and the\n * name is mirrored into the `Mcp-Method` header.\n */\nexport const McpMethod = Schema.Literals([\n \"server/discover\",\n \"initialize\",\n \"tools/list\",\n \"tools/call\",\n])\nexport type McpMethod = typeof McpMethod.Type\n\n/** Modern `_meta` keys (SEP-2575): every request self-describes its protocol. */\nexport const META_PROTOCOL_VERSION = \"io.modelcontextprotocol/protocolVersion\"\nexport const META_CLIENT_INFO = \"io.modelcontextprotocol/clientInfo\"\nexport const META_CLIENT_CAPABILITIES = \"io.modelcontextprotocol/clientCapabilities\"\n/** Servers identify themselves in each *result's* `_meta`, not at the top level. */\nexport const META_SERVER_INFO = \"io.modelcontextprotocol/serverInfo\"\n\nexport const CLIENT_INFO = { name: \"@effect-uai/mcp\", version: \"0.12.1\" }\n\n/** Modern JSON-RPC error codes. */\nexport const CODE_HEADER_MISMATCH = -32020\nexport const CODE_MISSING_CLIENT_CAPABILITY = -32021\nexport const CODE_UNSUPPORTED_PROTOCOL_VERSION = -32022\nexport const CODE_METHOD_NOT_FOUND = -32601\n\n/**\n * A reply carrying one of these proves the server speaks a modern version, so\n * era detection corrects and retries instead of falling back to `initialize`.\n */\nexport const MODERN_ERROR_CODES: ReadonlySet<number> = new Set([\n CODE_HEADER_MISMATCH,\n CODE_MISSING_CLIENT_CAPABILITY,\n CODE_UNSUPPORTED_PROTOCOL_VERSION,\n])\n\n// ---------------------------------------------------------------------------\n// JSON-RPC envelope\n// ---------------------------------------------------------------------------\n\nexport const JsonRpcId = Schema.Union([Schema.Number, Schema.String])\nexport type JsonRpcId = typeof JsonRpcId.Type\n\nexport const JsonRpcErrorObject = Schema.Struct({\n code: Schema.Number,\n message: Schema.optional(Schema.String),\n data: Schema.optional(Schema.Unknown),\n})\nexport type JsonRpcErrorObject = typeof JsonRpcErrorObject.Type\n\n/**\n * Any inbound frame: a reply (`id` + `result`/`error`), a server-initiated\n * request (`method` + `id`), or a notification (`method`, no `id`). One\n * loose struct so the reader can classify without a union decode.\n */\nexport const InboundMessage = Schema.Struct({\n // Null is legal and meaningful: JSON-RPC uses it for errors raised before a\n // request could be attributed. Rejecting it would drop the frame entirely.\n id: Schema.optional(Schema.NullOr(JsonRpcId)),\n result: Schema.optional(Schema.Unknown),\n error: Schema.optional(JsonRpcErrorObject),\n method: Schema.optional(Schema.String),\n params: Schema.optional(Schema.Unknown),\n})\nexport type InboundMessage = typeof InboundMessage.Type\n\nexport const decodeInboundMessage = Schema.decodeUnknownEffect(InboundMessage)\n\n// --- outbound frame builders -----------------------------------------------\n\nexport const requestFrame = (id: JsonRpcId, method: string, params: unknown): string =>\n JSON.stringify({ jsonrpc: \"2.0\", id, method, params: params ?? {} })\n\nexport const notificationFrame = (method: string, params?: unknown): string =>\n JSON.stringify(\n params === undefined ? { jsonrpc: \"2.0\", method } : { jsonrpc: \"2.0\", method, params },\n )\n\nexport const resultFrame = (id: JsonRpcId, result: unknown): string =>\n JSON.stringify({ jsonrpc: \"2.0\", id, result })\n\nexport const errorFrame = (id: JsonRpcId, code: number, message: string): string =>\n JSON.stringify({ jsonrpc: \"2.0\", id, error: { code, message } })\n\n// ---------------------------------------------------------------------------\n// Shared: tools\n// ---------------------------------------------------------------------------\n\nexport const ToolInfo = Schema.Struct({\n name: Schema.String,\n description: Schema.optional(Schema.String),\n inputSchema: Schema.Record(Schema.String, Schema.Unknown),\n})\nexport type ToolInfo = typeof ToolInfo.Type\n\n/**\n * Modern list results may carry cache metadata (`ttlMs` / `cacheScope`);\n * v1 reads but does not act on them (input for a later refresh feature).\n */\nexport const ListToolsResult = Schema.Struct({\n tools: Schema.Array(ToolInfo),\n nextCursor: Schema.optional(Schema.String),\n ttlMs: Schema.optional(Schema.Number),\n cacheScope: Schema.optional(Schema.String),\n})\nexport type ListToolsResult = typeof ListToolsResult.Type\n\nexport const decodeListToolsResult = Schema.decodeUnknownEffect(ListToolsResult)\n\n// --- content blocks ---------------------------------------------------------\n\nexport const TextContent = Schema.Struct({\n type: Schema.Literal(\"text\"),\n text: Schema.String,\n})\nexport type TextContent = typeof TextContent.Type\n\nexport const ImageContent = Schema.Struct({\n type: Schema.Literal(\"image\"),\n data: Schema.String,\n mimeType: Schema.String,\n})\n\nexport const AudioContent = Schema.Struct({\n type: Schema.Literal(\"audio\"),\n data: Schema.String,\n mimeType: Schema.String,\n})\n\nexport const ResourceLink = Schema.Struct({\n type: Schema.Literal(\"resource_link\"),\n uri: Schema.String,\n name: Schema.optional(Schema.String),\n mimeType: Schema.optional(Schema.String),\n})\n\nexport const EmbeddedResource = Schema.Struct({\n type: Schema.Literal(\"resource\"),\n resource: Schema.Union([\n Schema.Struct({ uri: Schema.String, text: Schema.String }),\n Schema.Struct({\n uri: Schema.String,\n blob: Schema.String,\n mimeType: Schema.optional(Schema.String),\n }),\n ]),\n})\n\n/** A block type this client does not know; summarized for the model. */\nexport const OtherContent = Schema.Struct({\n type: Schema.String,\n})\n\nexport const KnownContent = Schema.Union([\n TextContent,\n ImageContent,\n AudioContent,\n ResourceLink,\n EmbeddedResource,\n])\nexport type KnownContent = typeof KnownContent.Type\nexport const isKnownContent = Schema.is(KnownContent)\n\nexport const ContentBlock = Schema.Union([KnownContent, OtherContent])\nexport type ContentBlock = typeof ContentBlock.Type\n\nexport const CallToolResult = Schema.Struct({\n content: Schema.optionalKey(Schema.Array(ContentBlock)),\n isError: Schema.optional(Schema.Boolean),\n structuredContent: Schema.optional(Schema.Json),\n // Required on modern results; absent on legacy ones.\n resultType: Schema.optional(Schema.String),\n})\nexport type CallToolResult = typeof CallToolResult.Type\n\nexport const decodeCallToolResult = Schema.decodeUnknownEffect(CallToolResult)\n\n// ---------------------------------------------------------------------------\n// Modern era (2026-07-28)\n// ---------------------------------------------------------------------------\n\nexport const ServerInfo = Schema.Struct({\n name: Schema.String,\n version: Schema.optional(Schema.String),\n title: Schema.optional(Schema.String),\n})\nexport type ServerInfo = typeof ServerInfo.Type\n\n/** The subset of a result's `_meta` we read. */\nexport const ResultMeta = Schema.Struct({\n [META_SERVER_INFO]: Schema.optional(ServerInfo),\n})\nexport type ResultMeta = typeof ResultMeta.Type\n\nexport const DiscoverResult = Schema.Struct({\n supportedVersions: Schema.Array(Schema.String),\n capabilities: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n // Spec-conformant servers put identity in `_meta`; a top-level `serverInfo`\n // is accepted too, since that is where the legacy handshake carries it.\n _meta: Schema.optional(ResultMeta),\n serverInfo: Schema.optional(ServerInfo),\n instructions: Schema.optional(Schema.String),\n})\nexport type DiscoverResult = typeof DiscoverResult.Type\n\nexport const decodeDiscoverResult = Schema.decodeUnknownEffect(DiscoverResult)\n\n/**\n * `data` of a `-32022` UnsupportedProtocolVersionError reply. Decoded, not\n * hand-parsed: the shape is server-controlled and may carry extra fields.\n */\nexport const UnsupportedVersionData = Schema.Struct({\n supported: Schema.optional(Schema.Array(Schema.String)),\n requested: Schema.optional(Schema.NullOr(Schema.String)),\n})\nexport type UnsupportedVersionData = typeof UnsupportedVersionData.Type\n\nexport const decodeUnsupportedVersionData = Schema.decodeUnknownOption(UnsupportedVersionData)\n\n// ---------------------------------------------------------------------------\n// Legacy era (2025-06-18 / 2025-11-25)\n// ---------------------------------------------------------------------------\n\nexport const InitializeResult = Schema.Struct({\n protocolVersion: Schema.String,\n capabilities: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n serverInfo: Schema.optional(ServerInfo),\n instructions: Schema.optional(Schema.String),\n})\nexport type InitializeResult = typeof InitializeResult.Type\n\nexport const decodeInitializeResult = Schema.decodeUnknownEffect(InitializeResult)\n"],"mappings":";;;;;;;;;AAaA,MAAa,kBAAkB,OAAO,SAAS;CAAC;CAAc;CAAc;AAAY,CAAC;;AAIzF,MAAa,iBAAiB;;AAG9B,MAAa,iBAAiB;AAE9B,MAAM,oBAAoB,OAAO,GAAG,eAAe;;AAGnD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5C,iBAAiB,OAAO;CACxB,cAAc,OAAO,SAAS,OAAO,OAAO,OAAO,QAAQ,OAAO,OAAO,CAAC;CAC1E,YAAY,OAAO,SAAS,UAAU;CACtC,cAAc,OAAO,SAAS,OAAO,MAAM;AAC7C,CAAC;AAGD,MAAa,yBAAyB,OAAO,oBAAoB,gBAAgB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as McpError } from "../McpError-DWg9BlW5.mjs";
|
|
2
|
-
import { i as Transport } from "../rpc-
|
|
2
|
+
import { i as Transport } from "../rpc-Bs2BCLha.mjs";
|
|
3
3
|
import { Effect, Scope } from "effect";
|
|
4
4
|
import { ChildProcessSpawner } from "effect/process";
|
|
5
5
|
//#region src/internal/stdioTransport.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as McpError } from "./McpError-DWg9BlW5.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as McpConnection, r as SendMeta, t as Inbound } from "./rpc-
|
|
2
|
+
import { A as ServerInfo, D as ProtocolVersion, T as McpMethod } from "./schema-tDws3q4j.mjs";
|
|
3
|
+
import { n as McpConnection, r as SendMeta, t as Inbound } from "./rpc-Bs2BCLha.mjs";
|
|
4
4
|
import { Effect, Option, Scope } from "effect";
|
|
5
5
|
//#region src/internal/protocol.d.ts
|
|
6
6
|
type Protocol = {
|
|
@@ -32,4 +32,4 @@ type ModernRejection = {
|
|
|
32
32
|
declare const modernRejection: (error: McpError) => Option.Option<ModernRejection>;
|
|
33
33
|
//#endregion
|
|
34
34
|
export { modernRejection as i, Protocol as n, ProtocolProbe as r, ModernRejection as t };
|
|
35
|
-
//# sourceMappingURL=protocol-
|
|
35
|
+
//# sourceMappingURL=protocol-C3L9kaRW.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-
|
|
1
|
+
{"version":3,"file":"protocol-C3L9kaRW.d.mts","names":[],"sources":["../src/internal/protocol.ts"],"mappings":";;;;;KAqBY;WACD,SAAS;WACT,YAAY;;WAEZ,WAAW,QAAQ,WAAW;;WAE9B,OAAO,QAAQ,WAAW,oBAAoB;;WAE9C,YAAY,SAAS,YAAY,OAAO;;;;;;KAOvC,iBACV,YAAY,kBACT,OAAO,OAAO,OAAO,OAAO,WAAW,UAAU,MAAM;;;;;;;;KAWhD;WACD;WACA,WAAW;;cAGT,kBAAe,OAAW,aAAW,OAAO,OAAO"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as McpError } from "./McpError-DWg9BlW5.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { h as JsonRpcId } from "./schema-tDws3q4j.mjs";
|
|
3
3
|
import { Effect, Option, Scope, Stream } from "effect";
|
|
4
4
|
//#region src/internal/rpc.d.ts
|
|
5
5
|
/** Per-request transport hints (era headers on HTTP; stdio ignores them). */
|
|
@@ -31,4 +31,4 @@ type McpConnection = {
|
|
|
31
31
|
declare const open: (transport: Transport, onInbound: (inbound: Inbound) => Effect.Effect<void>) => Effect.Effect<McpConnection, never, Scope.Scope>;
|
|
32
32
|
//#endregion
|
|
33
33
|
export { open as a, Transport as i, McpConnection as n, SendMeta as r, Inbound as t };
|
|
34
|
-
//# sourceMappingURL=rpc-
|
|
34
|
+
//# sourceMappingURL=rpc-Bs2BCLha.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-
|
|
1
|
+
{"version":3,"file":"rpc-Bs2BCLha.d.mts","names":[],"sources":["../src/internal/rpc.ts"],"mappings":";;;;;KAmBY;WACD,UAAU;;;KAIT;WACD,OAAO,eAAe,OAAO,aAAa,OAAO,aAAa;WAC9D,UAAU,OAAO,eAAe;;;KAI/B;WACD,IAAI,OAAO,OAAO;WAClB;WACA;;KAGC;WACD,UACP,gBACA,kBACA,OAAO,aACJ,OAAO,gBAAgB;WACnB,SACP,gBACA,kBACA,OAAO,aACJ,OAAO,aAAa;;WAEhB,UAAU,IAAI,WAAW,oBAAoB,OAAO,aAAa;WACjE,eACP,IAAI,WACJ,cACA,oBACG,OAAO,aAAa;;;;;;cAoBd,OAAI,WACJ,WAAS,YACR,SAAS,YAAY,OAAO,iBACvC,OAAO,OAAO,sBAAsB,MAAM"}
|
|
@@ -114,30 +114,154 @@ declare const TextContent: Schema.Struct<{
|
|
|
114
114
|
readonly text: Schema.String;
|
|
115
115
|
}>;
|
|
116
116
|
type TextContent = typeof TextContent.Type;
|
|
117
|
-
|
|
117
|
+
declare const ImageContent: Schema.Struct<{
|
|
118
|
+
readonly type: Schema.Literal<"image">;
|
|
119
|
+
readonly data: Schema.String;
|
|
120
|
+
readonly mimeType: Schema.String;
|
|
121
|
+
}>;
|
|
122
|
+
declare const AudioContent: Schema.Struct<{
|
|
123
|
+
readonly type: Schema.Literal<"audio">;
|
|
124
|
+
readonly data: Schema.String;
|
|
125
|
+
readonly mimeType: Schema.String;
|
|
126
|
+
}>;
|
|
127
|
+
declare const ResourceLink: Schema.Struct<{
|
|
128
|
+
readonly type: Schema.Literal<"resource_link">;
|
|
129
|
+
readonly uri: Schema.String;
|
|
130
|
+
readonly name: Schema.optional<Schema.String>;
|
|
131
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
132
|
+
}>;
|
|
133
|
+
declare const EmbeddedResource: Schema.Struct<{
|
|
134
|
+
readonly type: Schema.Literal<"resource">;
|
|
135
|
+
readonly resource: Schema.Union<readonly [Schema.Struct<{
|
|
136
|
+
readonly uri: Schema.String;
|
|
137
|
+
readonly text: Schema.String;
|
|
138
|
+
}>, Schema.Struct<{
|
|
139
|
+
readonly uri: Schema.String;
|
|
140
|
+
readonly blob: Schema.String;
|
|
141
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
142
|
+
}>]>;
|
|
143
|
+
}>;
|
|
144
|
+
/** A block type this client does not know; summarized for the model. */
|
|
118
145
|
declare const OtherContent: Schema.Struct<{
|
|
119
146
|
readonly type: Schema.String;
|
|
120
147
|
}>;
|
|
121
|
-
declare const
|
|
148
|
+
declare const KnownContent: Schema.Union<readonly [Schema.Struct<{
|
|
122
149
|
readonly type: Schema.Literal<"text">;
|
|
123
150
|
readonly text: Schema.String;
|
|
124
151
|
}>, Schema.Struct<{
|
|
125
|
-
readonly type: Schema.
|
|
152
|
+
readonly type: Schema.Literal<"image">;
|
|
153
|
+
readonly data: Schema.String;
|
|
154
|
+
readonly mimeType: Schema.String;
|
|
155
|
+
}>, Schema.Struct<{
|
|
156
|
+
readonly type: Schema.Literal<"audio">;
|
|
157
|
+
readonly data: Schema.String;
|
|
158
|
+
readonly mimeType: Schema.String;
|
|
159
|
+
}>, Schema.Struct<{
|
|
160
|
+
readonly type: Schema.Literal<"resource_link">;
|
|
161
|
+
readonly uri: Schema.String;
|
|
162
|
+
readonly name: Schema.optional<Schema.String>;
|
|
163
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
164
|
+
}>, Schema.Struct<{
|
|
165
|
+
readonly type: Schema.Literal<"resource">;
|
|
166
|
+
readonly resource: Schema.Union<readonly [Schema.Struct<{
|
|
167
|
+
readonly uri: Schema.String;
|
|
168
|
+
readonly text: Schema.String;
|
|
169
|
+
}>, Schema.Struct<{
|
|
170
|
+
readonly uri: Schema.String;
|
|
171
|
+
readonly blob: Schema.String;
|
|
172
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
173
|
+
}>]>;
|
|
126
174
|
}>]>;
|
|
127
|
-
type
|
|
128
|
-
declare const
|
|
175
|
+
type KnownContent = typeof KnownContent.Type;
|
|
176
|
+
declare const isKnownContent: <I>(input: I) => input is I & ({
|
|
129
177
|
readonly type: "text";
|
|
130
178
|
readonly text: string;
|
|
131
|
-
}
|
|
179
|
+
} | {
|
|
180
|
+
readonly type: "image";
|
|
181
|
+
readonly data: string;
|
|
182
|
+
readonly mimeType: string;
|
|
183
|
+
} | {
|
|
184
|
+
readonly type: "audio";
|
|
185
|
+
readonly data: string;
|
|
186
|
+
readonly mimeType: string;
|
|
187
|
+
} | {
|
|
188
|
+
readonly type: "resource_link";
|
|
189
|
+
readonly uri: string;
|
|
190
|
+
readonly name?: string | undefined;
|
|
191
|
+
readonly mimeType?: string | undefined;
|
|
192
|
+
} | {
|
|
193
|
+
readonly type: "resource";
|
|
194
|
+
readonly resource: {
|
|
195
|
+
readonly uri: string;
|
|
196
|
+
readonly text: string;
|
|
197
|
+
} | {
|
|
198
|
+
readonly uri: string;
|
|
199
|
+
readonly blob: string;
|
|
200
|
+
readonly mimeType?: string | undefined;
|
|
201
|
+
};
|
|
202
|
+
});
|
|
203
|
+
declare const ContentBlock: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
204
|
+
readonly type: Schema.Literal<"text">;
|
|
205
|
+
readonly text: Schema.String;
|
|
206
|
+
}>, Schema.Struct<{
|
|
207
|
+
readonly type: Schema.Literal<"image">;
|
|
208
|
+
readonly data: Schema.String;
|
|
209
|
+
readonly mimeType: Schema.String;
|
|
210
|
+
}>, Schema.Struct<{
|
|
211
|
+
readonly type: Schema.Literal<"audio">;
|
|
212
|
+
readonly data: Schema.String;
|
|
213
|
+
readonly mimeType: Schema.String;
|
|
214
|
+
}>, Schema.Struct<{
|
|
215
|
+
readonly type: Schema.Literal<"resource_link">;
|
|
216
|
+
readonly uri: Schema.String;
|
|
217
|
+
readonly name: Schema.optional<Schema.String>;
|
|
218
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
219
|
+
}>, Schema.Struct<{
|
|
220
|
+
readonly type: Schema.Literal<"resource">;
|
|
221
|
+
readonly resource: Schema.Union<readonly [Schema.Struct<{
|
|
222
|
+
readonly uri: Schema.String;
|
|
223
|
+
readonly text: Schema.String;
|
|
224
|
+
}>, Schema.Struct<{
|
|
225
|
+
readonly uri: Schema.String;
|
|
226
|
+
readonly blob: Schema.String;
|
|
227
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
228
|
+
}>]>;
|
|
229
|
+
}>]>, Schema.Struct<{
|
|
230
|
+
readonly type: Schema.String;
|
|
231
|
+
}>]>;
|
|
232
|
+
type ContentBlock = typeof ContentBlock.Type;
|
|
132
233
|
declare const CallToolResult: Schema.Struct<{
|
|
133
|
-
readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Struct<{
|
|
234
|
+
readonly content: Schema.optionalKey<Schema.$Array<Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
134
235
|
readonly type: Schema.Literal<"text">;
|
|
135
236
|
readonly text: Schema.String;
|
|
136
237
|
}>, Schema.Struct<{
|
|
238
|
+
readonly type: Schema.Literal<"image">;
|
|
239
|
+
readonly data: Schema.String;
|
|
240
|
+
readonly mimeType: Schema.String;
|
|
241
|
+
}>, Schema.Struct<{
|
|
242
|
+
readonly type: Schema.Literal<"audio">;
|
|
243
|
+
readonly data: Schema.String;
|
|
244
|
+
readonly mimeType: Schema.String;
|
|
245
|
+
}>, Schema.Struct<{
|
|
246
|
+
readonly type: Schema.Literal<"resource_link">;
|
|
247
|
+
readonly uri: Schema.String;
|
|
248
|
+
readonly name: Schema.optional<Schema.String>;
|
|
249
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
250
|
+
}>, Schema.Struct<{
|
|
251
|
+
readonly type: Schema.Literal<"resource">;
|
|
252
|
+
readonly resource: Schema.Union<readonly [Schema.Struct<{
|
|
253
|
+
readonly uri: Schema.String;
|
|
254
|
+
readonly text: Schema.String;
|
|
255
|
+
}>, Schema.Struct<{
|
|
256
|
+
readonly uri: Schema.String;
|
|
257
|
+
readonly blob: Schema.String;
|
|
258
|
+
readonly mimeType: Schema.optional<Schema.String>;
|
|
259
|
+
}>]>;
|
|
260
|
+
}>]>, Schema.Struct<{
|
|
137
261
|
readonly type: Schema.String;
|
|
138
262
|
}>]>>>;
|
|
139
263
|
readonly isError: Schema.optional<Schema.Boolean>;
|
|
140
|
-
readonly structuredContent: Schema.optional<Schema.
|
|
264
|
+
readonly structuredContent: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
141
265
|
readonly resultType: Schema.optional<Schema.String>;
|
|
142
266
|
}>;
|
|
143
267
|
type CallToolResult = typeof CallToolResult.Type;
|
|
@@ -145,11 +269,34 @@ declare const decodeCallToolResult: (input: unknown, options?: import("effect/Sc
|
|
|
145
269
|
readonly content?: readonly ({
|
|
146
270
|
readonly type: "text";
|
|
147
271
|
readonly text: string;
|
|
272
|
+
} | {
|
|
273
|
+
readonly type: "image";
|
|
274
|
+
readonly data: string;
|
|
275
|
+
readonly mimeType: string;
|
|
276
|
+
} | {
|
|
277
|
+
readonly type: "audio";
|
|
278
|
+
readonly data: string;
|
|
279
|
+
readonly mimeType: string;
|
|
280
|
+
} | {
|
|
281
|
+
readonly type: "resource_link";
|
|
282
|
+
readonly uri: string;
|
|
283
|
+
readonly name?: string | undefined;
|
|
284
|
+
readonly mimeType?: string | undefined;
|
|
285
|
+
} | {
|
|
286
|
+
readonly type: "resource";
|
|
287
|
+
readonly resource: {
|
|
288
|
+
readonly uri: string;
|
|
289
|
+
readonly text: string;
|
|
290
|
+
} | {
|
|
291
|
+
readonly uri: string;
|
|
292
|
+
readonly blob: string;
|
|
293
|
+
readonly mimeType?: string | undefined;
|
|
294
|
+
};
|
|
148
295
|
} | {
|
|
149
296
|
readonly type: string;
|
|
150
297
|
})[];
|
|
151
298
|
readonly isError?: boolean | undefined;
|
|
152
|
-
readonly structuredContent?:
|
|
299
|
+
readonly structuredContent?: Schema.Json | undefined;
|
|
153
300
|
readonly resultType?: string | undefined;
|
|
154
301
|
}, Schema.SchemaError, never>;
|
|
155
302
|
declare const ServerInfo: Schema.Struct<{
|
|
@@ -241,5 +388,5 @@ declare const decodeInitializeResult: (input: unknown, options?: import("effect/
|
|
|
241
388
|
readonly instructions?: string | undefined;
|
|
242
389
|
}, Schema.SchemaError, never>;
|
|
243
390
|
//#endregion
|
|
244
|
-
export {
|
|
245
|
-
//# sourceMappingURL=schema-
|
|
391
|
+
export { ServerInfo as A, decodeUnsupportedVersionData as B, META_SERVER_INFO as C, ProtocolVersion as D, OtherContent as E, decodeCallToolResult as F, resultFrame as G, isKnownContent as H, decodeDiscoverResult as I, decodeInboundMessage as L, ToolInfo as M, UnsupportedVersionData as N, ResourceLink as O, asProtocolVersion as P, decodeInitializeResult as R, META_PROTOCOL_VERSION as S, McpMethod as T, notificationFrame as U, errorFrame as V, requestFrame as W, LATEST_VERSION as _, CODE_MISSING_CLIENT_CAPABILITY as a, META_CLIENT_CAPABILITIES as b, ContentBlock as c, ImageContent as d, InboundMessage as f, KnownContent as g, JsonRpcId as h, CODE_METHOD_NOT_FOUND as i, TextContent as j, ResultMeta as k, DiscoverResult as l, JsonRpcErrorObject as m, CLIENT_INFO as n, CODE_UNSUPPORTED_PROTOCOL_VERSION as o, InitializeResult as p, CODE_HEADER_MISMATCH as r, CallToolResult as s, AudioContent as t, EmbeddedResource as u, LEGACY_VERSION as v, MODERN_ERROR_CODES as w, META_CLIENT_INFO as x, ListToolsResult as y, decodeListToolsResult as z };
|
|
392
|
+
//# sourceMappingURL=schema-tDws3q4j.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-tDws3q4j.d.mts","names":[],"sources":["../src/internal/schema.ts"],"mappings":";;;cAaa,iBAAe,OAAA;KAChB,yBAAyB,gBAAgB;;cAGxC;;cAGA;;cAKA,oBAAiB,gBAAkB,OAAO,OAAO;;;;;;cAQjD,WAAS,OAAA;KAMV,mBAAmB,UAAU;;cAG5B;cACA;cACA;;cAEA;cAEA;EAAgB;EAAyB;;;cAGzC;cACA;cACA;cACA;;;;;cAMA,oBAAoB;cAUpB,WAAS,OAAA,gBAAA,OAAA,QAAA,OAAA;KACV,mBAAmB,UAAU;cAE5B,oBAAkB,OAAA;;;;;KAKnB,4BAA4B,mBAAmB;;;;;;cAO9C,gBAAc,OAAA;;;;;;;;;;;KASf,wBAAwB,eAAe;cAEtC,uBAAoB,gBAAA,qCAAA,yCAAA;;;;;;;;;;GAA6C,OAAA;cAIjE,eAAY,IAAQ,WAAS,gBAAgB;cAG7C,oBAAiB,gBAAk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BAAsB,gBAAA,qCAAA,yCAAA;;;;;;;;;;;GAA+C,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect-uai/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-dev-20261109183959",
|
|
4
4
|
"description": "Model Context Protocol client provider for @effect-uai/core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -53,14 +53,14 @@
|
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@effect/platform-node": "4.
|
|
57
|
-
"@effect/vitest": "4.
|
|
58
|
-
"effect": "4.
|
|
56
|
+
"@effect/platform-node": "4.1.2",
|
|
57
|
+
"@effect/vitest": "4.1.2",
|
|
58
|
+
"effect": "4.1.2",
|
|
59
59
|
"typescript": "^7.0.2",
|
|
60
|
-
"@effect-uai/core": "0.
|
|
60
|
+
"@effect-uai/core": "0.19.0-dev-20261109183959"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
|
-
"@effect-uai/core": "
|
|
63
|
+
"@effect-uai/core": "0.19.0-dev-20261109183959",
|
|
64
64
|
"effect": ">=4.0.1 <5.0.0"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { describe, expect, it } from "@effect/vitest"
|
|
2
|
+
import type { ToolCall } from "@effect-uai/core/Items"
|
|
3
|
+
import * as CoreToolkit from "@effect-uai/core/Toolkit"
|
|
4
|
+
import { Effect, Stream } from "effect"
|
|
5
|
+
import type { McpClient } from "./Client.js"
|
|
6
|
+
import { decodeCallToolResult } from "./internal/schema.js"
|
|
7
|
+
import { mcpToolkit } from "./Toolkit.js"
|
|
8
|
+
|
|
9
|
+
// A client whose `tools/call` results are raw wire JSON, decoded like the real one.
|
|
10
|
+
const clientReturning = (raw: unknown): McpClient => ({
|
|
11
|
+
serverInfo: { name: "fake", protocolVersion: "2026-07-28" },
|
|
12
|
+
listTools: Effect.succeed([{ name: "shot", inputSchema: { type: "object" } }]),
|
|
13
|
+
callTool: () => Effect.orDie(decodeCallToolResult(raw)),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const call: ToolCall = { type: "function_call", call_id: "c1", name: "shot", arguments: "{}" }
|
|
17
|
+
|
|
18
|
+
const historyOf = (raw: unknown) =>
|
|
19
|
+
Effect.gen(function* () {
|
|
20
|
+
const kit = yield* mcpToolkit(clientReturning(raw))
|
|
21
|
+
return yield* CoreToolkit.run(kit, [call]).pipe(
|
|
22
|
+
Stream.filter(CoreToolkit.isOutcome),
|
|
23
|
+
Stream.mapEffect(CoreToolkit.output(kit)),
|
|
24
|
+
Stream.runCollect,
|
|
25
|
+
)
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
describe("mcpToolkit", () => {
|
|
29
|
+
it.effect("keeps images, audio and resources as media parts instead of dropping them", () =>
|
|
30
|
+
Effect.gen(function* () {
|
|
31
|
+
const [item] = yield* historyOf({
|
|
32
|
+
content: [
|
|
33
|
+
{ type: "text", text: "Home page" },
|
|
34
|
+
{ type: "image", data: "AQID", mimeType: "image/png" },
|
|
35
|
+
{ type: "audio", data: "AAAA", mimeType: "audio/wav" },
|
|
36
|
+
{ type: "resource_link", uri: "https://x/a.pdf", name: "a.pdf" },
|
|
37
|
+
{ type: "resource", resource: { uri: "mem://n", text: "a note" } },
|
|
38
|
+
{ type: "hologram" },
|
|
39
|
+
],
|
|
40
|
+
})
|
|
41
|
+
expect(item?.output).toEqual([
|
|
42
|
+
{ type: "input_text", text: "Home page" },
|
|
43
|
+
{
|
|
44
|
+
type: "input_image",
|
|
45
|
+
source: { _tag: "base64", base64: "AQID", mimeType: "image/png" },
|
|
46
|
+
},
|
|
47
|
+
{ type: "input_file", source: { _tag: "base64", base64: "AAAA", mimeType: "audio/wav" } },
|
|
48
|
+
{ type: "input_file", source: { _tag: "url", url: "https://x/a.pdf" }, filename: "a.pdf" },
|
|
49
|
+
{ type: "input_text", text: "a note" },
|
|
50
|
+
{ type: "input_text", text: "[hologram content omitted]" },
|
|
51
|
+
])
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
it.effect("prefers structuredContent over its repeated text, keeping media", () =>
|
|
56
|
+
Effect.gen(function* () {
|
|
57
|
+
const [item] = yield* historyOf({
|
|
58
|
+
content: [
|
|
59
|
+
{ type: "text", text: '{"hits":2}' },
|
|
60
|
+
{ type: "image", data: "AQID", mimeType: "image/png" },
|
|
61
|
+
],
|
|
62
|
+
structuredContent: { hits: 2 },
|
|
63
|
+
})
|
|
64
|
+
expect(item?.output.map((p) => (p.type === "input_json" ? p.value : p.type))).toEqual([
|
|
65
|
+
{ hits: 2 },
|
|
66
|
+
"input_image",
|
|
67
|
+
])
|
|
68
|
+
}),
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
it.effect("turns isError into the declared McpToolFailed the model reads", () =>
|
|
72
|
+
Effect.gen(function* () {
|
|
73
|
+
const [item] = yield* historyOf({
|
|
74
|
+
content: [{ type: "text", text: "rate limited" }],
|
|
75
|
+
isError: true,
|
|
76
|
+
})
|
|
77
|
+
expect(item).toMatchObject({
|
|
78
|
+
isError: true,
|
|
79
|
+
output: [{ type: "input_json", value: { _tag: "McpToolFailed", message: "rate limited" } }],
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
)
|
|
83
|
+
})
|
package/src/Toolkit.ts
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Turn a connected MCP server into a core `Toolkit`, one
|
|
2
|
+
* Turn a connected MCP server into a core `Toolkit`, one local tool per MCP
|
|
3
3
|
* tool. Effectful because the tool list is fetched; composes with
|
|
4
4
|
* `Toolkit.compose` like any other kit.
|
|
5
5
|
*/
|
|
6
|
-
import { Effect, Option } from "effect"
|
|
6
|
+
import { Effect, Match, Option, Schema } from "effect"
|
|
7
|
+
import * as Content from "@effect-uai/core/Content"
|
|
8
|
+
import { fileBase64, fileUrl } from "@effect-uai/core/File"
|
|
9
|
+
import { imageBase64 } from "@effect-uai/core/Image"
|
|
7
10
|
import * as Tool from "@effect-uai/core/Tool"
|
|
8
11
|
import * as CoreToolkit from "@effect-uai/core/Toolkit"
|
|
12
|
+
import * as ToolOutput from "@effect-uai/core/ToolOutput"
|
|
9
13
|
import type { McpClient } from "./Client.js"
|
|
10
14
|
import { type McpError, McpProtocolError } from "./McpError.js"
|
|
11
15
|
import {
|
|
12
16
|
type CallToolResult,
|
|
13
17
|
type ContentBlock,
|
|
14
|
-
|
|
18
|
+
isKnownContent,
|
|
19
|
+
type KnownContent,
|
|
15
20
|
type ToolInfo,
|
|
16
21
|
} from "./internal/schema.js"
|
|
17
22
|
|
|
@@ -20,6 +25,11 @@ export type McpToolkitOptions = {
|
|
|
20
25
|
readonly prefix?: string
|
|
21
26
|
}
|
|
22
27
|
|
|
28
|
+
/** The server reported an error (`isError`); the model sees its content as `message`. */
|
|
29
|
+
export class McpToolFailed extends Schema.TaggedError<McpToolFailed>(
|
|
30
|
+
"@betalyra/effect-uai/mcp/McpToolFailed",
|
|
31
|
+
)("McpToolFailed", { message: Schema.String }) {}
|
|
32
|
+
|
|
23
33
|
/**
|
|
24
34
|
* The server owns validation, so the input schema is a passthrough: it carries
|
|
25
35
|
* the server's JSON Schema verbatim (the model sees the real thing) and
|
|
@@ -38,59 +48,80 @@ const passthroughSchema = (tool: ToolInfo): Tool.ToolInputSchema<unknown> => ({
|
|
|
38
48
|
},
|
|
39
49
|
})
|
|
40
50
|
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
// A blob without a MIME type is opaque bytes.
|
|
52
|
+
const knownValue = Match.type<KnownContent>().pipe(
|
|
53
|
+
Match.discriminatorsExhaustive("type")({
|
|
54
|
+
text: (b): string | Content.Media => b.text,
|
|
55
|
+
image: (b) => Content.image(imageBase64(b.data, b.mimeType)),
|
|
56
|
+
audio: (b) => Content.file(fileBase64(b.data, b.mimeType)),
|
|
57
|
+
resource_link: (b) => Content.file(fileUrl(b.uri, b.mimeType), b.name),
|
|
58
|
+
resource: ({ resource }) =>
|
|
59
|
+
"text" in resource
|
|
60
|
+
? resource.text
|
|
61
|
+
: Content.file(fileBase64(resource.blob, resource.mimeType ?? "application/octet-stream")),
|
|
62
|
+
}),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
const valueOf = (block: ContentBlock): string | Content.Media =>
|
|
66
|
+
isKnownContent(block) ? knownValue(block) : `[${block.type} content omitted]`
|
|
43
67
|
|
|
44
68
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* a short placeholder until the loop grows a multimodal tool-output path.
|
|
69
|
+
* A result as the tool's value: `structuredContent` when the server provides it
|
|
70
|
+
* (its text blocks usually repeat it), plus any media; otherwise every block.
|
|
48
71
|
*/
|
|
49
|
-
const outputOf = (result: CallToolResult):
|
|
50
|
-
|
|
72
|
+
const outputOf = (result: CallToolResult): Content.Value => {
|
|
73
|
+
const values: ReadonlyArray<Schema.Json | Content.Media> = (result.content ?? []).map(valueOf)
|
|
74
|
+
return Option.match(Option.fromNullishOr(result.structuredContent), {
|
|
75
|
+
onNone: () => ToolOutput.single(values),
|
|
76
|
+
onSome: (structured) => ToolOutput.single([structured, ...values.filter(Content.isMedia)]),
|
|
77
|
+
})
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const messageOf = (result: CallToolResult): string =>
|
|
81
|
+
(result.content ?? [])
|
|
82
|
+
.map(valueOf)
|
|
83
|
+
.filter((v): v is string => typeof v === "string")
|
|
84
|
+
.join("\n")
|
|
51
85
|
|
|
52
86
|
/**
|
|
53
87
|
* Two failure channels, deliberately: `isError` is the server telling the
|
|
54
|
-
* model it went wrong, so it becomes
|
|
88
|
+
* model it went wrong, so it becomes the declared `McpToolFailed`; an
|
|
55
89
|
* `input_required` result is a protocol capability gap the model cannot fix,
|
|
56
|
-
* so it stays a typed `McpError
|
|
90
|
+
* so it stays a typed `McpError` and fails the run.
|
|
57
91
|
*/
|
|
58
92
|
const interpret = (
|
|
59
93
|
name: string,
|
|
60
94
|
result: CallToolResult,
|
|
61
|
-
): Effect.Effect<
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const runTool =
|
|
77
|
-
(client: McpClient, name: string) =>
|
|
78
|
-
(input: unknown): Effect.Effect<unknown, McpError | Tool.ToolFailed> =>
|
|
79
|
-
client.callTool(name, input).pipe(Effect.flatMap((result) => interpret(name, result)))
|
|
95
|
+
): Effect.Effect<Content.Value, McpError | McpToolFailed> =>
|
|
96
|
+
Match.value(result).pipe(
|
|
97
|
+
Match.when({ isError: true }, (r) => Effect.fail(new McpToolFailed({ message: messageOf(r) }))),
|
|
98
|
+
Match.when({ resultType: "input_required" }, () =>
|
|
99
|
+
Effect.fail(
|
|
100
|
+
new McpProtocolError({
|
|
101
|
+
method: "tools/call",
|
|
102
|
+
reason: `${name} requires interactive input (MRTR), unsupported by this client`,
|
|
103
|
+
}),
|
|
104
|
+
),
|
|
105
|
+
),
|
|
106
|
+
Match.orElse((r) => Effect.succeed(outputOf(r))),
|
|
107
|
+
)
|
|
80
108
|
|
|
81
109
|
const toLocalTool = (client: McpClient, info: ToolInfo) =>
|
|
82
110
|
Tool.make({
|
|
83
111
|
name: info.name,
|
|
84
112
|
description: info.description ?? info.name,
|
|
85
113
|
inputSchema: passthroughSchema(info),
|
|
86
|
-
|
|
114
|
+
// Known only at runtime: any mix of text, JSON and media.
|
|
115
|
+
outputSchema: Content.Value,
|
|
116
|
+
failureSchema: McpToolFailed,
|
|
117
|
+
run: (input) =>
|
|
118
|
+
client.callTool(info.name, input).pipe(Effect.flatMap((r) => interpret(info.name, r))),
|
|
87
119
|
strict: false,
|
|
88
120
|
})
|
|
89
121
|
|
|
90
122
|
/**
|
|
91
123
|
* Build a `Toolkit` from the server's advertised tools. The list is snapshotted
|
|
92
|
-
* here; a tool that later vanishes surfaces
|
|
93
|
-
* `unknown_tool` path.
|
|
124
|
+
* here; a tool that later vanishes surfaces as `Toolkit.run`'s `UnknownTool`.
|
|
94
125
|
*/
|
|
95
126
|
export const mcpToolkit = (
|
|
96
127
|
client: McpClient,
|
package/src/internal/schema.ts
CHANGED
|
@@ -145,20 +145,59 @@ export const TextContent = Schema.Struct({
|
|
|
145
145
|
})
|
|
146
146
|
export type TextContent = typeof TextContent.Type
|
|
147
147
|
|
|
148
|
-
|
|
148
|
+
export const ImageContent = Schema.Struct({
|
|
149
|
+
type: Schema.Literal("image"),
|
|
150
|
+
data: Schema.String,
|
|
151
|
+
mimeType: Schema.String,
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
export const AudioContent = Schema.Struct({
|
|
155
|
+
type: Schema.Literal("audio"),
|
|
156
|
+
data: Schema.String,
|
|
157
|
+
mimeType: Schema.String,
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
export const ResourceLink = Schema.Struct({
|
|
161
|
+
type: Schema.Literal("resource_link"),
|
|
162
|
+
uri: Schema.String,
|
|
163
|
+
name: Schema.optional(Schema.String),
|
|
164
|
+
mimeType: Schema.optional(Schema.String),
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
export const EmbeddedResource = Schema.Struct({
|
|
168
|
+
type: Schema.Literal("resource"),
|
|
169
|
+
resource: Schema.Union([
|
|
170
|
+
Schema.Struct({ uri: Schema.String, text: Schema.String }),
|
|
171
|
+
Schema.Struct({
|
|
172
|
+
uri: Schema.String,
|
|
173
|
+
blob: Schema.String,
|
|
174
|
+
mimeType: Schema.optional(Schema.String),
|
|
175
|
+
}),
|
|
176
|
+
]),
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
/** A block type this client does not know; summarized for the model. */
|
|
149
180
|
export const OtherContent = Schema.Struct({
|
|
150
181
|
type: Schema.String,
|
|
151
182
|
})
|
|
152
183
|
|
|
153
|
-
export const
|
|
154
|
-
|
|
184
|
+
export const KnownContent = Schema.Union([
|
|
185
|
+
TextContent,
|
|
186
|
+
ImageContent,
|
|
187
|
+
AudioContent,
|
|
188
|
+
ResourceLink,
|
|
189
|
+
EmbeddedResource,
|
|
190
|
+
])
|
|
191
|
+
export type KnownContent = typeof KnownContent.Type
|
|
192
|
+
export const isKnownContent = Schema.is(KnownContent)
|
|
155
193
|
|
|
156
|
-
export const
|
|
194
|
+
export const ContentBlock = Schema.Union([KnownContent, OtherContent])
|
|
195
|
+
export type ContentBlock = typeof ContentBlock.Type
|
|
157
196
|
|
|
158
197
|
export const CallToolResult = Schema.Struct({
|
|
159
198
|
content: Schema.optionalKey(Schema.Array(ContentBlock)),
|
|
160
199
|
isError: Schema.optional(Schema.Boolean),
|
|
161
|
-
structuredContent: Schema.optional(Schema.
|
|
200
|
+
structuredContent: Schema.optional(Schema.Json),
|
|
162
201
|
// Required on modern results; absent on legacy ones.
|
|
163
202
|
resultType: Schema.optional(Schema.String),
|
|
164
203
|
})
|
package/dist/auth-ZDvsxpCo.d.mts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { t as McpAuthError } from "./McpError-DWg9BlW5.mjs";
|
|
2
|
-
import { Data, Effect, Option, Redacted } from "effect";
|
|
3
|
-
//#region src/internal/auth.d.ts
|
|
4
|
-
/**
|
|
5
|
-
* An Effect yielding a bearer token. Any external OAuth, vault, or secret
|
|
6
|
-
* manager plugs in here. Read per request, so a producer minting expensive
|
|
7
|
-
* tokens caches internally (as `OAuth.clientCredentials` does).
|
|
8
|
-
*/
|
|
9
|
-
type TokenSource = Effect.Effect<Redacted.Redacted<string>, McpAuthError>;
|
|
10
|
-
type Auth = Data.TaggedEnum<{
|
|
11
|
-
/** A fixed token: the turnkey case for a token-gated server. */
|
|
12
|
-
Static: {
|
|
13
|
-
readonly token: Redacted.Redacted<string>;
|
|
14
|
-
readonly scheme?: string;
|
|
15
|
-
};
|
|
16
|
-
/** Bring your own, re-read before every request. */
|
|
17
|
-
TokenSource: {
|
|
18
|
-
readonly token: TokenSource;
|
|
19
|
-
readonly scheme?: string;
|
|
20
|
-
};
|
|
21
|
-
/** Built-in OAuth 2.1, which produces a `TokenSource` and rides the same seam. */
|
|
22
|
-
OAuth: {
|
|
23
|
-
readonly source: TokenSource;
|
|
24
|
-
readonly scheme?: string;
|
|
25
|
-
};
|
|
26
|
-
}>;
|
|
27
|
-
declare const Auth: {
|
|
28
|
-
readonly $is: <Tag extends "OAuth" | "Static" | "TokenSource">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
29
|
-
readonly _tag: "OAuth";
|
|
30
|
-
readonly source: TokenSource;
|
|
31
|
-
readonly scheme?: string;
|
|
32
|
-
}, {
|
|
33
|
-
readonly _tag: Tag;
|
|
34
|
-
}> | Extract<{
|
|
35
|
-
readonly _tag: "Static";
|
|
36
|
-
readonly token: Redacted.Redacted<string>;
|
|
37
|
-
readonly scheme?: string;
|
|
38
|
-
}, {
|
|
39
|
-
readonly _tag: Tag;
|
|
40
|
-
}> | Extract<{
|
|
41
|
-
readonly _tag: "TokenSource";
|
|
42
|
-
readonly token: TokenSource;
|
|
43
|
-
readonly scheme?: string;
|
|
44
|
-
}, {
|
|
45
|
-
readonly _tag: Tag;
|
|
46
|
-
}>;
|
|
47
|
-
readonly $match: {
|
|
48
|
-
<Cases extends { readonly [Tag in "OAuth" | "Static" | "TokenSource"]: (args: Extract<{
|
|
49
|
-
readonly _tag: "OAuth";
|
|
50
|
-
readonly source: TokenSource;
|
|
51
|
-
readonly scheme?: string;
|
|
52
|
-
} | {
|
|
53
|
-
readonly _tag: "Static";
|
|
54
|
-
readonly token: Redacted.Redacted<string>;
|
|
55
|
-
readonly scheme?: string;
|
|
56
|
-
} | {
|
|
57
|
-
readonly _tag: "TokenSource";
|
|
58
|
-
readonly token: TokenSource;
|
|
59
|
-
readonly scheme?: string;
|
|
60
|
-
}, {
|
|
61
|
-
readonly _tag: Tag;
|
|
62
|
-
}>) => any; }>(cases: Cases): (value: {
|
|
63
|
-
readonly _tag: "OAuth";
|
|
64
|
-
readonly source: TokenSource;
|
|
65
|
-
readonly scheme?: string;
|
|
66
|
-
} | {
|
|
67
|
-
readonly _tag: "Static";
|
|
68
|
-
readonly token: Redacted.Redacted<string>;
|
|
69
|
-
readonly scheme?: string;
|
|
70
|
-
} | {
|
|
71
|
-
readonly _tag: "TokenSource";
|
|
72
|
-
readonly token: TokenSource;
|
|
73
|
-
readonly scheme?: string;
|
|
74
|
-
}) => import("effect/Unify").Unify<ReturnType<Cases["OAuth" | "Static" | "TokenSource"]>>;
|
|
75
|
-
<Cases extends { readonly [Tag in "OAuth" | "Static" | "TokenSource"]: (args: Extract<{
|
|
76
|
-
readonly _tag: "OAuth";
|
|
77
|
-
readonly source: TokenSource;
|
|
78
|
-
readonly scheme?: string;
|
|
79
|
-
} | {
|
|
80
|
-
readonly _tag: "Static";
|
|
81
|
-
readonly token: Redacted.Redacted<string>;
|
|
82
|
-
readonly scheme?: string;
|
|
83
|
-
} | {
|
|
84
|
-
readonly _tag: "TokenSource";
|
|
85
|
-
readonly token: TokenSource;
|
|
86
|
-
readonly scheme?: string;
|
|
87
|
-
}, {
|
|
88
|
-
readonly _tag: Tag;
|
|
89
|
-
}>) => any; }>(value: {
|
|
90
|
-
readonly _tag: "OAuth";
|
|
91
|
-
readonly source: TokenSource;
|
|
92
|
-
readonly scheme?: string;
|
|
93
|
-
} | {
|
|
94
|
-
readonly _tag: "Static";
|
|
95
|
-
readonly token: Redacted.Redacted<string>;
|
|
96
|
-
readonly scheme?: string;
|
|
97
|
-
} | {
|
|
98
|
-
readonly _tag: "TokenSource";
|
|
99
|
-
readonly token: TokenSource;
|
|
100
|
-
readonly scheme?: string;
|
|
101
|
-
}, cases: Cases): import("effect/Unify").Unify<ReturnType<Cases["OAuth" | "Static" | "TokenSource"]>>;
|
|
102
|
-
};
|
|
103
|
-
readonly OAuth: Data.TaggedEnum.ConstructorFrom<{
|
|
104
|
-
readonly _tag: "OAuth";
|
|
105
|
-
readonly source: TokenSource;
|
|
106
|
-
readonly scheme?: string;
|
|
107
|
-
}, "_tag">;
|
|
108
|
-
readonly Static: Data.TaggedEnum.ConstructorFrom<{
|
|
109
|
-
readonly _tag: "Static";
|
|
110
|
-
readonly token: Redacted.Redacted<string>;
|
|
111
|
-
readonly scheme?: string;
|
|
112
|
-
}, "_tag">;
|
|
113
|
-
readonly TokenSource: Data.TaggedEnum.ConstructorFrom<{
|
|
114
|
-
readonly _tag: "TokenSource";
|
|
115
|
-
readonly token: TokenSource;
|
|
116
|
-
readonly scheme?: string;
|
|
117
|
-
}, "_tag">;
|
|
118
|
-
};
|
|
119
|
-
/**
|
|
120
|
-
* The `Authorization` header for one request, or none for a public server.
|
|
121
|
-
* `Redacted.value` is unwrapped only here.
|
|
122
|
-
*/
|
|
123
|
-
declare const authHeaders: (auth: Option.Option<Auth>) => Effect.Effect<Record<string, string>, McpAuthError>;
|
|
124
|
-
//#endregion
|
|
125
|
-
export { TokenSource as n, authHeaders as r, Auth as t };
|
|
126
|
-
//# sourceMappingURL=auth-ZDvsxpCo.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth-ZDvsxpCo.d.mts","names":[],"sources":["../src/internal/auth.ts"],"mappings":";;;;;;;;KAaY,cAAc,OAAO,OAAO,SAAS,kBAAkB;KAEvD,OAAO,KAAK;;EAEtB;aAAmB,OAAO,SAAS;aAA2B;;;EAE9D;aAAwB,OAAO;aAAsB;;;EAErD;aAAkB,QAAQ;aAAsB;;;cAGrC;;;aAHe,QAAA;aAA+B;;;;;aAJ/B,OAAA,SAAS;aAAoC;;;;;aAExC,OAAA;aAA+B;;;;;;;eAEpC,QAAA;eAA+B;;;eAJ/B,OAAA,SAAS;eAAoC;;;eAExC,OAAA;eAA+B;;;;;;;;;;;;;;;;;;eAEpC,QAAA;eAA+B;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