@executor-js/plugin-mcp 0.1.0 → 1.4.20
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/AddMcpSource-TLAL463B.js +762 -0
- package/dist/AddMcpSource-TLAL463B.js.map +1 -0
- package/dist/EditMcpSource-CWN6HIC4.js +259 -0
- package/dist/EditMcpSource-CWN6HIC4.js.map +1 -0
- package/dist/McpSourceSummary-257JNETP.js +85 -0
- package/dist/McpSourceSummary-257JNETP.js.map +1 -0
- package/dist/api/group.d.ts +183 -19
- package/dist/api/index.d.ts +501 -0
- package/dist/chunk-4ORPFRLI.js +238 -0
- package/dist/chunk-4ORPFRLI.js.map +1 -0
- package/dist/chunk-M6REVU6O.js +179 -0
- package/dist/chunk-M6REVU6O.js.map +1 -0
- package/dist/chunk-NQT7NAGE.js +2277 -0
- package/dist/chunk-NQT7NAGE.js.map +1 -0
- package/dist/chunk-SKSXXFOA.js +104 -0
- package/dist/chunk-SKSXXFOA.js.map +1 -0
- package/dist/chunk-ZIRGIRGP.js +115 -0
- package/dist/chunk-ZIRGIRGP.js.map +1 -0
- package/dist/client.js +51 -0
- package/dist/client.js.map +1 -0
- package/dist/core.js +26 -2
- package/dist/index.js +2 -1
- package/dist/react/McpRemoteSourceFields.d.ts +18 -0
- package/dist/react/McpSourceSummary.d.ts +5 -0
- package/dist/react/atoms.d.ts +286 -6
- package/dist/react/client.d.ts +187 -16
- package/dist/react/index.d.ts +1 -1
- package/dist/react/plugin-client.d.ts +9 -2
- package/dist/sdk/binding-store.d.ts +106 -1
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/invoke.d.ts +2 -0
- package/dist/sdk/plugin.d.ts +178 -114
- package/dist/sdk/probe-shape-real-servers.live.test.d.ts +1 -0
- package/dist/sdk/probe-shape.d.ts +17 -3
- package/dist/sdk/stored-source.d.ts +12 -11
- package/dist/sdk/types.d.ts +122 -17
- package/dist/{stdio-connector-KNHLETKM.js → stdio-connector-AA5S6UUJ.js} +1 -1
- package/dist/{stdio-connector-KNHLETKM.js.map → stdio-connector-AA5S6UUJ.js.map} +1 -1
- package/dist/testing/index.d.ts +1 -0
- package/dist/{sdk/test-utils.d.ts → testing/server.d.ts} +0 -6
- package/dist/testing.js +51 -0
- package/dist/testing.js.map +1 -0
- package/package.json +17 -4
- package/dist/chunk-C2GNZGFJ.js +0 -1622
- package/dist/chunk-C2GNZGFJ.js.map +0 -1
package/dist/sdk/types.d.ts
CHANGED
|
@@ -6,23 +6,125 @@ export type McpRemoteTransport = typeof McpRemoteTransport.Type;
|
|
|
6
6
|
/** All transport types (used in the connector layer) */
|
|
7
7
|
export declare const McpTransport: Schema.Literals<readonly ["streamable-http", "sse", "stdio", "auto"]>;
|
|
8
8
|
export type McpTransport = typeof McpTransport.Type;
|
|
9
|
+
export declare const ConfiguredMcpCredentialValue: Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
10
|
+
readonly kind: Schema.Literal<"binding">;
|
|
11
|
+
readonly slot: Schema.String;
|
|
12
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
13
|
+
}>]>;
|
|
14
|
+
export type ConfiguredMcpCredentialValue = typeof ConfiguredMcpCredentialValue.Type;
|
|
15
|
+
export declare const McpCredentialInput: Schema.Union<readonly [Schema.Struct<{
|
|
16
|
+
readonly secretId: Schema.String;
|
|
17
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
18
|
+
readonly targetScope: Schema.brand<Schema.String, "ScopeId">;
|
|
19
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
20
|
+
}>, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
21
|
+
readonly secretId: Schema.String;
|
|
22
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
23
|
+
}>]>, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
24
|
+
readonly kind: Schema.Literal<"binding">;
|
|
25
|
+
readonly slot: Schema.String;
|
|
26
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
27
|
+
}>]>]>;
|
|
28
|
+
export type McpCredentialInput = typeof McpCredentialInput.Type;
|
|
29
|
+
export declare const mcpHeaderSlot: (name: string) => string;
|
|
30
|
+
export declare const mcpQueryParamSlot: (name: string) => string;
|
|
31
|
+
export declare const MCP_HEADER_AUTH_SLOT = "auth:header";
|
|
32
|
+
export declare const MCP_OAUTH_CONNECTION_SLOT = "auth:oauth2:connection";
|
|
33
|
+
export declare const MCP_OAUTH_CLIENT_ID_SLOT = "auth:oauth2:client-id";
|
|
34
|
+
export declare const MCP_OAUTH_CLIENT_SECRET_SLOT = "auth:oauth2:client-secret";
|
|
9
35
|
/** JSON object loosely typed — used for opaque OAuth state we just round-trip. */
|
|
10
36
|
declare const JsonObject: Schema.$Record<Schema.String, Schema.Unknown>;
|
|
11
37
|
export { JsonObject as McpJsonObject };
|
|
12
38
|
export declare const McpConnectionAuth: Schema.Union<readonly [Schema.Struct<{
|
|
13
39
|
readonly kind: Schema.Literal<"none">;
|
|
14
40
|
}>, Schema.Struct<{
|
|
41
|
+
readonly kind: Schema.Literal<"header">;
|
|
42
|
+
readonly headerName: Schema.String;
|
|
43
|
+
readonly secretSlot: Schema.String;
|
|
44
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
45
|
+
}>, Schema.Struct<{
|
|
46
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
47
|
+
readonly connectionSlot: Schema.String;
|
|
48
|
+
readonly clientIdSlot: Schema.optional<Schema.String>;
|
|
49
|
+
readonly clientSecretSlot: Schema.optional<Schema.String>;
|
|
50
|
+
}>]>;
|
|
51
|
+
export type McpConnectionAuth = typeof McpConnectionAuth.Type;
|
|
52
|
+
export declare const McpConnectionAuthInput: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
53
|
+
readonly kind: Schema.Literal<"none">;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
readonly kind: Schema.Literal<"header">;
|
|
56
|
+
readonly headerName: Schema.String;
|
|
57
|
+
readonly secretSlot: Schema.String;
|
|
58
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
59
|
+
}>, Schema.Struct<{
|
|
60
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
61
|
+
readonly connectionSlot: Schema.String;
|
|
62
|
+
readonly clientIdSlot: Schema.optional<Schema.String>;
|
|
63
|
+
readonly clientSecretSlot: Schema.optional<Schema.String>;
|
|
64
|
+
}>]>, Schema.Struct<{
|
|
15
65
|
readonly kind: Schema.Literal<"header">;
|
|
16
66
|
readonly headerName: Schema.String;
|
|
17
67
|
readonly secretId: Schema.String;
|
|
18
68
|
readonly prefix: Schema.optional<Schema.String>;
|
|
69
|
+
readonly targetScope: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
70
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
19
71
|
}>, Schema.Struct<{
|
|
20
72
|
readonly kind: Schema.Literal<"oauth2">;
|
|
21
73
|
readonly connectionId: Schema.String;
|
|
22
74
|
readonly clientIdSecretId: Schema.optional<Schema.String>;
|
|
23
75
|
readonly clientSecretSecretId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
24
76
|
}>]>;
|
|
25
|
-
export type
|
|
77
|
+
export type McpConnectionAuthInput = typeof McpConnectionAuthInput.Type;
|
|
78
|
+
export declare const McpSourceBindingValue: Schema.Union<readonly [Schema.Struct<{
|
|
79
|
+
readonly kind: Schema.Literal<"text">;
|
|
80
|
+
readonly text: Schema.String;
|
|
81
|
+
}>, Schema.Struct<{
|
|
82
|
+
readonly kind: Schema.Literal<"secret">;
|
|
83
|
+
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
84
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
85
|
+
}>, Schema.Struct<{
|
|
86
|
+
readonly kind: Schema.Literal<"connection">;
|
|
87
|
+
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
88
|
+
}>]>;
|
|
89
|
+
export type McpSourceBindingValue = typeof McpSourceBindingValue.Type;
|
|
90
|
+
export declare const McpSourceBindingInput: Schema.Struct<{
|
|
91
|
+
readonly sourceId: Schema.String;
|
|
92
|
+
readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
|
|
93
|
+
readonly scope: Schema.brand<Schema.String, "ScopeId">;
|
|
94
|
+
readonly slot: Schema.String;
|
|
95
|
+
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
96
|
+
readonly kind: Schema.Literal<"text">;
|
|
97
|
+
readonly text: Schema.String;
|
|
98
|
+
}>, Schema.Struct<{
|
|
99
|
+
readonly kind: Schema.Literal<"secret">;
|
|
100
|
+
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
101
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
102
|
+
}>, Schema.Struct<{
|
|
103
|
+
readonly kind: Schema.Literal<"connection">;
|
|
104
|
+
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
105
|
+
}>]>;
|
|
106
|
+
}>;
|
|
107
|
+
export type McpSourceBindingInput = typeof McpSourceBindingInput.Type;
|
|
108
|
+
export declare const McpSourceBindingRef: Schema.Struct<{
|
|
109
|
+
readonly sourceId: Schema.String;
|
|
110
|
+
readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
111
|
+
readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
|
|
112
|
+
readonly slot: Schema.String;
|
|
113
|
+
readonly value: Schema.Union<readonly [Schema.Struct<{
|
|
114
|
+
readonly kind: Schema.Literal<"text">;
|
|
115
|
+
readonly text: Schema.String;
|
|
116
|
+
}>, Schema.Struct<{
|
|
117
|
+
readonly kind: Schema.Literal<"secret">;
|
|
118
|
+
readonly secretId: Schema.brand<Schema.String, "SecretId">;
|
|
119
|
+
readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
|
|
120
|
+
}>, Schema.Struct<{
|
|
121
|
+
readonly kind: Schema.Literal<"connection">;
|
|
122
|
+
readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
|
|
123
|
+
}>]>;
|
|
124
|
+
readonly createdAt: Schema.Date;
|
|
125
|
+
readonly updatedAt: Schema.Date;
|
|
126
|
+
}>;
|
|
127
|
+
export type McpSourceBindingRef = typeof McpSourceBindingRef.Type;
|
|
26
128
|
export declare const McpRemoteSourceData: Schema.Struct<{
|
|
27
129
|
readonly transport: Schema.Literal<"remote">;
|
|
28
130
|
/** The MCP server endpoint URL */
|
|
@@ -31,12 +133,14 @@ export declare const McpRemoteSourceData: Schema.Struct<{
|
|
|
31
133
|
readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
|
|
32
134
|
/** Extra query params appended to the endpoint URL */
|
|
33
135
|
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
34
|
-
readonly
|
|
136
|
+
readonly kind: Schema.Literal<"binding">;
|
|
137
|
+
readonly slot: Schema.String;
|
|
35
138
|
readonly prefix: Schema.optional<Schema.String>;
|
|
36
139
|
}>]>>>;
|
|
37
140
|
/** Extra headers sent on every request */
|
|
38
141
|
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
39
|
-
readonly
|
|
142
|
+
readonly kind: Schema.Literal<"binding">;
|
|
143
|
+
readonly slot: Schema.String;
|
|
40
144
|
readonly prefix: Schema.optional<Schema.String>;
|
|
41
145
|
}>]>>>;
|
|
42
146
|
/** Auth configuration */
|
|
@@ -45,13 +149,13 @@ export declare const McpRemoteSourceData: Schema.Struct<{
|
|
|
45
149
|
}>, Schema.Struct<{
|
|
46
150
|
readonly kind: Schema.Literal<"header">;
|
|
47
151
|
readonly headerName: Schema.String;
|
|
48
|
-
readonly
|
|
152
|
+
readonly secretSlot: Schema.String;
|
|
49
153
|
readonly prefix: Schema.optional<Schema.String>;
|
|
50
154
|
}>, Schema.Struct<{
|
|
51
155
|
readonly kind: Schema.Literal<"oauth2">;
|
|
52
|
-
readonly
|
|
53
|
-
readonly
|
|
54
|
-
readonly
|
|
156
|
+
readonly connectionSlot: Schema.String;
|
|
157
|
+
readonly clientIdSlot: Schema.optional<Schema.String>;
|
|
158
|
+
readonly clientSecretSlot: Schema.optional<Schema.String>;
|
|
55
159
|
}>]>;
|
|
56
160
|
}>;
|
|
57
161
|
export type McpRemoteSourceData = typeof McpRemoteSourceData.Type;
|
|
@@ -75,12 +179,14 @@ export declare const McpStoredSourceData: Schema.Union<readonly [Schema.Struct<{
|
|
|
75
179
|
readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
|
|
76
180
|
/** Extra query params appended to the endpoint URL */
|
|
77
181
|
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
78
|
-
readonly
|
|
182
|
+
readonly kind: Schema.Literal<"binding">;
|
|
183
|
+
readonly slot: Schema.String;
|
|
79
184
|
readonly prefix: Schema.optional<Schema.String>;
|
|
80
185
|
}>]>>>;
|
|
81
186
|
/** Extra headers sent on every request */
|
|
82
187
|
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
83
|
-
readonly
|
|
188
|
+
readonly kind: Schema.Literal<"binding">;
|
|
189
|
+
readonly slot: Schema.String;
|
|
84
190
|
readonly prefix: Schema.optional<Schema.String>;
|
|
85
191
|
}>]>>>;
|
|
86
192
|
/** Auth configuration */
|
|
@@ -89,13 +195,13 @@ export declare const McpStoredSourceData: Schema.Union<readonly [Schema.Struct<{
|
|
|
89
195
|
}>, Schema.Struct<{
|
|
90
196
|
readonly kind: Schema.Literal<"header">;
|
|
91
197
|
readonly headerName: Schema.String;
|
|
92
|
-
readonly
|
|
198
|
+
readonly secretSlot: Schema.String;
|
|
93
199
|
readonly prefix: Schema.optional<Schema.String>;
|
|
94
200
|
}>, Schema.Struct<{
|
|
95
201
|
readonly kind: Schema.Literal<"oauth2">;
|
|
96
|
-
readonly
|
|
97
|
-
readonly
|
|
98
|
-
readonly
|
|
202
|
+
readonly connectionSlot: Schema.String;
|
|
203
|
+
readonly clientIdSlot: Schema.optional<Schema.String>;
|
|
204
|
+
readonly clientSecretSlot: Schema.optional<Schema.String>;
|
|
99
205
|
}>]>;
|
|
100
206
|
}>, Schema.Struct<{
|
|
101
207
|
readonly transport: Schema.Literal<"stdio">;
|
|
@@ -117,7 +223,7 @@ export declare const McpToolAnnotations: Schema.Struct<{
|
|
|
117
223
|
readonly openWorldHint: Schema.optional<Schema.Boolean>;
|
|
118
224
|
}>;
|
|
119
225
|
export type McpToolAnnotations = typeof McpToolAnnotations.Type;
|
|
120
|
-
declare const
|
|
226
|
+
export declare const McpToolBinding: Schema.Struct<{
|
|
121
227
|
readonly toolId: Schema.String;
|
|
122
228
|
readonly toolName: Schema.String;
|
|
123
229
|
readonly description: Schema.NullOr<Schema.String>;
|
|
@@ -130,6 +236,5 @@ declare const McpToolBinding_base: Schema.Class<McpToolBinding, Schema.Struct<{
|
|
|
130
236
|
readonly idempotentHint: Schema.optional<Schema.Boolean>;
|
|
131
237
|
readonly openWorldHint: Schema.optional<Schema.Boolean>;
|
|
132
238
|
}>>;
|
|
133
|
-
}
|
|
134
|
-
export
|
|
135
|
-
}
|
|
239
|
+
}>;
|
|
240
|
+
export type McpToolBinding = typeof McpToolBinding.Type;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/sdk/stdio-connector.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Stdio transport factory — loaded only on demand\n// ---------------------------------------------------------------------------\n//\n// Kept in its own module so `connection.ts` never imports it eagerly at\n// module load. `@modelcontextprotocol/sdk/client/stdio.js` pulls in\n// `node:child_process` at evaluation time; under `@cloudflare/vitest-pool-workers`\n// that crashes workerd at module instantiation with SIGSEGV (prod bundles\n// tree-shake it away when `dangerouslyAllowStdioMCP: false`, tests do not).\n//\n// Callers that actually need stdio transport reach it via a dynamic import\n// in `connection.ts`. Remote-only consumers (cloud/marketing) never execute\n// the import and therefore never touch `node:child_process`.\n// ---------------------------------------------------------------------------\n\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\n\nexport type StdioTransportConfig = {\n readonly command: string;\n readonly args?: ReadonlyArray<string>;\n readonly env?: Record<string, string>;\n readonly cwd?: string;\n};\n\nexport const createStdioTransport = (config: StdioTransportConfig) =>\n new StdioClientTransport({\n command: config.command,\n args: config.args ? [...config.args] : undefined,\n env: config.env
|
|
1
|
+
{"version":3,"sources":["../src/sdk/stdio-connector.ts"],"sourcesContent":["// ---------------------------------------------------------------------------\n// Stdio transport factory — loaded only on demand\n// ---------------------------------------------------------------------------\n//\n// Kept in its own module so `connection.ts` never imports it eagerly at\n// module load. `@modelcontextprotocol/sdk/client/stdio.js` pulls in\n// `node:child_process` at evaluation time; under `@cloudflare/vitest-pool-workers`\n// that crashes workerd at module instantiation with SIGSEGV (prod bundles\n// tree-shake it away when `dangerouslyAllowStdioMCP: false`, tests do not).\n//\n// Callers that actually need stdio transport reach it via a dynamic import\n// in `connection.ts`. Remote-only consumers (cloud/marketing) never execute\n// the import and therefore never touch `node:child_process`.\n// ---------------------------------------------------------------------------\n\nimport { StdioClientTransport } from \"@modelcontextprotocol/sdk/client/stdio.js\";\n\nexport type StdioTransportConfig = {\n readonly command: string;\n readonly args?: ReadonlyArray<string>;\n readonly env?: Record<string, string>;\n readonly cwd?: string;\n};\n\nexport const createStdioTransport = (config: StdioTransportConfig) =>\n new StdioClientTransport({\n command: config.command,\n args: config.args ? [...config.args] : undefined,\n env: config.env ? ({ ...process.env, ...config.env } as Record<string, string>) : undefined,\n cwd: config.cwd,\n });\n"],"mappings":";AAeA,SAAS,4BAA4B;AAS9B,IAAM,uBAAuB,CAAC,WACnC,IAAI,qBAAqB;AAAA,EACvB,SAAS,OAAO;AAAA,EAChB,MAAM,OAAO,OAAO,CAAC,GAAG,OAAO,IAAI,IAAI;AAAA,EACvC,KAAK,OAAO,MAAO,EAAE,GAAG,QAAQ,KAAK,GAAG,OAAO,IAAI,IAA+B;AAAA,EAClF,KAAK,OAAO;AACd,CAAC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { serveMcpServer, type McpTestServer } from "./server";
|
|
@@ -7,10 +7,4 @@ export type McpTestServer = {
|
|
|
7
7
|
/** Number of MCP sessions created (each connect = 1 session) */
|
|
8
8
|
readonly sessionCount: () => number;
|
|
9
9
|
};
|
|
10
|
-
/**
|
|
11
|
-
* Spin up a real HTTP server backed by a fresh `McpServer` per session,
|
|
12
|
-
* with proper session routing via `mcp-session-id`. The factory is invoked
|
|
13
|
-
* once per new session, so tools registered inside it are isolated per
|
|
14
|
-
* connection (matching the SDK's own server/transport coupling).
|
|
15
|
-
*/
|
|
16
10
|
export declare const serveMcpServer: (factory: () => McpServer) => Effect.Effect<McpTestServer, Error, import("effect/Scope").Scope>;
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// src/testing/server.ts
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import * as http from "http";
|
|
4
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
5
|
+
var serveMcpServer = (factory) => Effect.acquireRelease(
|
|
6
|
+
Effect.callback((resume) => {
|
|
7
|
+
const transports = /* @__PURE__ */ new Map();
|
|
8
|
+
let sessions = 0;
|
|
9
|
+
const httpServer = http.createServer(async (req, res) => {
|
|
10
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
11
|
+
if (sessionId) {
|
|
12
|
+
const transport2 = transports.get(sessionId);
|
|
13
|
+
if (!transport2) {
|
|
14
|
+
res.writeHead(404);
|
|
15
|
+
res.end("Session not found");
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
await transport2.handleRequest(req, res);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const mcpServer = factory();
|
|
22
|
+
sessions++;
|
|
23
|
+
const transport = new StreamableHTTPServerTransport({
|
|
24
|
+
sessionIdGenerator: () => crypto.randomUUID(),
|
|
25
|
+
onsessioninitialized: (sid) => {
|
|
26
|
+
transports.set(sid, transport);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
await mcpServer.connect(transport);
|
|
30
|
+
await transport.handleRequest(req, res);
|
|
31
|
+
});
|
|
32
|
+
httpServer.listen(0, () => {
|
|
33
|
+
const addr = httpServer.address();
|
|
34
|
+
const port = typeof addr === "object" && addr ? addr.port : 0;
|
|
35
|
+
resume(
|
|
36
|
+
Effect.succeed({
|
|
37
|
+
url: `http://127.0.0.1:${port}`,
|
|
38
|
+
httpServer,
|
|
39
|
+
sessionCount: () => sessions
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
}),
|
|
44
|
+
({ httpServer }) => Effect.sync(() => {
|
|
45
|
+
httpServer.close();
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
export {
|
|
49
|
+
serveMcpServer
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/testing/server.ts"],"sourcesContent":["import { Effect } from \"effect\";\nimport * as http from \"node:http\";\nimport { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\";\nimport { StreamableHTTPServerTransport } from \"@modelcontextprotocol/sdk/server/streamableHttp.js\";\n\nexport type McpTestServer = {\n readonly url: string;\n readonly httpServer: http.Server;\n /** Number of MCP sessions created (each connect = 1 session) */\n readonly sessionCount: () => number;\n};\n\nexport const serveMcpServer = (factory: () => McpServer) =>\n Effect.acquireRelease(\n Effect.callback<McpTestServer, Error>((resume) => {\n const transports = new Map<string, StreamableHTTPServerTransport>();\n let sessions = 0;\n\n const httpServer = http.createServer(async (req, res) => {\n const sessionId = req.headers[\"mcp-session-id\"] as string | undefined;\n\n if (sessionId) {\n const transport = transports.get(sessionId);\n if (!transport) {\n res.writeHead(404);\n res.end(\"Session not found\");\n return;\n }\n await transport.handleRequest(req, res);\n return;\n }\n\n const mcpServer = factory();\n sessions++;\n\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: () => crypto.randomUUID(),\n onsessioninitialized: (sid) => {\n transports.set(sid, transport);\n },\n });\n\n await mcpServer.connect(transport);\n await transport.handleRequest(req, res);\n });\n\n httpServer.listen(0, () => {\n const addr = httpServer.address();\n const port = typeof addr === \"object\" && addr ? addr.port : 0;\n resume(\n Effect.succeed({\n url: `http://127.0.0.1:${port}`,\n httpServer,\n sessionCount: () => sessions,\n }),\n );\n });\n }),\n ({ httpServer }) =>\n Effect.sync(() => {\n httpServer.close();\n }),\n );\n"],"mappings":";AAAA,SAAS,cAAc;AACvB,YAAY,UAAU;AAEtB,SAAS,qCAAqC;AASvC,IAAM,iBAAiB,CAAC,YAC7B,OAAO;AAAA,EACL,OAAO,SAA+B,CAAC,WAAW;AAChD,UAAM,aAAa,oBAAI,IAA2C;AAClE,QAAI,WAAW;AAEf,UAAM,aAAkB,kBAAa,OAAO,KAAK,QAAQ;AACvD,YAAM,YAAY,IAAI,QAAQ,gBAAgB;AAE9C,UAAI,WAAW;AACb,cAAMA,aAAY,WAAW,IAAI,SAAS;AAC1C,YAAI,CAACA,YAAW;AACd,cAAI,UAAU,GAAG;AACjB,cAAI,IAAI,mBAAmB;AAC3B;AAAA,QACF;AACA,cAAMA,WAAU,cAAc,KAAK,GAAG;AACtC;AAAA,MACF;AAEA,YAAM,YAAY,QAAQ;AAC1B;AAEA,YAAM,YAAY,IAAI,8BAA8B;AAAA,QAClD,oBAAoB,MAAM,OAAO,WAAW;AAAA,QAC5C,sBAAsB,CAAC,QAAQ;AAC7B,qBAAW,IAAI,KAAK,SAAS;AAAA,QAC/B;AAAA,MACF,CAAC;AAED,YAAM,UAAU,QAAQ,SAAS;AACjC,YAAM,UAAU,cAAc,KAAK,GAAG;AAAA,IACxC,CAAC;AAED,eAAW,OAAO,GAAG,MAAM;AACzB,YAAM,OAAO,WAAW,QAAQ;AAChC,YAAM,OAAO,OAAO,SAAS,YAAY,OAAO,KAAK,OAAO;AAC5D;AAAA,QACE,OAAO,QAAQ;AAAA,UACb,KAAK,oBAAoB,IAAI;AAAA,UAC7B;AAAA,UACA,cAAc,MAAM;AAAA,QACtB,CAAC;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AAAA,EACD,CAAC,EAAE,WAAW,MACZ,OAAO,KAAK,MAAM;AAChB,eAAW,MAAM;AAAA,EACnB,CAAC;AACL;","names":["transport"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@executor-js/plugin-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.4.20",
|
|
4
4
|
"homepage": "https://github.com/RhysSullivan/executor/tree/main/packages/plugins/mcp",
|
|
5
5
|
"bugs": {
|
|
6
6
|
"url": "https://github.com/RhysSullivan/executor/issues"
|
|
@@ -27,6 +27,18 @@
|
|
|
27
27
|
"types": "./dist/sdk/index.d.ts",
|
|
28
28
|
"default": "./dist/core.js"
|
|
29
29
|
}
|
|
30
|
+
},
|
|
31
|
+
"./client": {
|
|
32
|
+
"import": {
|
|
33
|
+
"types": "./dist/react/plugin-client.d.ts",
|
|
34
|
+
"default": "./dist/client.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"./testing": {
|
|
38
|
+
"import": {
|
|
39
|
+
"types": "./dist/testing/index.d.ts",
|
|
40
|
+
"default": "./dist/testing.js"
|
|
41
|
+
}
|
|
30
42
|
}
|
|
31
43
|
},
|
|
32
44
|
"publishConfig": {
|
|
@@ -40,16 +52,17 @@
|
|
|
40
52
|
"typecheck:slow": "bunx tsc --noEmit -p tsconfig.json"
|
|
41
53
|
},
|
|
42
54
|
"dependencies": {
|
|
55
|
+
"@cfworker/json-schema": "^4.1.1",
|
|
43
56
|
"@effect/platform-node": "4.0.0-beta.59",
|
|
44
|
-
"@executor-js/config": "
|
|
45
|
-
"@executor-js/sdk": "
|
|
57
|
+
"@executor-js/config": "1.4.20",
|
|
58
|
+
"@executor-js/sdk": "1.4.20",
|
|
46
59
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
47
60
|
"effect": "4.0.0-beta.59"
|
|
48
61
|
},
|
|
49
62
|
"devDependencies": {
|
|
50
63
|
"@effect/atom-react": "4.0.0-beta.59",
|
|
51
64
|
"@effect/vitest": "4.0.0-beta.59",
|
|
52
|
-
"@executor-js/storage-core": "
|
|
65
|
+
"@executor-js/storage-core": "1.4.20",
|
|
53
66
|
"@types/node": "^24.3.1",
|
|
54
67
|
"@types/react": "^19.1.0",
|
|
55
68
|
"bun-types": "^1.2.22",
|