@executor-js/plugin-mcp 0.0.2 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/AddMcpSource-VM3HY26S.js +762 -0
  2. package/dist/AddMcpSource-VM3HY26S.js.map +1 -0
  3. package/dist/EditMcpSource-WELWGRJG.js +259 -0
  4. package/dist/EditMcpSource-WELWGRJG.js.map +1 -0
  5. package/dist/McpSourceSummary-7TDQXLT5.js +85 -0
  6. package/dist/McpSourceSummary-7TDQXLT5.js.map +1 -0
  7. package/dist/api/group.d.ts +115 -23
  8. package/dist/api/index.d.ts +391 -0
  9. package/dist/chunk-2ETJ6LQH.js +239 -0
  10. package/dist/chunk-2ETJ6LQH.js.map +1 -0
  11. package/dist/chunk-OOOH3IO4.js +2194 -0
  12. package/dist/chunk-OOOH3IO4.js.map +1 -0
  13. package/dist/chunk-SKSXXFOA.js +104 -0
  14. package/dist/chunk-SKSXXFOA.js.map +1 -0
  15. package/dist/chunk-Z4CRPOLI.js +186 -0
  16. package/dist/chunk-Z4CRPOLI.js.map +1 -0
  17. package/dist/chunk-ZIRGIRGP.js +115 -0
  18. package/dist/chunk-ZIRGIRGP.js.map +1 -0
  19. package/dist/client.js +51 -0
  20. package/dist/client.js.map +1 -0
  21. package/dist/core.js +26 -2
  22. package/dist/index.js +2 -1
  23. package/dist/react/McpRemoteSourceFields.d.ts +18 -0
  24. package/dist/react/McpSourceSummary.d.ts +5 -0
  25. package/dist/react/atoms.d.ts +211 -11
  26. package/dist/react/client.d.ts +114 -350
  27. package/dist/react/index.d.ts +1 -1
  28. package/dist/react/plugin-client.d.ts +9 -0
  29. package/dist/react/source-plugin.d.ts +1 -1
  30. package/dist/sdk/binding-store.d.ts +110 -1
  31. package/dist/sdk/index.d.ts +1 -1
  32. package/dist/sdk/invoke.d.ts +2 -0
  33. package/dist/sdk/manifest.d.ts +2 -0
  34. package/dist/sdk/plugin.d.ts +168 -10
  35. package/dist/sdk/probe-shape-real-servers.live.test.d.ts +1 -0
  36. package/dist/sdk/probe-shape.d.ts +17 -3
  37. package/dist/sdk/stored-source.d.ts +9 -6
  38. package/dist/sdk/types.d.ts +153 -13
  39. package/dist/{stdio-connector-KNHLETKM.js → stdio-connector-AA5S6UUJ.js} +1 -1
  40. package/dist/{stdio-connector-KNHLETKM.js.map → stdio-connector-AA5S6UUJ.js.map} +1 -1
  41. package/dist/testing/index.d.ts +1 -0
  42. package/dist/testing/server.d.ts +10 -0
  43. package/dist/testing.js +51 -0
  44. package/dist/testing.js.map +1 -0
  45. package/package.json +17 -4
  46. package/dist/chunk-DJANY5EU.js +0 -1325
  47. package/dist/chunk-DJANY5EU.js.map +0 -1
@@ -6,23 +6,144 @@ 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 McpConnectionAuth = typeof McpConnectionAuth.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 McpSourceBindingInputSchema: 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
+ declare const McpSourceBindingInput_base: Schema.Class<McpSourceBindingInput, Schema.Struct<{
108
+ readonly sourceId: Schema.String;
109
+ readonly sourceScope: Schema.brand<Schema.String, "ScopeId">;
110
+ readonly scope: Schema.brand<Schema.String, "ScopeId">;
111
+ readonly slot: Schema.String;
112
+ readonly value: Schema.Union<readonly [Schema.Struct<{
113
+ readonly kind: Schema.Literal<"text">;
114
+ readonly text: Schema.String;
115
+ }>, Schema.Struct<{
116
+ readonly kind: Schema.Literal<"secret">;
117
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
118
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
119
+ }>, Schema.Struct<{
120
+ readonly kind: Schema.Literal<"connection">;
121
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
122
+ }>]>;
123
+ }>, {}>;
124
+ export declare class McpSourceBindingInput extends McpSourceBindingInput_base {
125
+ }
126
+ declare const McpSourceBindingRef_base: Schema.Class<McpSourceBindingRef, Schema.Struct<{
127
+ readonly sourceId: Schema.String;
128
+ readonly sourceScopeId: Schema.brand<Schema.String, "ScopeId">;
129
+ readonly scopeId: Schema.brand<Schema.String, "ScopeId">;
130
+ readonly slot: Schema.String;
131
+ readonly value: Schema.Union<readonly [Schema.Struct<{
132
+ readonly kind: Schema.Literal<"text">;
133
+ readonly text: Schema.String;
134
+ }>, Schema.Struct<{
135
+ readonly kind: Schema.Literal<"secret">;
136
+ readonly secretId: Schema.brand<Schema.String, "SecretId">;
137
+ readonly secretScopeId: Schema.optional<Schema.brand<Schema.String, "ScopeId">>;
138
+ }>, Schema.Struct<{
139
+ readonly kind: Schema.Literal<"connection">;
140
+ readonly connectionId: Schema.brand<Schema.String, "ConnectionId">;
141
+ }>]>;
142
+ readonly createdAt: Schema.Date;
143
+ readonly updatedAt: Schema.Date;
144
+ }>, {}>;
145
+ export declare class McpSourceBindingRef extends McpSourceBindingRef_base {
146
+ }
26
147
  export declare const McpRemoteSourceData: Schema.Struct<{
27
148
  readonly transport: Schema.Literal<"remote">;
28
149
  /** The MCP server endpoint URL */
@@ -31,12 +152,14 @@ export declare const McpRemoteSourceData: Schema.Struct<{
31
152
  readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
32
153
  /** Extra query params appended to the endpoint URL */
33
154
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
34
- readonly secretId: Schema.String;
155
+ readonly kind: Schema.Literal<"binding">;
156
+ readonly slot: Schema.String;
35
157
  readonly prefix: Schema.optional<Schema.String>;
36
158
  }>]>>>;
37
159
  /** Extra headers sent on every request */
38
160
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
39
- readonly secretId: Schema.String;
161
+ readonly kind: Schema.Literal<"binding">;
162
+ readonly slot: Schema.String;
40
163
  readonly prefix: Schema.optional<Schema.String>;
41
164
  }>]>>>;
42
165
  /** Auth configuration */
@@ -45,13 +168,13 @@ export declare const McpRemoteSourceData: Schema.Struct<{
45
168
  }>, Schema.Struct<{
46
169
  readonly kind: Schema.Literal<"header">;
47
170
  readonly headerName: Schema.String;
48
- readonly secretId: Schema.String;
171
+ readonly secretSlot: Schema.String;
49
172
  readonly prefix: Schema.optional<Schema.String>;
50
173
  }>, Schema.Struct<{
51
174
  readonly kind: Schema.Literal<"oauth2">;
52
- readonly connectionId: Schema.String;
53
- readonly clientIdSecretId: Schema.optional<Schema.String>;
54
- readonly clientSecretSecretId: Schema.optional<Schema.NullOr<Schema.String>>;
175
+ readonly connectionSlot: Schema.String;
176
+ readonly clientIdSlot: Schema.optional<Schema.String>;
177
+ readonly clientSecretSlot: Schema.optional<Schema.String>;
55
178
  }>]>;
56
179
  }>;
57
180
  export type McpRemoteSourceData = typeof McpRemoteSourceData.Type;
@@ -75,12 +198,14 @@ export declare const McpStoredSourceData: Schema.Union<readonly [Schema.Struct<{
75
198
  readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
76
199
  /** Extra query params appended to the endpoint URL */
77
200
  readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
78
- readonly secretId: Schema.String;
201
+ readonly kind: Schema.Literal<"binding">;
202
+ readonly slot: Schema.String;
79
203
  readonly prefix: Schema.optional<Schema.String>;
80
204
  }>]>>>;
81
205
  /** Extra headers sent on every request */
82
206
  readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
83
- readonly secretId: Schema.String;
207
+ readonly kind: Schema.Literal<"binding">;
208
+ readonly slot: Schema.String;
84
209
  readonly prefix: Schema.optional<Schema.String>;
85
210
  }>]>>>;
86
211
  /** Auth configuration */
@@ -89,13 +214,13 @@ export declare const McpStoredSourceData: Schema.Union<readonly [Schema.Struct<{
89
214
  }>, Schema.Struct<{
90
215
  readonly kind: Schema.Literal<"header">;
91
216
  readonly headerName: Schema.String;
92
- readonly secretId: Schema.String;
217
+ readonly secretSlot: Schema.String;
93
218
  readonly prefix: Schema.optional<Schema.String>;
94
219
  }>, Schema.Struct<{
95
220
  readonly kind: Schema.Literal<"oauth2">;
96
- readonly connectionId: Schema.String;
97
- readonly clientIdSecretId: Schema.optional<Schema.String>;
98
- readonly clientSecretSecretId: Schema.optional<Schema.NullOr<Schema.String>>;
221
+ readonly connectionSlot: Schema.String;
222
+ readonly clientIdSlot: Schema.optional<Schema.String>;
223
+ readonly clientSecretSlot: Schema.optional<Schema.String>;
99
224
  }>]>;
100
225
  }>, Schema.Struct<{
101
226
  readonly transport: Schema.Literal<"stdio">;
@@ -109,12 +234,27 @@ export declare const McpStoredSourceData: Schema.Union<readonly [Schema.Struct<{
109
234
  readonly cwd: Schema.optional<Schema.String>;
110
235
  }>]>;
111
236
  export type McpStoredSourceData = typeof McpStoredSourceData.Type;
237
+ export declare const McpToolAnnotations: Schema.Struct<{
238
+ readonly title: Schema.optional<Schema.String>;
239
+ readonly readOnlyHint: Schema.optional<Schema.Boolean>;
240
+ readonly destructiveHint: Schema.optional<Schema.Boolean>;
241
+ readonly idempotentHint: Schema.optional<Schema.Boolean>;
242
+ readonly openWorldHint: Schema.optional<Schema.Boolean>;
243
+ }>;
244
+ export type McpToolAnnotations = typeof McpToolAnnotations.Type;
112
245
  declare const McpToolBinding_base: Schema.Class<McpToolBinding, Schema.Struct<{
113
246
  readonly toolId: Schema.String;
114
247
  readonly toolName: Schema.String;
115
248
  readonly description: Schema.NullOr<Schema.String>;
116
249
  readonly inputSchema: Schema.optional<Schema.Unknown>;
117
250
  readonly outputSchema: Schema.optional<Schema.Unknown>;
251
+ readonly annotations: Schema.optional<Schema.Struct<{
252
+ readonly title: Schema.optional<Schema.String>;
253
+ readonly readOnlyHint: Schema.optional<Schema.Boolean>;
254
+ readonly destructiveHint: Schema.optional<Schema.Boolean>;
255
+ readonly idempotentHint: Schema.optional<Schema.Boolean>;
256
+ readonly openWorldHint: Schema.optional<Schema.Boolean>;
257
+ }>>;
118
258
  }>, {}>;
119
259
  export declare class McpToolBinding extends McpToolBinding_base {
120
260
  }
@@ -9,4 +9,4 @@ var createStdioTransport = (config) => new StdioClientTransport({
9
9
  export {
10
10
  createStdioTransport
11
11
  };
12
- //# sourceMappingURL=stdio-connector-KNHLETKM.js.map
12
+ //# sourceMappingURL=stdio-connector-AA5S6UUJ.js.map
@@ -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\n ? ({ ...process.env, ...config.env } as Record<string, string>)\n : 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,MACP,EAAE,GAAG,QAAQ,KAAK,GAAG,OAAO,IAAI,IACjC;AAAA,EACJ,KAAK,OAAO;AACd,CAAC;","names":[]}
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";
@@ -0,0 +1,10 @@
1
+ import { Effect } from "effect";
2
+ import * as http from "node:http";
3
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
+ export type McpTestServer = {
5
+ readonly url: string;
6
+ readonly httpServer: http.Server;
7
+ /** Number of MCP sessions created (each connect = 1 session) */
8
+ readonly sessionCount: () => number;
9
+ };
10
+ export declare const serveMcpServer: (factory: () => McpServer) => Effect.Effect<McpTestServer, Error, import("effect/Scope").Scope>;
@@ -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": "0.0.2",
3
+ "version": "0.2.1",
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": "0.0.2",
45
- "@executor-js/sdk": "0.0.2",
57
+ "@executor-js/config": "0.2.1",
58
+ "@executor-js/sdk": "0.2.1",
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": "0.0.2",
65
+ "@executor-js/storage-core": "0.2.1",
53
66
  "@types/node": "^24.3.1",
54
67
  "@types/react": "^19.1.0",
55
68
  "bun-types": "^1.2.22",