@dexto/server 1.6.20 → 1.6.22
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/a2a/jsonrpc/methods.cjs +1 -1
- package/dist/a2a/jsonrpc/methods.d.ts +14 -4
- package/dist/a2a/jsonrpc/methods.d.ts.map +1 -1
- package/dist/a2a/jsonrpc/methods.js +1 -1
- package/dist/approval/wire-approval-events.cjs +44 -0
- package/dist/approval/wire-approval-events.d.ts +4 -0
- package/dist/approval/wire-approval-events.d.ts.map +1 -0
- package/dist/approval/wire-approval-events.js +20 -0
- package/dist/events/session-sse-subscriber.cjs +167 -0
- package/dist/events/session-sse-subscriber.d.ts +13 -0
- package/dist/events/session-sse-subscriber.d.ts.map +1 -0
- package/dist/events/session-sse-subscriber.js +143 -0
- package/dist/hono/__tests__/test-fixtures.cjs +8 -0
- package/dist/hono/__tests__/test-fixtures.d.ts +1 -0
- package/dist/hono/__tests__/test-fixtures.d.ts.map +1 -1
- package/dist/hono/__tests__/test-fixtures.js +8 -0
- package/dist/hono/index.cjs +40 -8
- package/dist/hono/index.d.ts +45 -4531
- package/dist/hono/index.d.ts.map +1 -1
- package/dist/hono/index.js +43 -9
- package/dist/hono/node/index.cjs +51 -6
- package/dist/hono/node/index.d.ts.map +1 -1
- package/dist/hono/node/index.js +51 -6
- package/dist/hono/routes/a2a-jsonrpc.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.cjs +158 -32
- package/dist/hono/routes/a2a-tasks.d.ts +1 -502
- package/dist/hono/routes/a2a-tasks.d.ts.map +1 -1
- package/dist/hono/routes/a2a-tasks.js +162 -32
- package/dist/hono/routes/a2a.d.ts.map +1 -1
- package/dist/hono/routes/agents.cjs +410 -329
- package/dist/hono/routes/agents.d.ts +16043 -68
- package/dist/hono/routes/agents.d.ts.map +1 -1
- package/dist/hono/routes/agents.js +418 -330
- package/dist/hono/routes/approvals.cjs +102 -88
- package/dist/hono/routes/approvals.d.ts +2089 -142
- package/dist/hono/routes/approvals.d.ts.map +1 -1
- package/dist/hono/routes/approvals.js +108 -89
- package/dist/hono/routes/dexto-auth.cjs +40 -33
- package/dist/hono/routes/dexto-auth.d.ts +401 -2
- package/dist/hono/routes/dexto-auth.d.ts.map +1 -1
- package/dist/hono/routes/dexto-auth.js +40 -33
- package/dist/hono/routes/discovery.cjs +16 -14
- package/dist/hono/routes/discovery.d.ts +586 -1
- package/dist/hono/routes/discovery.d.ts.map +1 -1
- package/dist/hono/routes/discovery.js +16 -14
- package/dist/hono/routes/greeting.cjs +26 -22
- package/dist/hono/routes/greeting.d.ts +787 -3
- package/dist/hono/routes/greeting.d.ts.map +1 -1
- package/dist/hono/routes/greeting.js +26 -22
- package/dist/hono/routes/health.d.ts +1 -1
- package/dist/hono/routes/key.cjs +60 -52
- package/dist/hono/routes/key.d.ts +1597 -1
- package/dist/hono/routes/key.d.ts.map +1 -1
- package/dist/hono/routes/key.js +60 -52
- package/dist/hono/routes/llm.cjs +382 -349
- package/dist/hono/routes/llm.d.ts +12148 -98
- package/dist/hono/routes/llm.d.ts.map +1 -1
- package/dist/hono/routes/llm.js +386 -349
- package/dist/hono/routes/mcp.cjs +257 -226
- package/dist/hono/routes/mcp.d.ts +6605 -309
- package/dist/hono/routes/mcp.d.ts.map +1 -1
- package/dist/hono/routes/mcp.js +263 -225
- package/dist/hono/routes/memory.cjs +102 -89
- package/dist/hono/routes/memory.d.ts +5368 -4
- package/dist/hono/routes/memory.d.ts.map +1 -1
- package/dist/hono/routes/memory.js +108 -90
- package/dist/hono/routes/messages.cjs +189 -191
- package/dist/hono/routes/messages.d.ts +3900 -12
- package/dist/hono/routes/messages.d.ts.map +1 -1
- package/dist/hono/routes/messages.js +192 -191
- package/dist/hono/routes/models.cjs +106 -64
- package/dist/hono/routes/models.d.ts +2875 -2
- package/dist/hono/routes/models.d.ts.map +1 -1
- package/dist/hono/routes/models.js +108 -64
- package/dist/hono/routes/openrouter.cjs +79 -65
- package/dist/hono/routes/openrouter.d.ts +854 -1
- package/dist/hono/routes/openrouter.d.ts.map +1 -1
- package/dist/hono/routes/openrouter.js +79 -65
- package/dist/hono/routes/prompts.cjs +136 -109
- package/dist/hono/routes/prompts.d.ts +2818 -10
- package/dist/hono/routes/prompts.d.ts.map +1 -1
- package/dist/hono/routes/prompts.js +138 -109
- package/dist/hono/routes/queue.cjs +133 -120
- package/dist/hono/routes/queue.d.ts +5240 -11
- package/dist/hono/routes/queue.d.ts.map +1 -1
- package/dist/hono/routes/queue.js +136 -120
- package/dist/hono/routes/resources.cjs +65 -46
- package/dist/hono/routes/resources.d.ts +1983 -5
- package/dist/hono/routes/resources.d.ts.map +1 -1
- package/dist/hono/routes/resources.js +72 -47
- package/dist/hono/routes/schedules.cjs +233 -226
- package/dist/hono/routes/schedules.d.ts +4198 -22
- package/dist/hono/routes/schedules.d.ts.map +1 -1
- package/dist/hono/routes/schedules.js +233 -226
- package/dist/hono/routes/search.cjs +34 -30
- package/dist/hono/routes/search.d.ts +3094 -17
- package/dist/hono/routes/search.d.ts.map +1 -1
- package/dist/hono/routes/search.js +40 -31
- package/dist/hono/routes/sessions.cjs +491 -393
- package/dist/hono/routes/sessions.d.ts +18263 -65
- package/dist/hono/routes/sessions.d.ts.map +1 -1
- package/dist/hono/routes/sessions.js +497 -395
- package/dist/hono/routes/static.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.cjs +57 -61
- package/dist/hono/routes/system-prompt.d.ts +1228 -2
- package/dist/hono/routes/system-prompt.d.ts.map +1 -1
- package/dist/hono/routes/system-prompt.js +58 -62
- package/dist/hono/routes/tools.cjs +29 -34
- package/dist/hono/routes/tools.d.ts +1755 -6
- package/dist/hono/routes/tools.d.ts.map +1 -1
- package/dist/hono/routes/tools.js +33 -33
- package/dist/hono/routes/webhooks.cjs +115 -123
- package/dist/hono/routes/webhooks.d.ts +2501 -11
- package/dist/hono/routes/webhooks.d.ts.map +1 -1
- package/dist/hono/routes/webhooks.js +120 -124
- package/dist/hono/routes/workspaces.cjs +84 -79
- package/dist/hono/routes/workspaces.d.ts +2093 -2
- package/dist/hono/routes/workspaces.d.ts.map +1 -1
- package/dist/hono/routes/workspaces.js +89 -80
- package/dist/hono/schemas/responses.cjs +463 -260
- package/dist/hono/schemas/responses.d.ts +1893 -209
- package/dist/hono/schemas/responses.d.ts.map +1 -1
- package/dist/hono/schemas/responses.js +203 -14
- package/dist/hono/start-server.cjs +9 -0
- package/dist/hono/start-server.d.ts.map +1 -1
- package/dist/hono/start-server.js +9 -0
- package/dist/hono/types.d.ts +11 -0
- package/dist/hono/types.d.ts.map +1 -1
- package/dist/index.cjs +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/hono/routes/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,CAAC,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,MAAM,CAAC;AAiBhC,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAExF,QAAA,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUsC,CAAC;AAEnE,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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|
|
9
9
|
import { updateAgentConfigFile } from "@dexto/agent-management";
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
ApiErrorResponseSchema,
|
|
12
|
+
BadRequestErrorResponse,
|
|
13
|
+
InternalErrorResponse,
|
|
14
|
+
JsonObjectSchema,
|
|
15
|
+
JsonValueSchema,
|
|
16
|
+
ToolInputSchema
|
|
17
|
+
} from "../schemas/responses.js";
|
|
11
18
|
const McpServerRequestSchema = z.object({
|
|
12
19
|
name: z.string().min(1, "Server name is required").describe("A unique name for the server"),
|
|
13
20
|
config: McpServerConfigSchema.describe("The server configuration object"),
|
|
@@ -17,7 +24,7 @@ const McpServerUpdateSchema = z.object({
|
|
|
17
24
|
config: McpServerConfigSchema.describe("The updated server configuration object"),
|
|
18
25
|
persistToAgent: z.boolean().optional().describe("If true, saves the server to agent configuration file")
|
|
19
26
|
}).strict().describe("Request body for updating an MCP server");
|
|
20
|
-
const ExecuteToolBodySchema =
|
|
27
|
+
const ExecuteToolBodySchema = JsonObjectSchema.describe(
|
|
21
28
|
"Tool execution parameters as JSON object. The specific fields depend on the tool being executed and are defined by the tool's inputSchema."
|
|
22
29
|
);
|
|
23
30
|
const ServerStatusResponseSchema = z.object({
|
|
@@ -32,23 +39,14 @@ const ServerInfoSchema = z.object({
|
|
|
32
39
|
const ServersListResponseSchema = z.object({
|
|
33
40
|
servers: z.array(ServerInfoSchema).describe("Array of server information")
|
|
34
41
|
}).strict().describe("List of MCP servers");
|
|
35
|
-
const JsonSchemaProperty = z.object({
|
|
36
|
-
type: z.enum(["string", "number", "integer", "boolean", "object", "array"]).optional().describe("Property type"),
|
|
37
|
-
description: z.string().optional().describe("Property description"),
|
|
38
|
-
enum: z.array(z.union([z.string(), z.number(), z.boolean()])).optional().describe("Enum values"),
|
|
39
|
-
default: z.any().optional().describe("Default value")
|
|
40
|
-
}).passthrough().describe("JSON Schema property definition");
|
|
41
|
-
const ToolInputSchema = z.object({
|
|
42
|
-
type: z.literal("object").optional().describe('Schema type, always "object" when present'),
|
|
43
|
-
properties: z.record(JsonSchemaProperty).optional().describe("Property definitions"),
|
|
44
|
-
required: z.array(z.string()).optional().describe("Required property names")
|
|
45
|
-
}).passthrough().describe("JSON Schema for tool input parameters");
|
|
46
42
|
const ToolInfoSchema = z.object({
|
|
47
43
|
id: z.string().describe("Tool identifier"),
|
|
48
44
|
name: z.string().describe("Tool name"),
|
|
49
45
|
description: z.string().describe("Tool description"),
|
|
50
46
|
inputSchema: ToolInputSchema.optional().describe("JSON Schema for tool input parameters"),
|
|
51
|
-
_meta:
|
|
47
|
+
_meta: JsonObjectSchema.optional().describe(
|
|
48
|
+
"Optional tool metadata (e.g., MCP Apps UI resource info)"
|
|
49
|
+
)
|
|
52
50
|
}).strict().describe("Tool information");
|
|
53
51
|
const ToolsListResponseSchema = z.object({
|
|
54
52
|
tools: z.array(ToolInfoSchema).describe("Array of available tools")
|
|
@@ -63,7 +61,7 @@ const RestartResponseSchema = z.object({
|
|
|
63
61
|
}).strict().describe("Server restart response");
|
|
64
62
|
const ToolExecutionResponseSchema = z.object({
|
|
65
63
|
success: z.boolean().describe("Whether tool execution succeeded"),
|
|
66
|
-
data:
|
|
64
|
+
data: JsonValueSchema.optional().describe("Tool execution result data"),
|
|
67
65
|
error: z.string().optional().describe("Error message if execution failed")
|
|
68
66
|
}).strict().describe("Tool execution response");
|
|
69
67
|
const ServerConfigResponseSchema = z.object({
|
|
@@ -81,210 +79,216 @@ const ResourcesListResponseSchema = z.object({
|
|
|
81
79
|
resources: z.array(ServerResourceSchema).describe("Array of available resources")
|
|
82
80
|
}).strict().describe("List of resources from MCP server");
|
|
83
81
|
const ResourceContentSchema = z.object({
|
|
84
|
-
content:
|
|
82
|
+
content: JsonValueSchema.describe("Resource content data")
|
|
85
83
|
}).strict().describe("Resource content wrapper");
|
|
86
84
|
const ResourceContentResponseSchema = z.object({
|
|
87
85
|
success: z.boolean().describe("Success indicator"),
|
|
88
86
|
data: ResourceContentSchema.describe("Resource content")
|
|
89
87
|
}).strict().describe("Resource content response");
|
|
90
|
-
function
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
const listServersRoute = createRoute({
|
|
107
|
-
method: "get",
|
|
108
|
-
path: "/mcp/servers",
|
|
109
|
-
summary: "List MCP Servers",
|
|
110
|
-
description: "Gets a list of all connected and failed MCP servers",
|
|
111
|
-
tags: ["mcp"],
|
|
112
|
-
responses: {
|
|
113
|
-
200: {
|
|
114
|
-
description: "Servers list",
|
|
115
|
-
content: { "application/json": { schema: ServersListResponseSchema } }
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
const getServerConfigRoute = createRoute({
|
|
120
|
-
method: "get",
|
|
121
|
-
path: "/mcp/servers/{serverId}/config",
|
|
122
|
-
summary: "Get MCP Server Config",
|
|
123
|
-
description: "Retrieves the configuration for a specific MCP server",
|
|
124
|
-
tags: ["mcp"],
|
|
125
|
-
request: {
|
|
126
|
-
params: z.object({ serverId: z.string().describe("The ID of the MCP server") })
|
|
88
|
+
function mountMcpSubrouter(app, router) {
|
|
89
|
+
app.route("/", router);
|
|
90
|
+
}
|
|
91
|
+
const addServerRoute = createRoute({
|
|
92
|
+
method: "post",
|
|
93
|
+
path: "/mcp/servers",
|
|
94
|
+
summary: "Add MCP Server",
|
|
95
|
+
description: "Connects a new MCP server dynamically",
|
|
96
|
+
tags: ["mcp"],
|
|
97
|
+
request: { body: { content: { "application/json": { schema: McpServerRequestSchema } } } },
|
|
98
|
+
responses: {
|
|
99
|
+
200: {
|
|
100
|
+
description: "Server connected",
|
|
101
|
+
content: { "application/json": { schema: ServerStatusResponseSchema } }
|
|
127
102
|
},
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
103
|
+
400: BadRequestErrorResponse,
|
|
104
|
+
500: InternalErrorResponse
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
const listServersRoute = createRoute({
|
|
108
|
+
method: "get",
|
|
109
|
+
path: "/mcp/servers",
|
|
110
|
+
summary: "List MCP Servers",
|
|
111
|
+
description: "Gets a list of all connected and failed MCP servers",
|
|
112
|
+
tags: ["mcp"],
|
|
113
|
+
responses: {
|
|
114
|
+
200: {
|
|
115
|
+
description: "Servers list",
|
|
116
|
+
content: { "application/json": { schema: ServersListResponseSchema } }
|
|
117
|
+
},
|
|
118
|
+
500: InternalErrorResponse
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
const getServerConfigRoute = createRoute({
|
|
122
|
+
method: "get",
|
|
123
|
+
path: "/mcp/servers/{serverId}/config",
|
|
124
|
+
summary: "Get MCP Server Config",
|
|
125
|
+
description: "Retrieves the configuration for a specific MCP server",
|
|
126
|
+
tags: ["mcp"],
|
|
127
|
+
request: {
|
|
128
|
+
params: z.object({ serverId: z.string().describe("The ID of the MCP server") })
|
|
129
|
+
},
|
|
130
|
+
responses: {
|
|
131
|
+
200: {
|
|
132
|
+
description: "Server configuration",
|
|
133
|
+
content: { "application/json": { schema: ServerConfigResponseSchema } }
|
|
134
|
+
},
|
|
135
|
+
404: {
|
|
136
|
+
description: "Not found",
|
|
137
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
137
138
|
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const updateServerRoute = createRoute({
|
|
142
|
+
method: "put",
|
|
143
|
+
path: "/mcp/servers/{serverId}",
|
|
144
|
+
summary: "Update MCP Server",
|
|
145
|
+
description: "Updates configuration for an existing MCP server",
|
|
146
|
+
tags: ["mcp"],
|
|
147
|
+
request: {
|
|
148
|
+
params: z.object({ serverId: z.string().describe("The ID of the MCP server") }),
|
|
149
|
+
body: { content: { "application/json": { schema: McpServerUpdateSchema } } }
|
|
150
|
+
},
|
|
151
|
+
responses: {
|
|
152
|
+
200: {
|
|
153
|
+
description: "Server updated",
|
|
154
|
+
content: { "application/json": { schema: ServerStatusResponseSchema } }
|
|
148
155
|
},
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
content: { "application/json": { schema: ServerStatusResponseSchema } }
|
|
153
|
-
},
|
|
154
|
-
404: {
|
|
155
|
-
description: "Not found",
|
|
156
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
157
|
-
}
|
|
156
|
+
404: {
|
|
157
|
+
description: "Not found",
|
|
158
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
158
159
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
const toolsRoute = createRoute({
|
|
163
|
+
method: "get",
|
|
164
|
+
path: "/mcp/servers/{serverId}/tools",
|
|
165
|
+
summary: "List Server Tools",
|
|
166
|
+
description: "Retrieves the list of tools available on a specific MCP server",
|
|
167
|
+
tags: ["mcp"],
|
|
168
|
+
request: {
|
|
169
|
+
params: z.object({ serverId: z.string().describe("The ID of the MCP server") })
|
|
170
|
+
},
|
|
171
|
+
responses: {
|
|
172
|
+
200: {
|
|
173
|
+
description: "Tools list",
|
|
174
|
+
content: { "application/json": { schema: ToolsListResponseSchema } }
|
|
168
175
|
},
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
content: { "application/json": { schema: ToolsListResponseSchema } }
|
|
173
|
-
},
|
|
174
|
-
404: {
|
|
175
|
-
description: "Not found",
|
|
176
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
177
|
-
}
|
|
176
|
+
404: {
|
|
177
|
+
description: "Not found",
|
|
178
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
178
179
|
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
const deleteServerRoute = createRoute({
|
|
183
|
+
method: "delete",
|
|
184
|
+
path: "/mcp/servers/{serverId}",
|
|
185
|
+
summary: "Remove MCP Server",
|
|
186
|
+
description: "Disconnects and removes an MCP server",
|
|
187
|
+
tags: ["mcp"],
|
|
188
|
+
request: {
|
|
189
|
+
params: z.object({ serverId: z.string().describe("The ID of the MCP server") })
|
|
190
|
+
},
|
|
191
|
+
responses: {
|
|
192
|
+
200: {
|
|
193
|
+
description: "Disconnected",
|
|
194
|
+
content: { "application/json": { schema: DisconnectResponseSchema } }
|
|
188
195
|
},
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
content: { "application/json": { schema: DisconnectResponseSchema } }
|
|
193
|
-
},
|
|
194
|
-
404: {
|
|
195
|
-
description: "Not found",
|
|
196
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
197
|
-
}
|
|
196
|
+
404: {
|
|
197
|
+
description: "Not found",
|
|
198
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
198
199
|
}
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
const restartServerRoute = createRoute({
|
|
203
|
+
method: "post",
|
|
204
|
+
path: "/mcp/servers/{serverId}/restart",
|
|
205
|
+
summary: "Restart MCP Server",
|
|
206
|
+
description: "Restarts a connected MCP server",
|
|
207
|
+
tags: ["mcp"],
|
|
208
|
+
request: {
|
|
209
|
+
params: z.object({ serverId: z.string().describe("The ID of the MCP server") })
|
|
210
|
+
},
|
|
211
|
+
responses: {
|
|
212
|
+
200: {
|
|
213
|
+
description: "Server restarted",
|
|
214
|
+
content: { "application/json": { schema: RestartResponseSchema } }
|
|
208
215
|
},
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
content: { "application/json": { schema: RestartResponseSchema } }
|
|
213
|
-
},
|
|
214
|
-
404: {
|
|
215
|
-
description: "Not found",
|
|
216
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
217
|
-
}
|
|
216
|
+
404: {
|
|
217
|
+
description: "Not found",
|
|
218
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
218
219
|
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
const execToolRoute = createRoute({
|
|
223
|
+
method: "post",
|
|
224
|
+
path: "/mcp/servers/{serverId}/tools/{toolName}/execute",
|
|
225
|
+
summary: "Execute MCP Tool",
|
|
226
|
+
description: "Executes a tool on an MCP server directly",
|
|
227
|
+
tags: ["mcp"],
|
|
228
|
+
request: {
|
|
229
|
+
params: z.object({
|
|
230
|
+
serverId: z.string().describe("The ID of the MCP server"),
|
|
231
|
+
toolName: z.string().describe("The name of the tool to execute")
|
|
232
|
+
}),
|
|
233
|
+
body: { content: { "application/json": { schema: ExecuteToolBodySchema } } }
|
|
234
|
+
},
|
|
235
|
+
responses: {
|
|
236
|
+
200: {
|
|
237
|
+
description: "Tool executed",
|
|
238
|
+
content: { "application/json": { schema: ToolExecutionResponseSchema } }
|
|
232
239
|
},
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
content: { "application/json": { schema: ToolExecutionResponseSchema } }
|
|
237
|
-
},
|
|
238
|
-
404: {
|
|
239
|
-
description: "Not found",
|
|
240
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
241
|
-
}
|
|
240
|
+
404: {
|
|
241
|
+
description: "Not found",
|
|
242
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
242
243
|
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
const listResourcesRoute = createRoute({
|
|
247
|
+
method: "get",
|
|
248
|
+
path: "/mcp/servers/{serverId}/resources",
|
|
249
|
+
summary: "List Server Resources",
|
|
250
|
+
description: "Retrieves all resources available from a specific MCP server",
|
|
251
|
+
tags: ["mcp"],
|
|
252
|
+
request: {
|
|
253
|
+
params: z.object({ serverId: z.string().describe("The ID of the MCP server") })
|
|
254
|
+
},
|
|
255
|
+
responses: {
|
|
256
|
+
200: {
|
|
257
|
+
description: "Server resources",
|
|
258
|
+
content: { "application/json": { schema: ResourcesListResponseSchema } }
|
|
252
259
|
},
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
content: { "application/json": { schema: ResourcesListResponseSchema } }
|
|
257
|
-
},
|
|
258
|
-
404: {
|
|
259
|
-
description: "Not found",
|
|
260
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
261
|
-
}
|
|
260
|
+
404: {
|
|
261
|
+
description: "Not found",
|
|
262
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
262
263
|
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
const getResourceContentRoute = createRoute({
|
|
267
|
+
method: "get",
|
|
268
|
+
path: "/mcp/servers/{serverId}/resources/{resourceId}/content",
|
|
269
|
+
summary: "Read Server Resource Content",
|
|
270
|
+
description: "Reads content from a specific resource on an MCP server. This endpoint automatically constructs the qualified URI format (mcp:serverId:resourceId)",
|
|
271
|
+
tags: ["mcp"],
|
|
272
|
+
request: {
|
|
273
|
+
params: z.object({
|
|
274
|
+
serverId: z.string().describe("The ID of the MCP server"),
|
|
275
|
+
resourceId: z.string().min(1, "Resource ID is required").transform((encoded) => decodeURIComponent(encoded)).describe("The URI-encoded resource identifier on that server")
|
|
276
|
+
})
|
|
277
|
+
},
|
|
278
|
+
responses: {
|
|
279
|
+
200: {
|
|
280
|
+
description: "Resource content",
|
|
281
|
+
content: { "application/json": { schema: ResourceContentResponseSchema } }
|
|
275
282
|
},
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
content: { "application/json": { schema: ResourceContentResponseSchema } }
|
|
280
|
-
},
|
|
281
|
-
404: {
|
|
282
|
-
description: "Not found",
|
|
283
|
-
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
284
|
-
}
|
|
283
|
+
404: {
|
|
284
|
+
description: "Not found",
|
|
285
|
+
content: { "application/json": { schema: ApiErrorResponseSchema } }
|
|
285
286
|
}
|
|
286
|
-
}
|
|
287
|
-
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
290
|
+
const app = new OpenAPIHono();
|
|
291
|
+
const serverRegistrationRouter = new OpenAPIHono().openapi(addServerRoute, async (ctx) => {
|
|
288
292
|
const agent = await getAgent(ctx);
|
|
289
293
|
const { name, config, persistToAgent } = ctx.req.valid("json");
|
|
290
294
|
await agent.addMcpServer(name, config);
|
|
@@ -339,7 +343,8 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
339
343
|
throw MCPError.serverNotFound(serverId);
|
|
340
344
|
}
|
|
341
345
|
return ctx.json({ name: serverId, config: McpServerConfigSchema.parse(config) }, 200);
|
|
342
|
-
})
|
|
346
|
+
});
|
|
347
|
+
const serverUpdateRouter = new OpenAPIHono().openapi(updateServerRoute, async (ctx) => {
|
|
343
348
|
const agent = await getAgent(ctx);
|
|
344
349
|
const { serverId } = ctx.req.valid("param");
|
|
345
350
|
const { config, persistToAgent } = ctx.req.valid("json");
|
|
@@ -365,15 +370,15 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
365
370
|
logger.info(`Saved server '${serverId}' to agent configuration file`);
|
|
366
371
|
} catch (saveError) {
|
|
367
372
|
const errorMessage = saveError instanceof Error ? saveError.message : String(saveError);
|
|
368
|
-
logger.warn(
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
);
|
|
373
|
+
logger.warn(`Failed to persist MCP server '${serverId}' update: ${errorMessage}`, {
|
|
374
|
+
error: saveError
|
|
375
|
+
});
|
|
372
376
|
}
|
|
373
377
|
}
|
|
374
378
|
const status = config.enabled === false ? "registered" : "connected";
|
|
375
379
|
return ctx.json({ status, name: serverId }, 200);
|
|
376
|
-
})
|
|
380
|
+
});
|
|
381
|
+
const serverToolsRouter = new OpenAPIHono().openapi(toolsRoute, async (ctx) => {
|
|
377
382
|
const agent = await getAgent(ctx);
|
|
378
383
|
const { serverId } = ctx.req.valid("param");
|
|
379
384
|
const client = agent.getMcpClients().get(serverId);
|
|
@@ -386,10 +391,12 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
386
391
|
name: toolName,
|
|
387
392
|
description: toolDef.description || "",
|
|
388
393
|
inputSchema: toolDef.parameters === void 0 ? void 0 : ToolInputSchema.parse(toolDef.parameters),
|
|
389
|
-
_meta: toolDef._meta
|
|
394
|
+
_meta: toolDef._meta === void 0 ? void 0 : JsonObjectSchema.parse(toolDef._meta)
|
|
390
395
|
}));
|
|
391
|
-
|
|
392
|
-
|
|
396
|
+
const response = { tools };
|
|
397
|
+
return ctx.json(response, 200);
|
|
398
|
+
});
|
|
399
|
+
const deleteServerRouter = new OpenAPIHono().openapi(deleteServerRoute, async (ctx) => {
|
|
393
400
|
const agent = await getAgent(ctx);
|
|
394
401
|
const { serverId } = ctx.req.valid("param");
|
|
395
402
|
const clientExists = agent.getMcpClients().has(serverId) || agent.getMcpFailedConnections()[serverId];
|
|
@@ -397,8 +404,10 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
397
404
|
throw MCPError.serverNotFound(serverId);
|
|
398
405
|
}
|
|
399
406
|
await agent.removeMcpServer(serverId);
|
|
400
|
-
|
|
401
|
-
|
|
407
|
+
const response = { status: "disconnected", id: serverId };
|
|
408
|
+
return ctx.json(response, 200);
|
|
409
|
+
});
|
|
410
|
+
const restartServerRouter = new OpenAPIHono().openapi(restartServerRoute, async (ctx) => {
|
|
402
411
|
const agent = await getAgent(ctx);
|
|
403
412
|
const { serverId } = ctx.req.valid("param");
|
|
404
413
|
logger.info(`Received request to POST /api/mcp/servers/${serverId}/restart`);
|
|
@@ -408,8 +417,10 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
408
417
|
throw MCPError.serverNotFound(serverId);
|
|
409
418
|
}
|
|
410
419
|
await agent.restartMcpServer(serverId);
|
|
411
|
-
|
|
412
|
-
|
|
420
|
+
const response = { status: "restarted", id: serverId };
|
|
421
|
+
return ctx.json(response, 200);
|
|
422
|
+
});
|
|
423
|
+
const execToolRouter = new OpenAPIHono().openapi(execToolRoute, async (ctx) => {
|
|
413
424
|
const agent = await getAgent(ctx);
|
|
414
425
|
const { serverId, toolName } = ctx.req.valid("param");
|
|
415
426
|
const body = ctx.req.valid("json");
|
|
@@ -419,16 +430,25 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
419
430
|
}
|
|
420
431
|
try {
|
|
421
432
|
const rawResult = await client.callTool(toolName, body);
|
|
422
|
-
|
|
433
|
+
const response = {
|
|
434
|
+
success: true,
|
|
435
|
+
data: JsonValueSchema.parse(rawResult)
|
|
436
|
+
};
|
|
437
|
+
return ctx.json(response, 200);
|
|
423
438
|
} catch (error) {
|
|
424
439
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
425
440
|
logger.error(
|
|
426
441
|
`Tool execution failed for '${toolName}' on server '${serverId}': ${errorMessage}`,
|
|
427
442
|
{ error }
|
|
428
443
|
);
|
|
429
|
-
|
|
444
|
+
const response = {
|
|
445
|
+
success: false,
|
|
446
|
+
error: errorMessage
|
|
447
|
+
};
|
|
448
|
+
return ctx.json(response, 200);
|
|
430
449
|
}
|
|
431
|
-
})
|
|
450
|
+
});
|
|
451
|
+
const listResourcesRouter = new OpenAPIHono().openapi(listResourcesRoute, async (ctx) => {
|
|
432
452
|
const agent = await getAgent(ctx);
|
|
433
453
|
const { serverId } = ctx.req.valid("param");
|
|
434
454
|
const client = agent.getMcpClients().get(serverId);
|
|
@@ -436,18 +456,36 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
436
456
|
throw MCPError.serverNotFound(serverId);
|
|
437
457
|
}
|
|
438
458
|
const resources = await agent.listResourcesForServer(serverId);
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
const agent = await getAgent(ctx);
|
|
442
|
-
const { serverId, resourceId } = ctx.req.valid("param");
|
|
443
|
-
const client = agent.getMcpClients().get(serverId);
|
|
444
|
-
if (!client) {
|
|
445
|
-
throw MCPError.serverNotFound(serverId);
|
|
446
|
-
}
|
|
447
|
-
const qualifiedUri = `mcp:${serverId}:${resourceId}`;
|
|
448
|
-
const content = await agent.readResource(qualifiedUri);
|
|
449
|
-
return ctx.json({ success: true, data: { content } }, 200);
|
|
459
|
+
const response = { success: true, resources };
|
|
460
|
+
return ctx.json(response, 200);
|
|
450
461
|
});
|
|
462
|
+
const getResourceContentRouter = new OpenAPIHono().openapi(
|
|
463
|
+
getResourceContentRoute,
|
|
464
|
+
async (ctx) => {
|
|
465
|
+
const agent = await getAgent(ctx);
|
|
466
|
+
const { serverId, resourceId } = ctx.req.valid("param");
|
|
467
|
+
const client = agent.getMcpClients().get(serverId);
|
|
468
|
+
if (!client) {
|
|
469
|
+
throw MCPError.serverNotFound(serverId);
|
|
470
|
+
}
|
|
471
|
+
const qualifiedUri = `mcp:${serverId}:${resourceId}`;
|
|
472
|
+
const content = await agent.readResource(qualifiedUri);
|
|
473
|
+
const response = {
|
|
474
|
+
success: true,
|
|
475
|
+
data: { content: JsonValueSchema.parse(content) }
|
|
476
|
+
};
|
|
477
|
+
return ctx.json(response, 200);
|
|
478
|
+
}
|
|
479
|
+
);
|
|
480
|
+
mountMcpSubrouter(app, serverRegistrationRouter);
|
|
481
|
+
mountMcpSubrouter(app, serverUpdateRouter);
|
|
482
|
+
mountMcpSubrouter(app, serverToolsRouter);
|
|
483
|
+
mountMcpSubrouter(app, deleteServerRouter);
|
|
484
|
+
mountMcpSubrouter(app, restartServerRouter);
|
|
485
|
+
mountMcpSubrouter(app, execToolRouter);
|
|
486
|
+
mountMcpSubrouter(app, listResourcesRouter);
|
|
487
|
+
mountMcpSubrouter(app, getResourceContentRouter);
|
|
488
|
+
return app;
|
|
451
489
|
}
|
|
452
490
|
export {
|
|
453
491
|
createMcpRouter
|