@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.
- package/README.md +19 -15
- package/dist/api/group.d.ts +114 -147
- package/dist/api/handlers.d.ts +2 -2
- package/dist/api/handlers.test.d.ts +1 -0
- package/dist/chunk-DJANY5EU.js +1325 -0
- package/dist/chunk-DJANY5EU.js.map +1 -0
- package/dist/core.js +8 -52
- package/dist/core.js.map +1 -1
- package/dist/index.js +2 -5
- package/dist/index.js.map +1 -1
- package/dist/promise.d.ts +2 -6
- package/dist/react/AddMcpSource.d.ts +2 -0
- package/dist/react/McpSignInButton.d.ts +3 -0
- package/dist/react/atoms.d.ts +153 -0
- package/dist/react/client.d.ts +437 -3
- package/dist/react/index.d.ts +3 -2
- package/dist/react/source-plugin.d.ts +13 -1
- package/dist/sdk/binding-store.d.ts +74 -18
- package/dist/sdk/connection-pool.test.d.ts +1 -0
- package/dist/sdk/connection.d.ts +3 -1
- package/dist/sdk/cross-user-isolation.test.d.ts +1 -0
- package/dist/sdk/errors.d.ts +15 -23
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/invoke.d.ts +18 -17
- package/dist/sdk/manifest.d.ts +1 -0
- package/dist/sdk/per-user-auth-isolation.test.d.ts +1 -0
- package/dist/sdk/plugin.d.ts +109 -43
- package/dist/sdk/probe-shape.d.ts +39 -0
- package/dist/sdk/probe-shape.test.d.ts +1 -0
- package/dist/sdk/stdio-connector.d.ts +8 -0
- package/dist/sdk/stored-source.d.ts +31 -105
- package/dist/sdk/types.d.ts +77 -93
- package/dist/stdio-connector-KNHLETKM.js +12 -0
- package/dist/stdio-connector-KNHLETKM.js.map +1 -0
- package/package.json +11 -21
- package/dist/chunk-NJ4CITCV.js +0 -1203
- package/dist/chunk-NJ4CITCV.js.map +0 -1
- package/dist/react/McpSourceSummary.d.ts +0 -3
- package/dist/sdk/config-file-store.d.ts +0 -10
- package/dist/sdk/oauth.d.ts +0 -36
|
@@ -1,26 +1,82 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { type
|
|
3
|
-
import { McpToolBinding } from "./types";
|
|
4
|
-
|
|
2
|
+
import { type StorageDeps, type StorageFailure } from "@executor-js/sdk/core";
|
|
3
|
+
import { McpToolBinding, McpStoredSourceData } from "./types";
|
|
4
|
+
export declare const mcpSchema: {
|
|
5
|
+
readonly mcp_source: {
|
|
6
|
+
readonly fields: {
|
|
7
|
+
readonly id: {
|
|
8
|
+
readonly type: "string";
|
|
9
|
+
readonly required: true;
|
|
10
|
+
};
|
|
11
|
+
readonly scope_id: {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly required: true;
|
|
14
|
+
readonly index: true;
|
|
15
|
+
};
|
|
16
|
+
readonly name: {
|
|
17
|
+
readonly type: "string";
|
|
18
|
+
readonly required: true;
|
|
19
|
+
};
|
|
20
|
+
readonly config: {
|
|
21
|
+
readonly type: "json";
|
|
22
|
+
readonly required: true;
|
|
23
|
+
};
|
|
24
|
+
readonly created_at: {
|
|
25
|
+
readonly type: "date";
|
|
26
|
+
readonly required: true;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
readonly mcp_binding: {
|
|
31
|
+
readonly fields: {
|
|
32
|
+
readonly id: {
|
|
33
|
+
readonly type: "string";
|
|
34
|
+
readonly required: true;
|
|
35
|
+
};
|
|
36
|
+
readonly scope_id: {
|
|
37
|
+
readonly type: "string";
|
|
38
|
+
readonly required: true;
|
|
39
|
+
readonly index: true;
|
|
40
|
+
};
|
|
41
|
+
readonly source_id: {
|
|
42
|
+
readonly type: "string";
|
|
43
|
+
readonly required: true;
|
|
44
|
+
readonly index: true;
|
|
45
|
+
};
|
|
46
|
+
readonly binding: {
|
|
47
|
+
readonly type: "json";
|
|
48
|
+
readonly required: true;
|
|
49
|
+
};
|
|
50
|
+
readonly created_at: {
|
|
51
|
+
readonly type: "date";
|
|
52
|
+
readonly required: true;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export type McpSchema = typeof mcpSchema;
|
|
5
58
|
export interface McpStoredSource {
|
|
6
59
|
readonly namespace: string;
|
|
60
|
+
/** Executor scope id this source row lives in. Writes stamp this on
|
|
61
|
+
* `scope_id`; reads return whichever scope's row the adapter's
|
|
62
|
+
* fall-through walk surfaced first. */
|
|
63
|
+
readonly scope: string;
|
|
7
64
|
readonly name: string;
|
|
8
65
|
readonly config: McpStoredSourceData;
|
|
9
66
|
}
|
|
10
67
|
export interface McpBindingStore {
|
|
11
|
-
readonly
|
|
12
|
-
binding: McpToolBinding;
|
|
13
|
-
|
|
14
|
-
} | null>;
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
22
|
-
readonly
|
|
23
|
-
readonly
|
|
68
|
+
readonly getBinding: (toolId: string, scope: string) => Effect.Effect<{
|
|
69
|
+
readonly binding: McpToolBinding;
|
|
70
|
+
readonly namespace: string;
|
|
71
|
+
} | null, StorageFailure>;
|
|
72
|
+
readonly putBindings: (namespace: string, scope: string, entries: ReadonlyArray<{
|
|
73
|
+
readonly toolId: string;
|
|
74
|
+
readonly binding: McpToolBinding;
|
|
75
|
+
}>) => Effect.Effect<void, StorageFailure>;
|
|
76
|
+
readonly removeBindingsByNamespace: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
77
|
+
readonly getSource: (namespace: string, scope: string) => Effect.Effect<McpStoredSource | null, StorageFailure>;
|
|
78
|
+
readonly getSourceConfig: (namespace: string, scope: string) => Effect.Effect<McpStoredSourceData | null, StorageFailure>;
|
|
79
|
+
readonly putSource: (source: McpStoredSource) => Effect.Effect<void, StorageFailure>;
|
|
80
|
+
readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, StorageFailure>;
|
|
24
81
|
}
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const makeInMemoryBindingStore: () => McpBindingStore;
|
|
82
|
+
export declare const makeMcpStore: ({ adapter: db, }: StorageDeps<McpSchema>) => McpBindingStore;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/connection.d.ts
CHANGED
|
@@ -8,8 +8,10 @@ export type McpConnection = {
|
|
|
8
8
|
readonly close: () => Promise<void>;
|
|
9
9
|
};
|
|
10
10
|
export type McpConnector = Effect.Effect<McpConnection, McpConnectionError>;
|
|
11
|
-
export type RemoteConnectorInput = Omit<McpRemoteSourceData, "auth" | "remoteTransport"> & {
|
|
11
|
+
export type RemoteConnectorInput = Omit<McpRemoteSourceData, "auth" | "remoteTransport" | "headers" | "queryParams"> & {
|
|
12
12
|
readonly remoteTransport?: McpRemoteSourceData["remoteTransport"];
|
|
13
|
+
readonly headers?: Record<string, string>;
|
|
14
|
+
readonly queryParams?: Record<string, string>;
|
|
13
15
|
readonly authProvider?: OAuthClientProvider;
|
|
14
16
|
};
|
|
15
17
|
export type StdioConnectorInput = McpStdioSourceData;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/errors.d.ts
CHANGED
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
declare const McpConnectionError_base: Schema.
|
|
3
|
-
readonly
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
message: typeof Schema.String;
|
|
7
|
-
}>;
|
|
2
|
+
declare const McpConnectionError_base: Schema.Class<McpConnectionError, Schema.TaggedStruct<"McpConnectionError", {
|
|
3
|
+
readonly transport: Schema.String;
|
|
4
|
+
readonly message: Schema.String;
|
|
5
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
6
|
export declare class McpConnectionError extends McpConnectionError_base {
|
|
9
7
|
}
|
|
10
|
-
declare const McpToolDiscoveryError_base: Schema.
|
|
11
|
-
readonly
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
message: typeof Schema.String;
|
|
15
|
-
}>;
|
|
8
|
+
declare const McpToolDiscoveryError_base: Schema.Class<McpToolDiscoveryError, Schema.TaggedStruct<"McpToolDiscoveryError", {
|
|
9
|
+
readonly stage: Schema.Literals<readonly ["connect", "list_tools"]>;
|
|
10
|
+
readonly message: Schema.String;
|
|
11
|
+
}>, import("effect/Cause").YieldableError>;
|
|
16
12
|
export declare class McpToolDiscoveryError extends McpToolDiscoveryError_base {
|
|
17
13
|
}
|
|
18
|
-
declare const McpInvocationError_base: Schema.
|
|
19
|
-
readonly
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
message: typeof Schema.String;
|
|
23
|
-
}>;
|
|
14
|
+
declare const McpInvocationError_base: Schema.Class<McpInvocationError, Schema.TaggedStruct<"McpInvocationError", {
|
|
15
|
+
readonly toolName: Schema.String;
|
|
16
|
+
readonly message: Schema.String;
|
|
17
|
+
}>, import("effect/Cause").YieldableError>;
|
|
24
18
|
export declare class McpInvocationError extends McpInvocationError_base {
|
|
25
19
|
}
|
|
26
|
-
declare const McpOAuthError_base: Schema.
|
|
27
|
-
readonly
|
|
28
|
-
}
|
|
29
|
-
message: typeof Schema.String;
|
|
30
|
-
}>;
|
|
20
|
+
declare const McpOAuthError_base: Schema.Class<McpOAuthError, Schema.TaggedStruct<"McpOAuthError", {
|
|
21
|
+
readonly message: Schema.String;
|
|
22
|
+
}>, import("effect/Cause").YieldableError>;
|
|
31
23
|
export declare class McpOAuthError extends McpOAuthError_base {
|
|
32
24
|
}
|
|
33
25
|
export {};
|
package/dist/sdk/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { mcpPlugin, type McpPluginExtension } from "./plugin";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
1
|
+
export { mcpPlugin, type McpPluginExtension, type McpPluginOptions, type McpSourceConfig, type McpRemoteSourceConfig, type McpStdioSourceConfig, type McpProbeResult, type McpUpdateSourceInput, } from "./plugin";
|
|
2
|
+
export { makeMcpStore, mcpSchema, type McpBindingStore, type McpSchema, type McpStoredSource, } from "./binding-store";
|
|
3
|
+
export { McpConnectionAuth } from "./types";
|
package/dist/sdk/invoke.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { Effect,
|
|
2
|
-
import { type
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
readonly
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
readonly
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { Effect, ScopedCache } from "effect";
|
|
2
|
+
import { type Elicit } from "@executor-js/sdk/core";
|
|
3
|
+
import { McpConnectionError, McpInvocationError } from "./errors";
|
|
4
|
+
import type { McpConnection } from "./connection";
|
|
5
|
+
import type { McpStoredSourceData } from "./types";
|
|
6
|
+
export interface InvokeMcpToolInput {
|
|
7
|
+
readonly toolId: string;
|
|
8
|
+
readonly toolName: string;
|
|
9
|
+
readonly args: unknown;
|
|
10
|
+
readonly sourceData: McpStoredSourceData;
|
|
11
|
+
/** Innermost executor scope id at invoke time. Mixed into the
|
|
12
|
+
* connection cache key so per-user OAuth/secret resolution doesn't
|
|
13
|
+
* collapse multiple users onto one shared connection. */
|
|
14
|
+
readonly invokerScope: string;
|
|
15
|
+
readonly resolveConnector: () => Effect.Effect<McpConnection, McpConnectionError>;
|
|
13
16
|
readonly connectionCache: ScopedCache.ScopedCache<string, McpConnection, McpConnectionError>;
|
|
14
|
-
/** Shared map between cache lookup and invoker — set connector before cache.get */
|
|
15
17
|
readonly pendingConnectors: Map<string, Effect.Effect<McpConnection, McpConnectionError>>;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export {};
|
|
18
|
+
readonly elicit: Elicit;
|
|
19
|
+
}
|
|
20
|
+
export declare const invokeMcpTool: (input: InvokeMcpToolInput) => Effect.Effect<unknown, McpConnectionError | McpInvocationError>;
|
package/dist/sdk/manifest.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface McpToolManifest {
|
|
|
13
13
|
readonly server: McpServerMetadata | null;
|
|
14
14
|
readonly tools: readonly McpToolManifestEntry[];
|
|
15
15
|
}
|
|
16
|
+
export declare const isListToolsResult: (value: unknown) => boolean;
|
|
16
17
|
export declare const joinToolPath: (namespace: string | undefined, toolId: string) => string;
|
|
17
18
|
export declare const extractManifestFromListToolsResult: (listToolsResult: unknown, metadata?: {
|
|
18
19
|
serverInfo?: unknown;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/sdk/plugin.d.ts
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { type
|
|
3
|
-
import { type McpConnectionAuth } from "./types";
|
|
2
|
+
import { type StorageFailure } from "@executor-js/sdk/core";
|
|
4
3
|
import { type McpBindingStore, type McpStoredSource } from "./binding-store";
|
|
5
|
-
|
|
4
|
+
import { McpConnectionError, McpToolDiscoveryError } from "./errors";
|
|
5
|
+
import { type McpConnectionAuth, type SecretBackedValue } from "./types";
|
|
6
|
+
import { type ConfigFileSink } from "@executor-js/config";
|
|
7
|
+
/**
|
|
8
|
+
* Executor scope id that owns a newly-added MCP source row. Must be one
|
|
9
|
+
* of the executor's configured scopes. Admins adding a shared server at
|
|
10
|
+
* org scope pin here; per-user stdio sources can pin at the inner
|
|
11
|
+
* scope.
|
|
12
|
+
*/
|
|
13
|
+
type McpSourceScopeField = {
|
|
14
|
+
readonly scope: string;
|
|
15
|
+
};
|
|
16
|
+
export interface McpRemoteSourceConfig extends McpSourceScopeField {
|
|
6
17
|
readonly transport: "remote";
|
|
7
18
|
readonly name: string;
|
|
8
19
|
readonly endpoint: string;
|
|
9
20
|
readonly remoteTransport?: "streamable-http" | "sse" | "auto";
|
|
10
|
-
readonly queryParams?: Record<string,
|
|
11
|
-
readonly headers?: Record<string,
|
|
21
|
+
readonly queryParams?: Record<string, SecretBackedValue>;
|
|
22
|
+
readonly headers?: Record<string, SecretBackedValue>;
|
|
12
23
|
readonly namespace?: string;
|
|
13
24
|
readonly auth?: McpConnectionAuth;
|
|
14
25
|
}
|
|
15
|
-
export interface McpStdioSourceConfig {
|
|
26
|
+
export interface McpStdioSourceConfig extends McpSourceScopeField {
|
|
16
27
|
readonly transport: "stdio";
|
|
17
28
|
readonly name: string;
|
|
18
29
|
readonly command: string;
|
|
@@ -22,27 +33,6 @@ export interface McpStdioSourceConfig {
|
|
|
22
33
|
readonly namespace?: string;
|
|
23
34
|
}
|
|
24
35
|
export type McpSourceConfig = McpRemoteSourceConfig | McpStdioSourceConfig;
|
|
25
|
-
export interface McpOAuthStartInput {
|
|
26
|
-
readonly endpoint: string;
|
|
27
|
-
readonly redirectUrl: string;
|
|
28
|
-
readonly queryParams?: Record<string, string> | null;
|
|
29
|
-
}
|
|
30
|
-
export interface McpOAuthStartResponse {
|
|
31
|
-
readonly sessionId: string;
|
|
32
|
-
readonly authorizationUrl: string;
|
|
33
|
-
}
|
|
34
|
-
export interface McpOAuthCompleteInput {
|
|
35
|
-
readonly state: string;
|
|
36
|
-
readonly code?: string;
|
|
37
|
-
readonly error?: string;
|
|
38
|
-
}
|
|
39
|
-
export interface McpOAuthCompleteResponse {
|
|
40
|
-
readonly accessTokenSecretId: string;
|
|
41
|
-
readonly refreshTokenSecretId: string | null;
|
|
42
|
-
readonly tokenType: string;
|
|
43
|
-
readonly expiresAt: number | null;
|
|
44
|
-
readonly scope: string | null;
|
|
45
|
-
}
|
|
46
36
|
export interface McpProbeResult {
|
|
47
37
|
readonly connected: boolean;
|
|
48
38
|
readonly requiresOAuth: boolean;
|
|
@@ -52,28 +42,104 @@ export interface McpProbeResult {
|
|
|
52
42
|
readonly serverName: string | null;
|
|
53
43
|
}
|
|
54
44
|
export interface McpUpdateSourceInput {
|
|
45
|
+
readonly name?: string;
|
|
55
46
|
readonly endpoint?: string;
|
|
56
|
-
readonly headers?: Record<string,
|
|
57
|
-
readonly queryParams?: Record<string,
|
|
47
|
+
readonly headers?: Record<string, SecretBackedValue>;
|
|
48
|
+
readonly queryParams?: Record<string, SecretBackedValue>;
|
|
58
49
|
readonly auth?: McpConnectionAuth;
|
|
59
50
|
}
|
|
51
|
+
export interface McpProbeEndpointInput {
|
|
52
|
+
readonly endpoint: string;
|
|
53
|
+
readonly headers?: Record<string, SecretBackedValue>;
|
|
54
|
+
readonly queryParams?: Record<string, SecretBackedValue>;
|
|
55
|
+
}
|
|
56
|
+
export interface McpPluginOptions {
|
|
57
|
+
/**
|
|
58
|
+
* Allow configuring stdio-transport MCP sources. Off by default.
|
|
59
|
+
*
|
|
60
|
+
* Stdio sources spawn a local subprocess that inherits the parent
|
|
61
|
+
* `process.env`. Only enable for trusted single-user contexts.
|
|
62
|
+
*/
|
|
63
|
+
readonly dangerouslyAllowStdioMCP?: boolean;
|
|
64
|
+
/** If provided, source add/remove is mirrored to executor.jsonc
|
|
65
|
+
* (best-effort — file errors are logged, not raised). */
|
|
66
|
+
readonly configFile?: ConfigFileSink;
|
|
67
|
+
}
|
|
68
|
+
export declare const mcpPlugin: import("@executor-js/sdk/core").ConfiguredPlugin<"mcp", McpPluginExtension, McpBindingStore, McpPluginOptions, {
|
|
69
|
+
readonly mcp_source: {
|
|
70
|
+
readonly fields: {
|
|
71
|
+
readonly id: {
|
|
72
|
+
readonly type: "string";
|
|
73
|
+
readonly required: true;
|
|
74
|
+
};
|
|
75
|
+
readonly scope_id: {
|
|
76
|
+
readonly type: "string";
|
|
77
|
+
readonly required: true;
|
|
78
|
+
readonly index: true;
|
|
79
|
+
};
|
|
80
|
+
readonly name: {
|
|
81
|
+
readonly type: "string";
|
|
82
|
+
readonly required: true;
|
|
83
|
+
};
|
|
84
|
+
readonly config: {
|
|
85
|
+
readonly type: "json";
|
|
86
|
+
readonly required: true;
|
|
87
|
+
};
|
|
88
|
+
readonly created_at: {
|
|
89
|
+
readonly type: "date";
|
|
90
|
+
readonly required: true;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
readonly mcp_binding: {
|
|
95
|
+
readonly fields: {
|
|
96
|
+
readonly id: {
|
|
97
|
+
readonly type: "string";
|
|
98
|
+
readonly required: true;
|
|
99
|
+
};
|
|
100
|
+
readonly scope_id: {
|
|
101
|
+
readonly type: "string";
|
|
102
|
+
readonly required: true;
|
|
103
|
+
readonly index: true;
|
|
104
|
+
};
|
|
105
|
+
readonly source_id: {
|
|
106
|
+
readonly type: "string";
|
|
107
|
+
readonly required: true;
|
|
108
|
+
readonly index: true;
|
|
109
|
+
};
|
|
110
|
+
readonly binding: {
|
|
111
|
+
readonly type: "json";
|
|
112
|
+
readonly required: true;
|
|
113
|
+
};
|
|
114
|
+
readonly created_at: {
|
|
115
|
+
readonly type: "date";
|
|
116
|
+
readonly required: true;
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
}>;
|
|
121
|
+
/**
|
|
122
|
+
* Errors any MCP extension method may surface. The first four are
|
|
123
|
+
* plugin-domain tagged errors that flow directly to clients (4xx, each
|
|
124
|
+
* carrying its own `HttpApiSchema` status). `StorageFailure` covers
|
|
125
|
+
* raw backend failures (`StorageError`) plus `UniqueViolationError`;
|
|
126
|
+
* the HTTP edge (`@executor-js/api`'s `withCapture`) translates
|
|
127
|
+
* `StorageError` to the opaque `InternalError({ traceId })` at Layer
|
|
128
|
+
* composition. `UniqueViolationError` passes through — plugins can
|
|
129
|
+
* `Effect.catchTag` it if they want a friendlier user-facing error.
|
|
130
|
+
*/
|
|
131
|
+
export type McpExtensionFailure = McpConnectionError | McpToolDiscoveryError | StorageFailure;
|
|
60
132
|
export interface McpPluginExtension {
|
|
61
|
-
readonly probeEndpoint: (
|
|
133
|
+
readonly probeEndpoint: (input: string | McpProbeEndpointInput) => Effect.Effect<McpProbeResult, McpExtensionFailure>;
|
|
62
134
|
readonly addSource: (config: McpSourceConfig) => Effect.Effect<{
|
|
63
135
|
readonly toolCount: number;
|
|
64
136
|
readonly namespace: string;
|
|
65
|
-
},
|
|
66
|
-
readonly removeSource: (namespace: string) => Effect.Effect<void>;
|
|
67
|
-
readonly refreshSource: (namespace: string) => Effect.Effect<{
|
|
137
|
+
}, McpExtensionFailure>;
|
|
138
|
+
readonly removeSource: (namespace: string, scope: string) => Effect.Effect<void, McpExtensionFailure>;
|
|
139
|
+
readonly refreshSource: (namespace: string, scope: string) => Effect.Effect<{
|
|
68
140
|
readonly toolCount: number;
|
|
69
|
-
},
|
|
70
|
-
readonly
|
|
71
|
-
readonly
|
|
72
|
-
/** Fetch the full stored source by namespace (or null if missing) */
|
|
73
|
-
readonly getSource: (namespace: string) => Effect.Effect<McpStoredSource | null>;
|
|
74
|
-
/** Update config for an existing remote MCP source */
|
|
75
|
-
readonly updateSource: (namespace: string, input: McpUpdateSourceInput) => Effect.Effect<void>;
|
|
141
|
+
}, McpExtensionFailure>;
|
|
142
|
+
readonly getSource: (namespace: string, scope: string) => Effect.Effect<McpStoredSource | null, McpExtensionFailure>;
|
|
143
|
+
readonly updateSource: (namespace: string, scope: string, input: McpUpdateSourceInput) => Effect.Effect<void, McpExtensionFailure>;
|
|
76
144
|
}
|
|
77
|
-
export
|
|
78
|
-
readonly bindingStore?: McpBindingStore;
|
|
79
|
-
}) => ExecutorPlugin<"mcp", McpPluginExtension>;
|
|
145
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
export type McpShapeProbeResult =
|
|
3
|
+
/** Server answered initialize successfully — either a 2xx with a
|
|
4
|
+
* JSON-RPC payload, or a 401 + WWW-Authenticate: Bearer (RFC 6750
|
|
5
|
+
* challenge) that the MCP auth spec requires. */
|
|
6
|
+
{
|
|
7
|
+
readonly kind: "mcp";
|
|
8
|
+
readonly requiresAuth: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Endpoint is reachable but the response does not look like MCP. */
|
|
11
|
+
| {
|
|
12
|
+
readonly kind: "not-mcp";
|
|
13
|
+
readonly reason: string;
|
|
14
|
+
}
|
|
15
|
+
/** Transport-level failure (DNS, TLS, timeout, abort, ...). */
|
|
16
|
+
| {
|
|
17
|
+
readonly kind: "unreachable";
|
|
18
|
+
readonly reason: string;
|
|
19
|
+
};
|
|
20
|
+
export interface ProbeOptions {
|
|
21
|
+
/** Injected for tests. Defaults to the global `fetch`. */
|
|
22
|
+
readonly fetch?: typeof fetch;
|
|
23
|
+
/** Abort the request after this many ms. Default 8000. */
|
|
24
|
+
readonly timeoutMs?: number;
|
|
25
|
+
readonly headers?: Record<string, string>;
|
|
26
|
+
readonly queryParams?: Record<string, string>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Hit `endpoint` with a JSON-RPC `initialize` POST and classify the
|
|
30
|
+
* response according to the MCP authorization spec.
|
|
31
|
+
*
|
|
32
|
+
* Returns `{kind: "mcp"}` only when the endpoint either:
|
|
33
|
+
* - answers with 2xx (unauth-OK MCP server), or
|
|
34
|
+
* - responds 401 with a `Bearer` WWW-Authenticate challenge.
|
|
35
|
+
*
|
|
36
|
+
* Anything else (400, 404, 200-with-HTML, 200-with-GraphQL-errors, ...)
|
|
37
|
+
* is classified `not-mcp`. Transport errors surface as `unreachable`.
|
|
38
|
+
*/
|
|
39
|
+
export declare const probeMcpEndpointShape: (endpoint: string, options?: ProbeOptions) => Effect.Effect<McpShapeProbeResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
2
|
+
export type StdioTransportConfig = {
|
|
3
|
+
readonly command: string;
|
|
4
|
+
readonly args?: ReadonlyArray<string>;
|
|
5
|
+
readonly env?: Record<string, string>;
|
|
6
|
+
readonly cwd?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const createStdioTransport: (config: StdioTransportConfig) => StdioClientTransport;
|
|
@@ -1,114 +1,40 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
|
-
declare const McpStoredSourceSchema_base: Schema.Class<McpStoredSourceSchema, {
|
|
3
|
-
namespace:
|
|
4
|
-
name:
|
|
5
|
-
config: Schema.Union<[Schema.Struct<{
|
|
6
|
-
transport: Schema.Literal<
|
|
7
|
-
endpoint:
|
|
8
|
-
remoteTransport: Schema.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
declare const McpStoredSourceSchema_base: Schema.Class<McpStoredSourceSchema, Schema.Struct<{
|
|
3
|
+
readonly namespace: Schema.String;
|
|
4
|
+
readonly name: Schema.String;
|
|
5
|
+
readonly config: Schema.Union<readonly [Schema.Struct<{
|
|
6
|
+
readonly transport: Schema.Literal<"remote">;
|
|
7
|
+
readonly endpoint: Schema.String;
|
|
8
|
+
readonly remoteTransport: Schema.withConstructorDefault<Schema.optionalKey<Schema.Literals<readonly ["streamable-http", "sse", "auto"]>>>;
|
|
9
|
+
readonly queryParams: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
10
|
+
readonly secretId: Schema.String;
|
|
11
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
12
|
+
}>]>>>;
|
|
13
|
+
readonly headers: Schema.optional<Schema.$Record<Schema.String, Schema.Union<readonly [Schema.String, Schema.Struct<{
|
|
14
|
+
readonly secretId: Schema.String;
|
|
15
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
16
|
+
}>]>>>;
|
|
17
|
+
readonly auth: Schema.Union<readonly [Schema.Struct<{
|
|
18
|
+
readonly kind: Schema.Literal<"none">;
|
|
15
19
|
}>, Schema.Struct<{
|
|
16
|
-
kind: Schema.Literal<
|
|
17
|
-
headerName:
|
|
18
|
-
secretId:
|
|
19
|
-
prefix: Schema.optional<
|
|
20
|
+
readonly kind: Schema.Literal<"header">;
|
|
21
|
+
readonly headerName: Schema.String;
|
|
22
|
+
readonly secretId: Schema.String;
|
|
23
|
+
readonly prefix: Schema.optional<Schema.String>;
|
|
20
24
|
}>, Schema.Struct<{
|
|
21
|
-
kind: Schema.Literal<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
default: () => string;
|
|
26
|
-
}>;
|
|
27
|
-
expiresAt: Schema.NullOr<typeof Schema.Number>;
|
|
28
|
-
scope: Schema.NullOr<typeof Schema.String>;
|
|
25
|
+
readonly kind: Schema.Literal<"oauth2">;
|
|
26
|
+
readonly connectionId: Schema.String;
|
|
27
|
+
readonly clientIdSecretId: Schema.optional<Schema.String>;
|
|
28
|
+
readonly clientSecretSecretId: Schema.optional<Schema.NullOr<Schema.String>>;
|
|
29
29
|
}>]>;
|
|
30
30
|
}>, Schema.Struct<{
|
|
31
|
-
transport: Schema.Literal<
|
|
32
|
-
command:
|
|
33
|
-
args: Schema.optional<Schema
|
|
34
|
-
env: Schema.optional<Schema
|
|
35
|
-
cwd: Schema.optional<
|
|
31
|
+
readonly transport: Schema.Literal<"stdio">;
|
|
32
|
+
readonly command: Schema.String;
|
|
33
|
+
readonly args: Schema.optional<Schema.$Array<Schema.String>>;
|
|
34
|
+
readonly env: Schema.optional<Schema.$Record<Schema.String, Schema.String>>;
|
|
35
|
+
readonly cwd: Schema.optional<Schema.String>;
|
|
36
36
|
}>]>;
|
|
37
|
-
}
|
|
38
|
-
namespace: typeof Schema.String;
|
|
39
|
-
name: typeof Schema.String;
|
|
40
|
-
config: Schema.Union<[Schema.Struct<{
|
|
41
|
-
transport: Schema.Literal<["remote"]>;
|
|
42
|
-
endpoint: typeof Schema.String;
|
|
43
|
-
remoteTransport: Schema.optionalWith<Schema.Literal<["streamable-http", "sse", "auto"]>, {
|
|
44
|
-
default: () => "auto";
|
|
45
|
-
}>;
|
|
46
|
-
queryParams: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
47
|
-
headers: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
48
|
-
auth: Schema.Union<[Schema.Struct<{
|
|
49
|
-
kind: Schema.Literal<["none"]>;
|
|
50
|
-
}>, Schema.Struct<{
|
|
51
|
-
kind: Schema.Literal<["header"]>;
|
|
52
|
-
headerName: typeof Schema.String;
|
|
53
|
-
secretId: typeof Schema.String;
|
|
54
|
-
prefix: Schema.optional<typeof Schema.String>;
|
|
55
|
-
}>, Schema.Struct<{
|
|
56
|
-
kind: Schema.Literal<["oauth2"]>;
|
|
57
|
-
accessTokenSecretId: typeof Schema.String;
|
|
58
|
-
refreshTokenSecretId: Schema.NullOr<typeof Schema.String>;
|
|
59
|
-
tokenType: Schema.optionalWith<typeof Schema.String, {
|
|
60
|
-
default: () => string;
|
|
61
|
-
}>;
|
|
62
|
-
expiresAt: Schema.NullOr<typeof Schema.Number>;
|
|
63
|
-
scope: Schema.NullOr<typeof Schema.String>;
|
|
64
|
-
}>]>;
|
|
65
|
-
}>, Schema.Struct<{
|
|
66
|
-
transport: Schema.Literal<["stdio"]>;
|
|
67
|
-
command: typeof Schema.String;
|
|
68
|
-
args: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
69
|
-
env: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.String>>;
|
|
70
|
-
cwd: Schema.optional<typeof Schema.String>;
|
|
71
|
-
}>]>;
|
|
72
|
-
}>, never, {
|
|
73
|
-
readonly name: string;
|
|
74
|
-
} & {
|
|
75
|
-
readonly namespace: string;
|
|
76
|
-
} & {
|
|
77
|
-
readonly config: {
|
|
78
|
-
readonly endpoint: string;
|
|
79
|
-
readonly transport: "remote";
|
|
80
|
-
readonly remoteTransport: "streamable-http" | "sse" | "auto";
|
|
81
|
-
readonly queryParams?: {
|
|
82
|
-
readonly [x: string]: string;
|
|
83
|
-
} | undefined;
|
|
84
|
-
readonly headers?: {
|
|
85
|
-
readonly [x: string]: string;
|
|
86
|
-
} | undefined;
|
|
87
|
-
readonly auth: {
|
|
88
|
-
readonly kind: "none";
|
|
89
|
-
} | {
|
|
90
|
-
readonly secretId: string;
|
|
91
|
-
readonly kind: "header";
|
|
92
|
-
readonly headerName: string;
|
|
93
|
-
readonly prefix?: string | undefined;
|
|
94
|
-
} | {
|
|
95
|
-
readonly kind: "oauth2";
|
|
96
|
-
readonly scope: string | null;
|
|
97
|
-
readonly accessTokenSecretId: string;
|
|
98
|
-
readonly refreshTokenSecretId: string | null;
|
|
99
|
-
readonly tokenType: string;
|
|
100
|
-
readonly expiresAt: number | null;
|
|
101
|
-
};
|
|
102
|
-
} | {
|
|
103
|
-
readonly transport: "stdio";
|
|
104
|
-
readonly command: string;
|
|
105
|
-
readonly args?: readonly string[] | undefined;
|
|
106
|
-
readonly env?: {
|
|
107
|
-
readonly [x: string]: string;
|
|
108
|
-
} | undefined;
|
|
109
|
-
readonly cwd?: string | undefined;
|
|
110
|
-
};
|
|
111
|
-
}, {}, {}>;
|
|
37
|
+
}>, {}>;
|
|
112
38
|
export declare class McpStoredSourceSchema extends McpStoredSourceSchema_base {
|
|
113
39
|
}
|
|
114
40
|
export type McpStoredSourceSchemaType = typeof McpStoredSourceSchema.Type;
|