@open-wa/mcp 5.0.0-alpha.0
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/.turbo/turbo-build.log +33 -0
- package/.turbo/turbo-test.log +16 -0
- package/CHANGELOG.md +25 -0
- package/LICENSE.md +67 -0
- package/README.md +19 -0
- package/dist/index.cjs +309 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +244 -0
- package/dist/index.d.mts +244 -0
- package/dist/index.mjs +299 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +48 -0
- package/src/adapter/hono-mcp.ts +207 -0
- package/src/execution/args.ts +59 -0
- package/src/execution/errors.ts +56 -0
- package/src/execution/invoke.ts +32 -0
- package/src/execution/kernel.ts +104 -0
- package/src/index.ts +7 -0
- package/src/manifest.ts +91 -0
- package/src/tool-naming.ts +11 -0
- package/test/adapter.test.ts +181 -0
- package/test/kernel.test.ts +151 -0
- package/test/manifest.test.ts +61 -0
- package/tsdown.config.ts +12 -0
- package/vitest.config.ts +10 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { HttpMethodDefinition } from "@open-wa/schema/http-manifest";
|
|
2
|
+
import { Config, HttpMethodDefinition as HttpMethodDefinition$1 } from "@open-wa/schema";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
|
|
5
|
+
//#region src/manifest.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* MCP-specific projection of a method capability.
|
|
8
|
+
*/
|
|
9
|
+
interface McpToolDefinition {
|
|
10
|
+
/**
|
|
11
|
+
* The canonical namespaced tool name for MCP.
|
|
12
|
+
* @example 'messages.sendText'
|
|
13
|
+
*/
|
|
14
|
+
toolName: string;
|
|
15
|
+
/**
|
|
16
|
+
* The raw function name in the client.
|
|
17
|
+
* @example 'sendText'
|
|
18
|
+
*/
|
|
19
|
+
functionName: string;
|
|
20
|
+
/**
|
|
21
|
+
* The namespaced name (method part only).
|
|
22
|
+
* @example 'sendText'
|
|
23
|
+
*/
|
|
24
|
+
namespacedName: string;
|
|
25
|
+
/**
|
|
26
|
+
* The namespace this method belongs to.
|
|
27
|
+
* @example 'messages'
|
|
28
|
+
*/
|
|
29
|
+
namespace: string;
|
|
30
|
+
/**
|
|
31
|
+
* Human-readable description of the tool.
|
|
32
|
+
*/
|
|
33
|
+
description: string;
|
|
34
|
+
/**
|
|
35
|
+
* Zod input schema.
|
|
36
|
+
*/
|
|
37
|
+
inputSchema: HttpMethodDefinition['inputSchema'];
|
|
38
|
+
/**
|
|
39
|
+
* Zod output schema.
|
|
40
|
+
*/
|
|
41
|
+
outputSchema: HttpMethodDefinition['outputSchema'];
|
|
42
|
+
/**
|
|
43
|
+
* Preserved parameter order for positional resolution.
|
|
44
|
+
*/
|
|
45
|
+
parameterOrder: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Known aliases for this method.
|
|
48
|
+
*/
|
|
49
|
+
aliases: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Deprecated aliases for this method.
|
|
52
|
+
*/
|
|
53
|
+
deprecatedAliases: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Map of payload key aliases to canonical keys.
|
|
56
|
+
*/
|
|
57
|
+
keyAliasMap: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Optional metadata hints for AI clients.
|
|
60
|
+
*/
|
|
61
|
+
annotations?: {
|
|
62
|
+
title?: string;
|
|
63
|
+
readOnlyHint?: boolean;
|
|
64
|
+
destructiveHint?: boolean;
|
|
65
|
+
idempotentHint?: boolean;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Projects the schema registry into a list of canonical MCP tool definitions.
|
|
70
|
+
*/
|
|
71
|
+
declare function getMcpToolDefinitions(basePath?: string): McpToolDefinition[];
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/tool-naming.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Logic for stable, namespaced MCP tool names.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* Returns the canonical namespaced tool name for MCP.
|
|
79
|
+
* @example getCanonicalToolName('messages', 'sendText') -> 'messages.sendText'
|
|
80
|
+
*/
|
|
81
|
+
declare function getCanonicalToolName(namespace: string, methodName: string): string;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/execution/kernel.d.ts
|
|
84
|
+
/**
|
|
85
|
+
* Context required to execute an Open-WA capability via any transport.
|
|
86
|
+
*/
|
|
87
|
+
interface ExecutionContext {
|
|
88
|
+
/**
|
|
89
|
+
* The active client instance or proxy.
|
|
90
|
+
*/
|
|
91
|
+
client: Record<string, (...args: any[]) => Promise<any> | any> | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* The metadata definition for the method being invoked.
|
|
94
|
+
*/
|
|
95
|
+
definition: HttpMethodDefinition$1;
|
|
96
|
+
/**
|
|
97
|
+
* The raw input payload (merged query + body, or MCP arguments).
|
|
98
|
+
*/
|
|
99
|
+
payload: Record<string, unknown>;
|
|
100
|
+
/**
|
|
101
|
+
* Optional diagnostic emitter for logging.
|
|
102
|
+
*/
|
|
103
|
+
elasticEmitter?: {
|
|
104
|
+
log: (data: any) => void;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The unique session identifier.
|
|
108
|
+
*/
|
|
109
|
+
sessionId: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Standardized result of a capability execution.
|
|
113
|
+
*/
|
|
114
|
+
interface ExecutionResult<T = any> {
|
|
115
|
+
success: boolean;
|
|
116
|
+
data?: T;
|
|
117
|
+
error?: string;
|
|
118
|
+
details?: any;
|
|
119
|
+
status: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The shared execution kernel for Open-WA capabilities.
|
|
123
|
+
* Ensures strict parity between HTTP API and MCP transport by centralizing
|
|
124
|
+
* normalization, validation, and invocation logic.
|
|
125
|
+
*/
|
|
126
|
+
declare function executeCapability(ctx: ExecutionContext): Promise<ExecutionResult>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/execution/args.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Normalizes an input payload into a form suitable for schema validation.
|
|
131
|
+
* Handles:
|
|
132
|
+
* 1. Array-based positional arguments
|
|
133
|
+
* 2. Mixed key aliases (legacy vs canonical)
|
|
134
|
+
* 3. Wrapped 'args' or 'input' properties
|
|
135
|
+
*/
|
|
136
|
+
declare function normalizeMethodPayload(def: HttpMethodDefinition$1, payload: unknown): any;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/execution/invoke.d.ts
|
|
139
|
+
interface ClientMethodDefinitionLike {
|
|
140
|
+
functionName: string;
|
|
141
|
+
parameterOrder: string[];
|
|
142
|
+
wapiOverride?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Invokes a client method by resolving its implementation from the client instance
|
|
146
|
+
* and mapping the payload to positional arguments if necessary.
|
|
147
|
+
*/
|
|
148
|
+
declare function invokeClientMethod(client: Record<string, (...args: any[]) => Promise<any> | any> | undefined, def: ClientMethodDefinitionLike, payload: unknown): Promise<any>;
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/execution/errors.d.ts
|
|
151
|
+
/**
|
|
152
|
+
* MCP execution error types.
|
|
153
|
+
*
|
|
154
|
+
* Maintains the separation between protocol-level errors
|
|
155
|
+
* (JSON-RPC envelope issues) and tool-level errors
|
|
156
|
+
* (open-wa runtime invocation failures).
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* A tool execution error from the open-wa runtime.
|
|
160
|
+
* This should be surfaced as `isError: true` in MCP tool results,
|
|
161
|
+
* NOT as a JSON-RPC protocol error.
|
|
162
|
+
*/
|
|
163
|
+
declare class ToolExecutionError extends Error {
|
|
164
|
+
readonly statusCode: number;
|
|
165
|
+
readonly details?: unknown;
|
|
166
|
+
constructor(message: string, statusCode?: number, details?: unknown);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A validation error from Zod schema parsing.
|
|
170
|
+
* This should be surfaced as `isError: true` in MCP tool results
|
|
171
|
+
* with the validation details attached.
|
|
172
|
+
*/
|
|
173
|
+
declare class ToolValidationError extends ToolExecutionError {
|
|
174
|
+
constructor(message: string, details?: unknown);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Thrown when the client/session is not ready for execution.
|
|
178
|
+
*/
|
|
179
|
+
declare class SessionNotReadyError extends ToolExecutionError {
|
|
180
|
+
constructor(message?: string);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Thrown when authentication is missing or invalid.
|
|
184
|
+
*/
|
|
185
|
+
declare class AuthenticationError extends ToolExecutionError {
|
|
186
|
+
constructor(message?: string);
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/adapter/hono-mcp.d.ts
|
|
190
|
+
interface HonoMcpAdapterOptions {
|
|
191
|
+
config: Config;
|
|
192
|
+
/**
|
|
193
|
+
* Getter for the active client instance.
|
|
194
|
+
*/
|
|
195
|
+
clientSource: () => Record<string, any> | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Optional logging emitter.
|
|
198
|
+
*/
|
|
199
|
+
elasticEmitter?: {
|
|
200
|
+
log: (data: any) => void;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Base path for tool documentation links.
|
|
204
|
+
*/
|
|
205
|
+
basePath?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Getter for session readiness state.
|
|
208
|
+
* Used for lifecycle gating parity with HTTP transport.
|
|
209
|
+
*/
|
|
210
|
+
isSessionConnected?: () => boolean;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Creates an MCP adapter using the Streamable HTTP transport (single-endpoint).
|
|
214
|
+
*
|
|
215
|
+
* open-wa product decision:
|
|
216
|
+
* hosted MCP is Easy API-only and unavailable through createClient()
|
|
217
|
+
*
|
|
218
|
+
* This adapter:
|
|
219
|
+
* - Uses WebStandardStreamableHTTPServerTransport for a single-endpoint /mcp shape
|
|
220
|
+
* - Enforces Easy API API-key auth on every request
|
|
221
|
+
* - Gates tool execution on session readiness (parity with HTTP transport)
|
|
222
|
+
* - Returns protocol errors for malformed protocol requests
|
|
223
|
+
* - Returns tool-level errors for open-wa execution failures
|
|
224
|
+
*/
|
|
225
|
+
declare function createHonoMcpAdapter(options: HonoMcpAdapterOptions): {
|
|
226
|
+
/**
|
|
227
|
+
* Mounts the MCP Streamable HTTP endpoint on the provided Hono app.
|
|
228
|
+
*
|
|
229
|
+
* This creates a single endpoint at `path` that handles:
|
|
230
|
+
* - POST: JSON-RPC messages (initialize, tools/list, tools/call)
|
|
231
|
+
* - GET: Server-initiated SSE stream
|
|
232
|
+
* - DELETE: Session termination
|
|
233
|
+
*
|
|
234
|
+
* API-key auth is enforced on every request before delegation to MCP.
|
|
235
|
+
*/
|
|
236
|
+
mount: (app: Hono, path: string) => void;
|
|
237
|
+
/**
|
|
238
|
+
* Cleanly shut down the MCP transport.
|
|
239
|
+
*/
|
|
240
|
+
close: () => Promise<void>;
|
|
241
|
+
};
|
|
242
|
+
//#endregion
|
|
243
|
+
export { AuthenticationError, ClientMethodDefinitionLike, ExecutionContext, ExecutionResult, HonoMcpAdapterOptions, McpToolDefinition, SessionNotReadyError, ToolExecutionError, ToolValidationError, createHonoMcpAdapter, executeCapability, getCanonicalToolName, getMcpToolDefinitions, invokeClientMethod, normalizeMethodPayload };
|
|
244
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { HttpMethodDefinition } from "@open-wa/schema/http-manifest";
|
|
2
|
+
import { Config, HttpMethodDefinition as HttpMethodDefinition$1 } from "@open-wa/schema";
|
|
3
|
+
import { Hono } from "hono";
|
|
4
|
+
|
|
5
|
+
//#region src/manifest.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* MCP-specific projection of a method capability.
|
|
8
|
+
*/
|
|
9
|
+
interface McpToolDefinition {
|
|
10
|
+
/**
|
|
11
|
+
* The canonical namespaced tool name for MCP.
|
|
12
|
+
* @example 'messages.sendText'
|
|
13
|
+
*/
|
|
14
|
+
toolName: string;
|
|
15
|
+
/**
|
|
16
|
+
* The raw function name in the client.
|
|
17
|
+
* @example 'sendText'
|
|
18
|
+
*/
|
|
19
|
+
functionName: string;
|
|
20
|
+
/**
|
|
21
|
+
* The namespaced name (method part only).
|
|
22
|
+
* @example 'sendText'
|
|
23
|
+
*/
|
|
24
|
+
namespacedName: string;
|
|
25
|
+
/**
|
|
26
|
+
* The namespace this method belongs to.
|
|
27
|
+
* @example 'messages'
|
|
28
|
+
*/
|
|
29
|
+
namespace: string;
|
|
30
|
+
/**
|
|
31
|
+
* Human-readable description of the tool.
|
|
32
|
+
*/
|
|
33
|
+
description: string;
|
|
34
|
+
/**
|
|
35
|
+
* Zod input schema.
|
|
36
|
+
*/
|
|
37
|
+
inputSchema: HttpMethodDefinition['inputSchema'];
|
|
38
|
+
/**
|
|
39
|
+
* Zod output schema.
|
|
40
|
+
*/
|
|
41
|
+
outputSchema: HttpMethodDefinition['outputSchema'];
|
|
42
|
+
/**
|
|
43
|
+
* Preserved parameter order for positional resolution.
|
|
44
|
+
*/
|
|
45
|
+
parameterOrder: string[];
|
|
46
|
+
/**
|
|
47
|
+
* Known aliases for this method.
|
|
48
|
+
*/
|
|
49
|
+
aliases: string[];
|
|
50
|
+
/**
|
|
51
|
+
* Deprecated aliases for this method.
|
|
52
|
+
*/
|
|
53
|
+
deprecatedAliases: string[];
|
|
54
|
+
/**
|
|
55
|
+
* Map of payload key aliases to canonical keys.
|
|
56
|
+
*/
|
|
57
|
+
keyAliasMap: Record<string, string>;
|
|
58
|
+
/**
|
|
59
|
+
* Optional metadata hints for AI clients.
|
|
60
|
+
*/
|
|
61
|
+
annotations?: {
|
|
62
|
+
title?: string;
|
|
63
|
+
readOnlyHint?: boolean;
|
|
64
|
+
destructiveHint?: boolean;
|
|
65
|
+
idempotentHint?: boolean;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Projects the schema registry into a list of canonical MCP tool definitions.
|
|
70
|
+
*/
|
|
71
|
+
declare function getMcpToolDefinitions(basePath?: string): McpToolDefinition[];
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region src/tool-naming.d.ts
|
|
74
|
+
/**
|
|
75
|
+
* Logic for stable, namespaced MCP tool names.
|
|
76
|
+
*/
|
|
77
|
+
/**
|
|
78
|
+
* Returns the canonical namespaced tool name for MCP.
|
|
79
|
+
* @example getCanonicalToolName('messages', 'sendText') -> 'messages.sendText'
|
|
80
|
+
*/
|
|
81
|
+
declare function getCanonicalToolName(namespace: string, methodName: string): string;
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region src/execution/kernel.d.ts
|
|
84
|
+
/**
|
|
85
|
+
* Context required to execute an Open-WA capability via any transport.
|
|
86
|
+
*/
|
|
87
|
+
interface ExecutionContext {
|
|
88
|
+
/**
|
|
89
|
+
* The active client instance or proxy.
|
|
90
|
+
*/
|
|
91
|
+
client: Record<string, (...args: any[]) => Promise<any> | any> | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* The metadata definition for the method being invoked.
|
|
94
|
+
*/
|
|
95
|
+
definition: HttpMethodDefinition$1;
|
|
96
|
+
/**
|
|
97
|
+
* The raw input payload (merged query + body, or MCP arguments).
|
|
98
|
+
*/
|
|
99
|
+
payload: Record<string, unknown>;
|
|
100
|
+
/**
|
|
101
|
+
* Optional diagnostic emitter for logging.
|
|
102
|
+
*/
|
|
103
|
+
elasticEmitter?: {
|
|
104
|
+
log: (data: any) => void;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* The unique session identifier.
|
|
108
|
+
*/
|
|
109
|
+
sessionId: string;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Standardized result of a capability execution.
|
|
113
|
+
*/
|
|
114
|
+
interface ExecutionResult<T = any> {
|
|
115
|
+
success: boolean;
|
|
116
|
+
data?: T;
|
|
117
|
+
error?: string;
|
|
118
|
+
details?: any;
|
|
119
|
+
status: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* The shared execution kernel for Open-WA capabilities.
|
|
123
|
+
* Ensures strict parity between HTTP API and MCP transport by centralizing
|
|
124
|
+
* normalization, validation, and invocation logic.
|
|
125
|
+
*/
|
|
126
|
+
declare function executeCapability(ctx: ExecutionContext): Promise<ExecutionResult>;
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/execution/args.d.ts
|
|
129
|
+
/**
|
|
130
|
+
* Normalizes an input payload into a form suitable for schema validation.
|
|
131
|
+
* Handles:
|
|
132
|
+
* 1. Array-based positional arguments
|
|
133
|
+
* 2. Mixed key aliases (legacy vs canonical)
|
|
134
|
+
* 3. Wrapped 'args' or 'input' properties
|
|
135
|
+
*/
|
|
136
|
+
declare function normalizeMethodPayload(def: HttpMethodDefinition$1, payload: unknown): any;
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/execution/invoke.d.ts
|
|
139
|
+
interface ClientMethodDefinitionLike {
|
|
140
|
+
functionName: string;
|
|
141
|
+
parameterOrder: string[];
|
|
142
|
+
wapiOverride?: string;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Invokes a client method by resolving its implementation from the client instance
|
|
146
|
+
* and mapping the payload to positional arguments if necessary.
|
|
147
|
+
*/
|
|
148
|
+
declare function invokeClientMethod(client: Record<string, (...args: any[]) => Promise<any> | any> | undefined, def: ClientMethodDefinitionLike, payload: unknown): Promise<any>;
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/execution/errors.d.ts
|
|
151
|
+
/**
|
|
152
|
+
* MCP execution error types.
|
|
153
|
+
*
|
|
154
|
+
* Maintains the separation between protocol-level errors
|
|
155
|
+
* (JSON-RPC envelope issues) and tool-level errors
|
|
156
|
+
* (open-wa runtime invocation failures).
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* A tool execution error from the open-wa runtime.
|
|
160
|
+
* This should be surfaced as `isError: true` in MCP tool results,
|
|
161
|
+
* NOT as a JSON-RPC protocol error.
|
|
162
|
+
*/
|
|
163
|
+
declare class ToolExecutionError extends Error {
|
|
164
|
+
readonly statusCode: number;
|
|
165
|
+
readonly details?: unknown;
|
|
166
|
+
constructor(message: string, statusCode?: number, details?: unknown);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* A validation error from Zod schema parsing.
|
|
170
|
+
* This should be surfaced as `isError: true` in MCP tool results
|
|
171
|
+
* with the validation details attached.
|
|
172
|
+
*/
|
|
173
|
+
declare class ToolValidationError extends ToolExecutionError {
|
|
174
|
+
constructor(message: string, details?: unknown);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Thrown when the client/session is not ready for execution.
|
|
178
|
+
*/
|
|
179
|
+
declare class SessionNotReadyError extends ToolExecutionError {
|
|
180
|
+
constructor(message?: string);
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Thrown when authentication is missing or invalid.
|
|
184
|
+
*/
|
|
185
|
+
declare class AuthenticationError extends ToolExecutionError {
|
|
186
|
+
constructor(message?: string);
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/adapter/hono-mcp.d.ts
|
|
190
|
+
interface HonoMcpAdapterOptions {
|
|
191
|
+
config: Config;
|
|
192
|
+
/**
|
|
193
|
+
* Getter for the active client instance.
|
|
194
|
+
*/
|
|
195
|
+
clientSource: () => Record<string, any> | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* Optional logging emitter.
|
|
198
|
+
*/
|
|
199
|
+
elasticEmitter?: {
|
|
200
|
+
log: (data: any) => void;
|
|
201
|
+
};
|
|
202
|
+
/**
|
|
203
|
+
* Base path for tool documentation links.
|
|
204
|
+
*/
|
|
205
|
+
basePath?: string;
|
|
206
|
+
/**
|
|
207
|
+
* Getter for session readiness state.
|
|
208
|
+
* Used for lifecycle gating parity with HTTP transport.
|
|
209
|
+
*/
|
|
210
|
+
isSessionConnected?: () => boolean;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Creates an MCP adapter using the Streamable HTTP transport (single-endpoint).
|
|
214
|
+
*
|
|
215
|
+
* open-wa product decision:
|
|
216
|
+
* hosted MCP is Easy API-only and unavailable through createClient()
|
|
217
|
+
*
|
|
218
|
+
* This adapter:
|
|
219
|
+
* - Uses WebStandardStreamableHTTPServerTransport for a single-endpoint /mcp shape
|
|
220
|
+
* - Enforces Easy API API-key auth on every request
|
|
221
|
+
* - Gates tool execution on session readiness (parity with HTTP transport)
|
|
222
|
+
* - Returns protocol errors for malformed protocol requests
|
|
223
|
+
* - Returns tool-level errors for open-wa execution failures
|
|
224
|
+
*/
|
|
225
|
+
declare function createHonoMcpAdapter(options: HonoMcpAdapterOptions): {
|
|
226
|
+
/**
|
|
227
|
+
* Mounts the MCP Streamable HTTP endpoint on the provided Hono app.
|
|
228
|
+
*
|
|
229
|
+
* This creates a single endpoint at `path` that handles:
|
|
230
|
+
* - POST: JSON-RPC messages (initialize, tools/list, tools/call)
|
|
231
|
+
* - GET: Server-initiated SSE stream
|
|
232
|
+
* - DELETE: Session termination
|
|
233
|
+
*
|
|
234
|
+
* API-key auth is enforced on every request before delegation to MCP.
|
|
235
|
+
*/
|
|
236
|
+
mount: (app: Hono, path: string) => void;
|
|
237
|
+
/**
|
|
238
|
+
* Cleanly shut down the MCP transport.
|
|
239
|
+
*/
|
|
240
|
+
close: () => Promise<void>;
|
|
241
|
+
};
|
|
242
|
+
//#endregion
|
|
243
|
+
export { AuthenticationError, ClientMethodDefinitionLike, ExecutionContext, ExecutionResult, HonoMcpAdapterOptions, McpToolDefinition, SessionNotReadyError, ToolExecutionError, ToolValidationError, createHonoMcpAdapter, executeCapability, getCanonicalToolName, getMcpToolDefinitions, invokeClientMethod, normalizeMethodPayload };
|
|
244
|
+
//# sourceMappingURL=index.d.mts.map
|