@executor-js/plugin-mcp 0.0.1-beta.6 → 0.0.2

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 (40) hide show
  1. package/README.md +19 -15
  2. package/dist/api/group.d.ts +114 -147
  3. package/dist/api/handlers.d.ts +2 -2
  4. package/dist/api/handlers.test.d.ts +1 -0
  5. package/dist/chunk-DJANY5EU.js +1325 -0
  6. package/dist/chunk-DJANY5EU.js.map +1 -0
  7. package/dist/core.js +8 -52
  8. package/dist/core.js.map +1 -1
  9. package/dist/index.js +2 -5
  10. package/dist/index.js.map +1 -1
  11. package/dist/promise.d.ts +2 -6
  12. package/dist/react/AddMcpSource.d.ts +2 -0
  13. package/dist/react/McpSignInButton.d.ts +3 -0
  14. package/dist/react/atoms.d.ts +153 -0
  15. package/dist/react/client.d.ts +437 -3
  16. package/dist/react/index.d.ts +3 -2
  17. package/dist/react/source-plugin.d.ts +13 -1
  18. package/dist/sdk/binding-store.d.ts +74 -18
  19. package/dist/sdk/connection-pool.test.d.ts +1 -0
  20. package/dist/sdk/connection.d.ts +3 -1
  21. package/dist/sdk/cross-user-isolation.test.d.ts +1 -0
  22. package/dist/sdk/errors.d.ts +15 -23
  23. package/dist/sdk/index.d.ts +3 -3
  24. package/dist/sdk/invoke.d.ts +18 -17
  25. package/dist/sdk/manifest.d.ts +1 -0
  26. package/dist/sdk/per-user-auth-isolation.test.d.ts +1 -0
  27. package/dist/sdk/plugin.d.ts +109 -43
  28. package/dist/sdk/probe-shape.d.ts +39 -0
  29. package/dist/sdk/probe-shape.test.d.ts +1 -0
  30. package/dist/sdk/stdio-connector.d.ts +8 -0
  31. package/dist/sdk/stored-source.d.ts +31 -105
  32. package/dist/sdk/types.d.ts +77 -93
  33. package/dist/stdio-connector-KNHLETKM.js +12 -0
  34. package/dist/stdio-connector-KNHLETKM.js.map +1 -0
  35. package/package.json +11 -21
  36. package/dist/chunk-NJ4CITCV.js +0 -1203
  37. package/dist/chunk-NJ4CITCV.js.map +0 -1
  38. package/dist/react/McpSourceSummary.d.ts +0 -3
  39. package/dist/sdk/config-file-store.d.ts +0 -10
  40. package/dist/sdk/oauth.d.ts +0 -36
package/README.md CHANGED
@@ -1,35 +1,41 @@
1
- # @executor/plugin-mcp
1
+ # @executor-js/plugin-mcp
2
2
 
3
3
  Register [Model Context Protocol](https://modelcontextprotocol.io) servers as tool sources for an executor. Supports both stdio-launched servers and remote (HTTP) servers, with optional OAuth.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- bun add @executor/sdk @executor/plugin-mcp
8
+ bun add @executor-js/sdk @executor-js/plugin-mcp
9
9
  # or
10
- npm install @executor/sdk @executor/plugin-mcp
10
+ npm install @executor-js/sdk @executor-js/plugin-mcp
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ```ts
16
- import { createExecutor } from "@executor/sdk";
17
- import { mcpPlugin } from "@executor/plugin-mcp";
16
+ import { createExecutor } from "@executor-js/sdk";
17
+ import { mcpPlugin } from "@executor-js/plugin-mcp";
18
18
 
19
19
  const executor = await createExecutor({
20
- scope: { name: "my-app" },
21
- plugins: [mcpPlugin()] as const,
20
+ onElicitation: "accept-all",
21
+ // Stdio sources spawn a local subprocess and inherit `process.env` —
22
+ // only enable for trusted single-user contexts.
23
+ plugins: [mcpPlugin({ dangerouslyAllowStdioMCP: true })] as const,
22
24
  });
23
25
 
26
+ const scope = executor.scopes[0]!.id;
27
+
24
28
  // Remote MCP server
25
29
  await executor.mcp.addSource({
30
+ scope,
26
31
  transport: "remote",
27
32
  name: "Context7",
28
33
  endpoint: "https://mcp.context7.com/mcp",
29
34
  });
30
35
 
31
- // Stdio MCP server
36
+ // Stdio MCP server (requires `dangerouslyAllowStdioMCP: true` above)
32
37
  await executor.mcp.addSource({
38
+ scope,
33
39
  transport: "stdio",
34
40
  name: "My Server",
35
41
  command: "npx",
@@ -39,19 +45,17 @@ await executor.mcp.addSource({
39
45
  // Every MCP tool is now part of the unified catalog
40
46
  const tools = await executor.tools.list();
41
47
 
42
- const result = await executor.tools.invoke(
43
- "context7.searchLibraries",
44
- { query: "effect-ts" },
45
- { onElicitation: "accept-all" },
46
- );
48
+ const result = await executor.tools.invoke("context7.searchLibraries", {
49
+ query: "effect-ts",
50
+ });
47
51
  ```
48
52
 
49
53
  ## Using with Effect
50
54
 
51
- If you're building on `@executor/sdk` (the raw Effect entry), import this plugin from its `/core` subpath instead:
55
+ If you're building on `@executor-js/sdk/core` (the raw Effect entry), import this plugin from its `/core` subpath instead — it returns the Effect-shaped plugin with `Effect.Effect<...>`-returning methods rather than promisified wrappers:
52
56
 
53
57
  ```ts
54
- import { mcpPlugin } from "@executor/plugin-mcp";
58
+ import { mcpPlugin } from "@executor-js/plugin-mcp/core";
55
59
  ```
56
60
 
57
61
  ## Status
@@ -1,148 +1,115 @@
1
- import { HttpApiEndpoint, HttpApiGroup, HttpApiSchema } from "@effect/platform";
1
+ import { HttpApiEndpoint, HttpApiGroup } from "effect/unstable/httpapi";
2
+ import { Schema } from "effect";
3
+ import { InternalError } from "@executor-js/api";
4
+ import { McpConnectionError, McpToolDiscoveryError } from "../sdk/errors";
2
5
  import { McpStoredSourceSchema } from "../sdk/stored-source";
3
- export { HttpApiSchema };
4
- declare const McpGroup_base: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.HttpApiEndpoint<"probeEndpoint", "POST", {
5
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
6
- }, never, {
7
- readonly endpoint: string;
8
- }, never, {
9
- readonly name: string;
10
- readonly namespace: string;
11
- readonly connected: boolean;
12
- readonly requiresOAuth: boolean;
13
- readonly toolCount: number | null;
14
- readonly serverName: string | null;
15
- }, {
16
- readonly message: string;
17
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"addSource", "POST", {
18
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
19
- }, never, {
20
- readonly name: string;
21
- readonly endpoint: string;
22
- readonly namespace?: string | undefined;
23
- readonly transport: "remote";
24
- readonly remoteTransport?: "streamable-http" | "sse" | "auto" | undefined;
25
- readonly queryParams?: {
26
- readonly [x: string]: string;
27
- } | undefined;
28
- readonly headers?: {
29
- readonly [x: string]: string;
30
- } | undefined;
31
- readonly auth?: {
32
- readonly kind: "none";
33
- } | {
34
- readonly secretId: string;
35
- readonly kind: "header";
36
- readonly headerName: string;
37
- readonly prefix?: string | undefined;
38
- } | {
39
- readonly kind: "oauth2";
40
- readonly scope: string | null;
41
- readonly accessTokenSecretId: string;
42
- readonly refreshTokenSecretId: string | null;
43
- readonly tokenType?: string | undefined;
44
- readonly expiresAt: number | null;
45
- } | undefined;
46
- } | {
47
- readonly name: string;
48
- readonly namespace?: string | undefined;
49
- readonly transport: "stdio";
50
- readonly command: string;
51
- readonly args?: readonly string[] | undefined;
52
- readonly env?: {
53
- readonly [x: string]: string;
54
- } | undefined;
55
- readonly cwd?: string | undefined;
56
- }, never, {
57
- readonly namespace: string;
58
- readonly toolCount: number;
59
- }, {
60
- readonly message: string;
61
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"removeSource", "POST", {
62
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
63
- }, never, {
64
- readonly namespace: string;
65
- }, never, {
66
- readonly removed: boolean;
67
- }, {
68
- readonly message: string;
69
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"refreshSource", "POST", {
70
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
71
- }, never, {
72
- readonly namespace: string;
73
- }, never, {
74
- readonly toolCount: number;
75
- }, {
76
- readonly message: string;
77
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"startOAuth", "POST", {
78
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
79
- }, never, {
80
- readonly endpoint: string;
81
- readonly queryParams?: {
82
- readonly [x: string]: string;
83
- } | null | undefined;
84
- readonly redirectUrl: string;
85
- }, never, {
86
- readonly sessionId: string;
87
- readonly authorizationUrl: string;
88
- }, {
89
- readonly message: string;
90
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"completeOAuth", "POST", {
91
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
92
- }, never, {
93
- readonly error?: string | undefined;
94
- readonly code?: string | undefined;
95
- readonly state: string;
96
- }, never, {
97
- readonly scope: string | null;
98
- readonly accessTokenSecretId: string;
99
- readonly refreshTokenSecretId: string | null;
100
- readonly tokenType: string;
101
- readonly expiresAt: number | null;
102
- }, {
103
- readonly message: string;
104
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"oauthCallback", "GET", never, {
105
- readonly error?: string | undefined;
106
- readonly code?: string | undefined;
107
- readonly state: string;
108
- readonly error_description?: string | undefined;
109
- }, never, never, string, {
110
- readonly message: string;
111
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSource", "GET", {
112
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
113
- readonly namespace: string;
114
- }, never, never, never, McpStoredSourceSchema | null, {
115
- readonly message: string;
116
- }, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateSource", "PATCH", {
117
- readonly scopeId: string & import("effect/Brand").Brand<"ScopeId">;
118
- readonly namespace: string;
119
- }, never, {
120
- readonly endpoint?: string | undefined;
121
- readonly queryParams?: {
122
- readonly [x: string]: string;
123
- } | undefined;
124
- readonly headers?: {
125
- readonly [x: string]: string;
126
- } | undefined;
127
- readonly auth?: {
128
- readonly kind: "none";
129
- } | {
130
- readonly secretId: string;
131
- readonly kind: "header";
132
- readonly headerName: string;
133
- readonly prefix?: string | undefined;
134
- } | {
135
- readonly kind: "oauth2";
136
- readonly scope: string | null;
137
- readonly accessTokenSecretId: string;
138
- readonly refreshTokenSecretId: string | null;
139
- readonly tokenType?: string | undefined;
140
- readonly expiresAt: number | null;
141
- } | undefined;
142
- }, never, {
143
- readonly updated: boolean;
144
- }, {
145
- readonly message: string;
146
- }, never, never>, never, never, false>;
147
- export declare class McpGroup extends McpGroup_base {
148
- }
6
+ export declare const McpGroup: HttpApiGroup.HttpApiGroup<"mcp", HttpApiEndpoint.HttpApiEndpoint<"probeEndpoint", "POST", "/scopes/:scopeId/mcp/probe", HttpApiEndpoint.StringTree<Schema.Struct<{
7
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
8
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
9
+ readonly endpoint: Schema.String;
10
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
11
+ readonly secretId: Schema.String;
12
+ readonly prefix: Schema.optional<Schema.String>;
13
+ }>]>>>;
14
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
15
+ readonly secretId: Schema.String;
16
+ readonly prefix: Schema.optional<Schema.String>;
17
+ }>]>>>;
18
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
19
+ readonly connected: Schema.Boolean;
20
+ readonly requiresOAuth: Schema.Boolean;
21
+ readonly name: Schema.String;
22
+ readonly namespace: Schema.String;
23
+ readonly toolCount: Schema.NullOr<Schema.Number>;
24
+ readonly serverName: Schema.NullOr<Schema.String>;
25
+ }>>, HttpApiEndpoint.Json<typeof McpConnectionError | typeof McpToolDiscoveryError | typeof InternalError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"addSource", "POST", "/scopes/:scopeId/mcp/sources", HttpApiEndpoint.StringTree<Schema.Struct<{
26
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
27
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Union<readonly [Schema.Struct<{
28
+ readonly transport: Schema.Literal<"remote">;
29
+ readonly name: Schema.String;
30
+ readonly endpoint: Schema.String;
31
+ readonly remoteTransport: Schema.optional<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>;
32
+ readonly namespace: Schema.optional<Schema.String>;
33
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
34
+ readonly secretId: Schema.String;
35
+ readonly prefix: Schema.optional<Schema.String>;
36
+ }>]>>>;
37
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
38
+ readonly secretId: Schema.String;
39
+ readonly prefix: Schema.optional<Schema.String>;
40
+ }>]>>>;
41
+ readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
42
+ readonly kind: Schema.Literal<"none">;
43
+ }>, Schema.Struct<{
44
+ readonly kind: Schema.Literal<"header">;
45
+ readonly headerName: Schema.String;
46
+ readonly secretId: Schema.String;
47
+ readonly prefix: Schema.optional<Schema.String>;
48
+ }>, Schema.Struct<{
49
+ readonly kind: Schema.Literal<"oauth2">;
50
+ /** Stable id of the SDK Connection minted by `completeOAuth`. The
51
+ * backing access/refresh secrets live on the connection row; the
52
+ * source only needs this pointer. */
53
+ readonly connectionId: Schema.String;
54
+ readonly clientIdSecretId: Schema.optional<Schema.String>;
55
+ readonly clientSecretSecretId: Schema.optional<Schema.NullOr<Schema.String>>;
56
+ }>]>>;
57
+ }>, Schema.Struct<{
58
+ readonly transport: Schema.Literal<"stdio">;
59
+ readonly name: Schema.String;
60
+ readonly command: Schema.String;
61
+ readonly args: Schema.optional<Schema.$Array<Schema.String>>;
62
+ readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
63
+ readonly cwd: Schema.optional<Schema.String>;
64
+ readonly namespace: Schema.optional<Schema.String>;
65
+ }>]>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
66
+ readonly toolCount: Schema.Number;
67
+ readonly namespace: Schema.String;
68
+ }>>, HttpApiEndpoint.Json<typeof McpConnectionError | typeof McpToolDiscoveryError | typeof InternalError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"removeSource", "POST", "/scopes/:scopeId/mcp/sources/remove", HttpApiEndpoint.StringTree<Schema.Struct<{
69
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
70
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
71
+ readonly namespace: Schema.String;
72
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
73
+ readonly removed: Schema.Boolean;
74
+ }>>, HttpApiEndpoint.Json<typeof McpConnectionError | typeof McpToolDiscoveryError | typeof InternalError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"refreshSource", "POST", "/scopes/:scopeId/mcp/sources/refresh", HttpApiEndpoint.StringTree<Schema.Struct<{
75
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
76
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
77
+ readonly namespace: Schema.String;
78
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
79
+ readonly toolCount: Schema.Number;
80
+ }>>, HttpApiEndpoint.Json<typeof McpConnectionError | typeof McpToolDiscoveryError | typeof InternalError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"getSource", "GET", "/scopes/:scopeId/mcp/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
81
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
82
+ namespace: Schema.String;
83
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.NullOr<typeof McpStoredSourceSchema>>, HttpApiEndpoint.Json<typeof McpConnectionError | typeof McpToolDiscoveryError | typeof InternalError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"updateSource", "PATCH", "/scopes/:scopeId/mcp/sources/:namespace", HttpApiEndpoint.StringTree<Schema.Struct<{
84
+ scopeId: Schema.brand<Schema.String, "ScopeId">;
85
+ namespace: Schema.String;
86
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
87
+ readonly name: Schema.optional<Schema.String>;
88
+ readonly endpoint: Schema.optional<Schema.String>;
89
+ readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
90
+ readonly secretId: Schema.String;
91
+ readonly prefix: Schema.optional<Schema.String>;
92
+ }>]>>>;
93
+ readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
94
+ readonly secretId: Schema.String;
95
+ readonly prefix: Schema.optional<Schema.String>;
96
+ }>]>>>;
97
+ readonly auth: Schema.optional<Schema.Union<readonly [Schema.Struct<{
98
+ readonly kind: Schema.Literal<"none">;
99
+ }>, Schema.Struct<{
100
+ readonly kind: Schema.Literal<"header">;
101
+ readonly headerName: Schema.String;
102
+ readonly secretId: Schema.String;
103
+ readonly prefix: Schema.optional<Schema.String>;
104
+ }>, Schema.Struct<{
105
+ readonly kind: Schema.Literal<"oauth2">;
106
+ /** Stable id of the SDK Connection minted by `completeOAuth`. The
107
+ * backing access/refresh secrets live on the connection row; the
108
+ * source only needs this pointer. */
109
+ readonly connectionId: Schema.String;
110
+ readonly clientIdSecretId: Schema.optional<Schema.String>;
111
+ readonly clientSecretSecretId: Schema.optional<Schema.NullOr<Schema.String>>;
112
+ }>]>>;
113
+ }>>, HttpApiEndpoint.StringTree<never>, HttpApiEndpoint.Json<Schema.Struct<{
114
+ readonly updated: Schema.Boolean;
115
+ }>>, HttpApiEndpoint.Json<typeof McpConnectionError | typeof McpToolDiscoveryError | typeof InternalError>, never, never>, false>;
@@ -1,7 +1,7 @@
1
1
  import { Context } from "effect";
2
2
  import type { McpPluginExtension } from "../sdk/plugin";
3
- declare const McpExtensionService_base: Context.TagClass<McpExtensionService, "McpExtensionService", McpPluginExtension>;
3
+ declare const McpExtensionService_base: Context.ServiceClass<McpExtensionService, "McpExtensionService", McpPluginExtension>;
4
4
  export declare class McpExtensionService extends McpExtensionService_base {
5
5
  }
6
- export declare const McpHandlers: import("effect/Layer").Layer<import("@effect/platform/HttpApiGroup").ApiGroup<"executor", "mcp">, never, McpExtensionService>;
6
+ export declare const McpHandlers: import("effect/Layer").Layer<import("effect/unstable/httpapi/HttpApiGroup").ApiGroup<"executor", "mcp">, never, import("effect/unstable/http/HttpRouter").Request<"Requires", McpExtensionService>>;
7
7
  export {};
@@ -0,0 +1 @@
1
+ export {};