mcp-use 0.2.0 → 1.0.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/dist/chunk-2HFIPY7C.js +429 -0
- package/dist/chunk-4DEFXVWT.js +680 -0
- package/dist/chunk-JXLQRAW2.js +532 -0
- package/dist/chunk-SHUYVCID.js +6 -0
- package/dist/chunk-YUSC6R6V.js +299 -0
- package/dist/index.cjs +5762 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3767 -22
- package/dist/langfuse-YA2S23SM.js +13 -0
- package/dist/src/agents/remote.d.ts.map +1 -1
- package/dist/src/agents/utils/ai_sdk.d.ts.map +1 -1
- package/dist/src/auth/browser-provider.d.ts +52 -0
- package/dist/src/auth/browser-provider.d.ts.map +1 -0
- package/dist/src/auth/callback.d.ts +6 -0
- package/dist/src/auth/callback.d.ts.map +1 -0
- package/dist/src/auth/index.d.ts +7 -0
- package/dist/src/auth/index.d.ts.map +1 -0
- package/dist/src/auth/types.d.ts +18 -0
- package/dist/src/auth/types.d.ts.map +1 -0
- package/dist/src/browser.cjs +323 -0
- package/dist/src/browser.d.ts +5 -46
- package/dist/src/browser.d.ts.map +1 -1
- package/dist/src/browser.js +9 -75
- package/dist/src/oauth-helper.d.ts +2 -12
- package/dist/src/oauth-helper.d.ts.map +1 -1
- package/dist/src/react/index.cjs +986 -0
- package/dist/src/react/index.d.ts +9 -0
- package/dist/src/react/index.d.ts.map +1 -0
- package/dist/src/react/index.js +11 -0
- package/dist/src/react/types.d.ts +139 -0
- package/dist/src/react/types.d.ts.map +1 -0
- package/dist/src/react/useMcp.d.ts +3 -0
- package/dist/src/react/useMcp.d.ts.map +1 -0
- package/dist/src/server/index.cjs +566 -0
- package/dist/src/server/index.d.ts +3 -0
- package/dist/src/server/index.d.ts.map +1 -0
- package/dist/src/server/index.js +9 -0
- package/dist/src/server/logging.d.ts +16 -0
- package/dist/src/server/logging.d.ts.map +1 -0
- package/dist/src/server/mcp-server.d.ts +282 -0
- package/dist/src/server/mcp-server.d.ts.map +1 -0
- package/dist/src/server/types.d.ts +47 -0
- package/dist/src/server/types.d.ts.map +1 -0
- package/dist/src/utils/assert.d.ts +8 -0
- package/dist/src/utils/assert.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +67 -40
- package/dist/src/adapters/base.js +0 -124
- package/dist/src/adapters/index.js +0 -2
- package/dist/src/adapters/langchain_adapter.js +0 -49
- package/dist/src/agents/base.js +0 -9
- package/dist/src/agents/index.js +0 -3
- package/dist/src/agents/mcp_agent.js +0 -1002
- package/dist/src/agents/prompts/system_prompt_builder.js +0 -40
- package/dist/src/agents/prompts/templates.js +0 -39
- package/dist/src/agents/remote.js +0 -264
- package/dist/src/agents/utils/ai_sdk.js +0 -62
- package/dist/src/agents/utils/index.js +0 -1
- package/dist/src/client/base.js +0 -119
- package/dist/src/client.js +0 -50
- package/dist/src/config.js +0 -34
- package/dist/src/connectors/base.js +0 -143
- package/dist/src/connectors/http.js +0 -150
- package/dist/src/connectors/index.js +0 -4
- package/dist/src/connectors/stdio.js +0 -68
- package/dist/src/connectors/websocket.js +0 -157
- package/dist/src/logging.js +0 -232
- package/dist/src/managers/index.js +0 -2
- package/dist/src/managers/server_manager.js +0 -106
- package/dist/src/managers/tools/acquire_active_mcp_server.js +0 -17
- package/dist/src/managers/tools/add_server_from_config.js +0 -40
- package/dist/src/managers/tools/base.js +0 -17
- package/dist/src/managers/tools/connect_mcp_server.js +0 -46
- package/dist/src/managers/tools/index.js +0 -5
- package/dist/src/managers/tools/list_mcp_servers.js +0 -33
- package/dist/src/managers/tools/release_mcp_server_connection.js +0 -19
- package/dist/src/oauth-helper.js +0 -427
- package/dist/src/observability/index.js +0 -12
- package/dist/src/observability/langfuse.js +0 -211
- package/dist/src/observability/manager.js +0 -199
- package/dist/src/observability/types.js +0 -4
- package/dist/src/session.js +0 -23
- package/dist/src/task_managers/base.js +0 -127
- package/dist/src/task_managers/index.js +0 -5
- package/dist/src/task_managers/sse.js +0 -43
- package/dist/src/task_managers/stdio.js +0 -51
- package/dist/src/task_managers/streamable_http.js +0 -50
- package/dist/src/task_managers/websocket.js +0 -67
- package/dist/src/telemetry/events.js +0 -44
- package/dist/src/telemetry/index.js +0 -8
- package/dist/src/telemetry/telemetry.js +0 -324
- package/dist/src/telemetry/utils.js +0 -39
- package/dist/tests/ai_sdk_compatibility.test.js +0 -214
- package/dist/tests/stream_events.test.js +0 -307
- package/dist/tests/stream_events_simple.test.js +0 -179
- package/dist/vitest.config.js +0 -21
@@ -0,0 +1,282 @@
|
|
1
|
+
import type { PromptDefinition, ResourceDefinition, ServerConfig, ToolDefinition } from './types.js';
|
2
|
+
import { type Express } from 'express';
|
3
|
+
export declare class McpServer {
|
4
|
+
private server;
|
5
|
+
private config;
|
6
|
+
private app;
|
7
|
+
private mcpMounted;
|
8
|
+
private inspectorMounted;
|
9
|
+
private serverPort?;
|
10
|
+
/**
|
11
|
+
* Creates a new MCP server instance with Express integration
|
12
|
+
*
|
13
|
+
* Initializes the server with the provided configuration, sets up CORS headers,
|
14
|
+
* configures widget serving routes, and creates a proxy that allows direct
|
15
|
+
* access to Express methods while preserving MCP server functionality.
|
16
|
+
*
|
17
|
+
* @param config - Server configuration including name, version, and description
|
18
|
+
* @returns A proxied McpServer instance that supports both MCP and Express methods
|
19
|
+
*/
|
20
|
+
constructor(config: ServerConfig);
|
21
|
+
/**
|
22
|
+
* Define a static resource that can be accessed by clients
|
23
|
+
*
|
24
|
+
* Registers a resource with the MCP server that clients can access via HTTP.
|
25
|
+
* Resources are static content like files, data, or pre-computed results that
|
26
|
+
* can be retrieved by clients without requiring parameters.
|
27
|
+
*
|
28
|
+
* @param resourceDefinition - Configuration object containing resource metadata and handler function
|
29
|
+
* @param resourceDefinition.name - Unique identifier for the resource
|
30
|
+
* @param resourceDefinition.uri - URI pattern for accessing the resource
|
31
|
+
* @param resourceDefinition.resource - Resource metadata (mime type, description, etc.)
|
32
|
+
* @param resourceDefinition.fn - Async function that returns the resource content
|
33
|
+
* @returns The server instance for method chaining
|
34
|
+
*
|
35
|
+
* @example
|
36
|
+
* ```typescript
|
37
|
+
* server.resource({
|
38
|
+
* name: 'config',
|
39
|
+
* uri: 'config://app-settings',
|
40
|
+
* resource: { mimeType: 'application/json' },
|
41
|
+
* fn: async () => ({ theme: 'dark', language: 'en' })
|
42
|
+
* })
|
43
|
+
* ```
|
44
|
+
*/
|
45
|
+
resource(resourceDefinition: ResourceDefinition): this;
|
46
|
+
/**
|
47
|
+
* Define a dynamic resource template with parameters
|
48
|
+
*/
|
49
|
+
/**
|
50
|
+
* Define a tool that can be called by clients
|
51
|
+
*
|
52
|
+
* Registers a tool with the MCP server that clients can invoke with parameters.
|
53
|
+
* Tools are functions that perform actions, computations, or operations and
|
54
|
+
* return results. They accept structured input parameters and return structured output.
|
55
|
+
*
|
56
|
+
* @param toolDefinition - Configuration object containing tool metadata and handler function
|
57
|
+
* @param toolDefinition.name - Unique identifier for the tool
|
58
|
+
* @param toolDefinition.description - Human-readable description of what the tool does
|
59
|
+
* @param toolDefinition.inputs - Array of input parameter definitions with types and validation
|
60
|
+
* @param toolDefinition.fn - Async function that executes the tool logic with provided parameters
|
61
|
+
* @returns The server instance for method chaining
|
62
|
+
*
|
63
|
+
* @example
|
64
|
+
* ```typescript
|
65
|
+
* server.tool({
|
66
|
+
* name: 'calculate',
|
67
|
+
* description: 'Performs mathematical calculations',
|
68
|
+
* inputs: [
|
69
|
+
* { name: 'expression', type: 'string', required: true },
|
70
|
+
* { name: 'precision', type: 'number', required: false }
|
71
|
+
* ],
|
72
|
+
* fn: async ({ expression, precision = 2 }) => {
|
73
|
+
* const result = eval(expression)
|
74
|
+
* return { result: Number(result.toFixed(precision)) }
|
75
|
+
* }
|
76
|
+
* })
|
77
|
+
* ```
|
78
|
+
*/
|
79
|
+
tool(toolDefinition: ToolDefinition): this;
|
80
|
+
/**
|
81
|
+
* Define a prompt template
|
82
|
+
*
|
83
|
+
* Registers a prompt template with the MCP server that clients can use to generate
|
84
|
+
* structured prompts for AI models. Prompt templates accept parameters and return
|
85
|
+
* formatted text that can be used as input to language models or other AI systems.
|
86
|
+
*
|
87
|
+
* @param promptDefinition - Configuration object containing prompt metadata and handler function
|
88
|
+
* @param promptDefinition.name - Unique identifier for the prompt template
|
89
|
+
* @param promptDefinition.description - Human-readable description of the prompt's purpose
|
90
|
+
* @param promptDefinition.args - Array of argument definitions with types and validation
|
91
|
+
* @param promptDefinition.fn - Async function that generates the prompt from provided arguments
|
92
|
+
* @returns The server instance for method chaining
|
93
|
+
*
|
94
|
+
* @example
|
95
|
+
* ```typescript
|
96
|
+
* server.prompt({
|
97
|
+
* name: 'code-review',
|
98
|
+
* description: 'Generates a code review prompt',
|
99
|
+
* args: [
|
100
|
+
* { name: 'language', type: 'string', required: true },
|
101
|
+
* { name: 'focus', type: 'string', required: false }
|
102
|
+
* ],
|
103
|
+
* fn: async ({ language, focus = 'general' }) => {
|
104
|
+
* return {
|
105
|
+
* messages: [{
|
106
|
+
* role: 'user',
|
107
|
+
* content: `Please review this ${language} code with focus on ${focus}...`
|
108
|
+
* }]
|
109
|
+
* }
|
110
|
+
* }
|
111
|
+
* })
|
112
|
+
* ```
|
113
|
+
*/
|
114
|
+
prompt(promptDefinition: PromptDefinition): this;
|
115
|
+
/**
|
116
|
+
* Mount MCP server endpoints at /mcp
|
117
|
+
*
|
118
|
+
* Sets up the HTTP transport layer for the MCP server, creating endpoints for
|
119
|
+
* Server-Sent Events (SSE) streaming, POST message handling, and DELETE session cleanup.
|
120
|
+
* Uses stateless mode for session management, making it suitable for stateless deployments.
|
121
|
+
*
|
122
|
+
* This method is called automatically when the server starts listening and ensures
|
123
|
+
* that MCP clients can communicate with the server over HTTP.
|
124
|
+
*
|
125
|
+
* @private
|
126
|
+
* @returns Promise that resolves when MCP endpoints are successfully mounted
|
127
|
+
*
|
128
|
+
* @example
|
129
|
+
* Endpoints created:
|
130
|
+
* - GET /mcp - SSE streaming endpoint for real-time communication
|
131
|
+
* - POST /mcp - Message handling endpoint for MCP protocol messages
|
132
|
+
* - DELETE /mcp - Session cleanup endpoint
|
133
|
+
*/
|
134
|
+
private mountMcp;
|
135
|
+
/**
|
136
|
+
* Start the Express server with MCP endpoints
|
137
|
+
*
|
138
|
+
* Initiates the server startup process by mounting MCP endpoints, configuring
|
139
|
+
* the inspector UI (if available), and starting the Express server to listen
|
140
|
+
* for incoming connections. This is the main entry point for running the server.
|
141
|
+
*
|
142
|
+
* The server will be accessible at the specified port with MCP endpoints at /mcp
|
143
|
+
* and inspector UI at /inspector (if the inspector package is installed).
|
144
|
+
*
|
145
|
+
* @param port - Port number to listen on (defaults to 3001 if not specified)
|
146
|
+
* @returns Promise that resolves when the server is successfully listening
|
147
|
+
*
|
148
|
+
* @example
|
149
|
+
* ```typescript
|
150
|
+
* await server.listen(8080)
|
151
|
+
* // Server now running at http://localhost:8080
|
152
|
+
* // MCP endpoints: http://localhost:8080/mcp
|
153
|
+
* // Inspector UI: http://localhost:8080/inspector
|
154
|
+
* ```
|
155
|
+
*/
|
156
|
+
listen(port?: number): Promise<void>;
|
157
|
+
/**
|
158
|
+
* Mount MCP Inspector UI at /inspector
|
159
|
+
*
|
160
|
+
* Dynamically loads and mounts the MCP Inspector UI package if available, providing
|
161
|
+
* a web-based interface for testing and debugging MCP servers. The inspector
|
162
|
+
* automatically connects to the local MCP server endpoints.
|
163
|
+
*
|
164
|
+
* This method gracefully handles cases where the inspector package is not installed,
|
165
|
+
* allowing the server to function without the inspector in production environments.
|
166
|
+
*
|
167
|
+
* @private
|
168
|
+
* @returns void
|
169
|
+
*
|
170
|
+
* @example
|
171
|
+
* If @mcp-use/inspector is installed:
|
172
|
+
* - Inspector UI available at http://localhost:PORT/inspector
|
173
|
+
* - Automatically connects to http://localhost:PORT/mcp
|
174
|
+
*
|
175
|
+
* If not installed:
|
176
|
+
* - Server continues to function normally
|
177
|
+
* - No inspector UI available
|
178
|
+
*/
|
179
|
+
private mountInspector;
|
180
|
+
/**
|
181
|
+
* Setup default widget serving routes
|
182
|
+
*
|
183
|
+
* Configures Express routes to serve MCP UI widgets and their static assets.
|
184
|
+
* Widgets are served from the dist/resources/mcp-use/widgets directory and can
|
185
|
+
* be accessed via HTTP endpoints for embedding in web applications.
|
186
|
+
*
|
187
|
+
* Routes created:
|
188
|
+
* - GET /mcp-use/widgets/:widget - Serves widget's index.html
|
189
|
+
* - GET /mcp-use/widgets/:widget/assets/* - Serves widget-specific assets
|
190
|
+
* - GET /mcp-use/widgets/assets/* - Fallback asset serving with auto-discovery
|
191
|
+
*
|
192
|
+
* @private
|
193
|
+
* @returns void
|
194
|
+
*
|
195
|
+
* @example
|
196
|
+
* Widget routes:
|
197
|
+
* - http://localhost:3001/mcp-use/widgets/kanban-board
|
198
|
+
* - http://localhost:3001/mcp-use/widgets/todo-list/assets/style.css
|
199
|
+
* - http://localhost:3001/mcp-use/widgets/assets/script.js (auto-discovered)
|
200
|
+
*/
|
201
|
+
private setupWidgetRoutes;
|
202
|
+
/**
|
203
|
+
* Create input schema for resource templates
|
204
|
+
*
|
205
|
+
* Parses a URI template string to extract parameter names and generates a Zod
|
206
|
+
* validation schema for those parameters. Used internally for validating resource
|
207
|
+
* template parameters before processing requests.
|
208
|
+
*
|
209
|
+
* @param uriTemplate - URI template string with parameter placeholders (e.g., "/users/{id}/posts/{postId}")
|
210
|
+
* @returns Object mapping parameter names to Zod string schemas
|
211
|
+
*
|
212
|
+
* @example
|
213
|
+
* ```typescript
|
214
|
+
* const schema = this.createInputSchema("/users/{id}/posts/{postId}")
|
215
|
+
* // Returns: { id: z.string(), postId: z.string() }
|
216
|
+
* ```
|
217
|
+
*/
|
218
|
+
private createInputSchema;
|
219
|
+
/**
|
220
|
+
* Create input schema for tools
|
221
|
+
*
|
222
|
+
* Converts tool input definitions into Zod validation schemas for runtime validation.
|
223
|
+
* Supports common data types (string, number, boolean, object, array) and optional
|
224
|
+
* parameters. Used internally when registering tools with the MCP server.
|
225
|
+
*
|
226
|
+
* @param inputs - Array of input parameter definitions with name, type, and optional flag
|
227
|
+
* @returns Object mapping parameter names to Zod validation schemas
|
228
|
+
*
|
229
|
+
* @example
|
230
|
+
* ```typescript
|
231
|
+
* const schema = this.createToolInputSchema([
|
232
|
+
* { name: 'query', type: 'string', required: true },
|
233
|
+
* { name: 'limit', type: 'number', required: false }
|
234
|
+
* ])
|
235
|
+
* // Returns: { query: z.string(), limit: z.number().optional() }
|
236
|
+
* ```
|
237
|
+
*/
|
238
|
+
private createToolInputSchema;
|
239
|
+
/**
|
240
|
+
* Create arguments schema for prompts
|
241
|
+
*
|
242
|
+
* Converts prompt argument definitions into Zod validation schemas for runtime validation.
|
243
|
+
* Supports common data types (string, number, boolean, object, array) and optional
|
244
|
+
* parameters. Used internally when registering prompt templates with the MCP server.
|
245
|
+
*
|
246
|
+
* @param inputs - Array of argument definitions with name, type, and optional flag
|
247
|
+
* @returns Object mapping argument names to Zod validation schemas
|
248
|
+
*
|
249
|
+
* @example
|
250
|
+
* ```typescript
|
251
|
+
* const schema = this.createPromptArgsSchema([
|
252
|
+
* { name: 'topic', type: 'string', required: true },
|
253
|
+
* { name: 'style', type: 'string', required: false }
|
254
|
+
* ])
|
255
|
+
* // Returns: { topic: z.string(), style: z.string().optional() }
|
256
|
+
* ```
|
257
|
+
*/
|
258
|
+
private createPromptArgsSchema;
|
259
|
+
/**
|
260
|
+
* Extract parameter names from URI template
|
261
|
+
*
|
262
|
+
* Parses a URI template string to extract parameter names enclosed in curly braces.
|
263
|
+
* Used internally to identify dynamic parameters in resource templates and generate
|
264
|
+
* appropriate validation schemas.
|
265
|
+
*
|
266
|
+
* @param uriTemplate - URI template string with parameter placeholders (e.g., "/users/{id}/posts/{postId}")
|
267
|
+
* @returns Array of parameter names found in the template
|
268
|
+
*
|
269
|
+
* @example
|
270
|
+
* ```typescript
|
271
|
+
* const params = this.extractTemplateParams("/users/{id}/posts/{postId}")
|
272
|
+
* // Returns: ["id", "postId"]
|
273
|
+
* ```
|
274
|
+
*/
|
275
|
+
private extractTemplateParams;
|
276
|
+
}
|
277
|
+
export type McpServerInstance = Omit<McpServer, keyof Express> & Express;
|
278
|
+
/**
|
279
|
+
* Create a new MCP server instance
|
280
|
+
*/
|
281
|
+
export declare function createMCPServer(name: string, config?: Partial<ServerConfig>): McpServerInstance;
|
282
|
+
//# sourceMappingURL=mcp-server.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../src/server/mcp-server.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACf,MAAM,YAAY,CAAA;AAGnB,OAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,SAAS,CAAA;AAK/C,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,GAAG,CAAS;IACpB,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,UAAU,CAAC,CAAQ;IAE3B;;;;;;;;;OASG;gBACS,MAAM,EAAE,YAAY;IAmChC;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,IAAI;IAYtD;;OAEG;IAaH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,IAAI,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;IAa1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,IAAI;IAahD;;;;;;;;;;;;;;;;;;OAkBG;YACW,QAAQ;IAkCtB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1C;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,OAAO,CAAC,cAAc;IAqBtB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAO,CAAC,iBAAiB;IAsCzB;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,iBAAiB;IAWzB;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,qBAAqB;IAmC7B;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CAAC,sBAAsB;IAmC9B;;;;;;;;;;;;;;;OAeG;IACH,OAAO,CAAC,qBAAqB;CAI9B;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,MAAM,OAAO,CAAC,GAAG,OAAO,CAAA;AAExE;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,iBAAiB,CAOnG"}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import type { CallToolResult, GetPromptResult, ReadResourceResult, ResourceTemplate } from '@modelcontextprotocol/sdk/types.js';
|
2
|
+
export interface ServerConfig {
|
3
|
+
name: string;
|
4
|
+
version: string;
|
5
|
+
description?: string;
|
6
|
+
}
|
7
|
+
export interface InputDefinition {
|
8
|
+
name: string;
|
9
|
+
type: 'string' | 'number' | 'boolean' | 'object' | 'array';
|
10
|
+
description?: string;
|
11
|
+
required?: boolean;
|
12
|
+
default?: any;
|
13
|
+
}
|
14
|
+
export interface ResourceTemplateDefinition {
|
15
|
+
name: string;
|
16
|
+
resourceTemplate: ResourceTemplate;
|
17
|
+
title?: string;
|
18
|
+
description?: string;
|
19
|
+
fn: ResourceTemplateHandler;
|
20
|
+
}
|
21
|
+
export interface ResourceDefinition {
|
22
|
+
name: string;
|
23
|
+
uri: string;
|
24
|
+
resource: {
|
25
|
+
title?: string;
|
26
|
+
description?: string;
|
27
|
+
mimeType: string;
|
28
|
+
};
|
29
|
+
fn: ResourceHandler;
|
30
|
+
}
|
31
|
+
export interface ToolDefinition {
|
32
|
+
name: string;
|
33
|
+
description?: string;
|
34
|
+
inputs?: InputDefinition[];
|
35
|
+
fn: ToolHandler;
|
36
|
+
}
|
37
|
+
export interface PromptDefinition {
|
38
|
+
name: string;
|
39
|
+
description?: string;
|
40
|
+
args?: InputDefinition[];
|
41
|
+
fn: PromptHandler;
|
42
|
+
}
|
43
|
+
export type ResourceHandler = () => Promise<ReadResourceResult>;
|
44
|
+
export type ResourceTemplateHandler = (uri: URL, params: Record<string, any>) => Promise<ReadResourceResult>;
|
45
|
+
export type ToolHandler = (params: Record<string, any>) => Promise<CallToolResult>;
|
46
|
+
export type PromptHandler = (params: Record<string, any>) => Promise<GetPromptResult>;
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/server/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,oCAAoC,CAAA;AAC9H,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;CACd;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,EAAE,EAAE,uBAAuB,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,EAAE,EAAE,eAAe,CAAA;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAA;IAC1B,EAAE,EAAE,WAAW,CAAA;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,eAAe,EAAE,CAAA;IACxB,EAAE,EAAE,aAAa,CAAA;CAClB;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC/D,MAAM,MAAM,uBAAuB,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAA;AAC5G,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,cAAc,CAAC,CAAA;AAClF,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,eAAe,CAAC,CAAA"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/**
|
2
|
+
* Asserts that a condition is true, throwing an error if not.
|
3
|
+
* Useful for type narrowing.
|
4
|
+
* @param condition The condition to check.
|
5
|
+
* @param message The error message to throw if the condition is false.
|
6
|
+
*/
|
7
|
+
export declare function assert(condition: unknown, message: string): asserts condition;
|
8
|
+
//# sourceMappingURL=assert.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"assert.d.ts","sourceRoot":"","sources":["../../../src/utils/assert.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAI7E"}
|