@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
package/dist/hono/routes/mcp.cjs
CHANGED
|
@@ -34,7 +34,7 @@ const McpServerUpdateSchema = import_zod_openapi.z.object({
|
|
|
34
34
|
config: import_core.McpServerConfigSchema.describe("The updated server configuration object"),
|
|
35
35
|
persistToAgent: import_zod_openapi.z.boolean().optional().describe("If true, saves the server to agent configuration file")
|
|
36
36
|
}).strict().describe("Request body for updating an MCP server");
|
|
37
|
-
const ExecuteToolBodySchema =
|
|
37
|
+
const ExecuteToolBodySchema = import_responses.JsonObjectSchema.describe(
|
|
38
38
|
"Tool execution parameters as JSON object. The specific fields depend on the tool being executed and are defined by the tool's inputSchema."
|
|
39
39
|
);
|
|
40
40
|
const ServerStatusResponseSchema = import_zod_openapi.z.object({
|
|
@@ -49,23 +49,14 @@ const ServerInfoSchema = import_zod_openapi.z.object({
|
|
|
49
49
|
const ServersListResponseSchema = import_zod_openapi.z.object({
|
|
50
50
|
servers: import_zod_openapi.z.array(ServerInfoSchema).describe("Array of server information")
|
|
51
51
|
}).strict().describe("List of MCP servers");
|
|
52
|
-
const JsonSchemaProperty = import_zod_openapi.z.object({
|
|
53
|
-
type: import_zod_openapi.z.enum(["string", "number", "integer", "boolean", "object", "array"]).optional().describe("Property type"),
|
|
54
|
-
description: import_zod_openapi.z.string().optional().describe("Property description"),
|
|
55
|
-
enum: import_zod_openapi.z.array(import_zod_openapi.z.union([import_zod_openapi.z.string(), import_zod_openapi.z.number(), import_zod_openapi.z.boolean()])).optional().describe("Enum values"),
|
|
56
|
-
default: import_zod_openapi.z.any().optional().describe("Default value")
|
|
57
|
-
}).passthrough().describe("JSON Schema property definition");
|
|
58
|
-
const ToolInputSchema = import_zod_openapi.z.object({
|
|
59
|
-
type: import_zod_openapi.z.literal("object").optional().describe('Schema type, always "object" when present'),
|
|
60
|
-
properties: import_zod_openapi.z.record(JsonSchemaProperty).optional().describe("Property definitions"),
|
|
61
|
-
required: import_zod_openapi.z.array(import_zod_openapi.z.string()).optional().describe("Required property names")
|
|
62
|
-
}).passthrough().describe("JSON Schema for tool input parameters");
|
|
63
52
|
const ToolInfoSchema = import_zod_openapi.z.object({
|
|
64
53
|
id: import_zod_openapi.z.string().describe("Tool identifier"),
|
|
65
54
|
name: import_zod_openapi.z.string().describe("Tool name"),
|
|
66
55
|
description: import_zod_openapi.z.string().describe("Tool description"),
|
|
67
|
-
inputSchema: ToolInputSchema.optional().describe("JSON Schema for tool input parameters"),
|
|
68
|
-
_meta:
|
|
56
|
+
inputSchema: import_responses.ToolInputSchema.optional().describe("JSON Schema for tool input parameters"),
|
|
57
|
+
_meta: import_responses.JsonObjectSchema.optional().describe(
|
|
58
|
+
"Optional tool metadata (e.g., MCP Apps UI resource info)"
|
|
59
|
+
)
|
|
69
60
|
}).strict().describe("Tool information");
|
|
70
61
|
const ToolsListResponseSchema = import_zod_openapi.z.object({
|
|
71
62
|
tools: import_zod_openapi.z.array(ToolInfoSchema).describe("Array of available tools")
|
|
@@ -80,7 +71,7 @@ const RestartResponseSchema = import_zod_openapi.z.object({
|
|
|
80
71
|
}).strict().describe("Server restart response");
|
|
81
72
|
const ToolExecutionResponseSchema = import_zod_openapi.z.object({
|
|
82
73
|
success: import_zod_openapi.z.boolean().describe("Whether tool execution succeeded"),
|
|
83
|
-
data:
|
|
74
|
+
data: import_responses.JsonValueSchema.optional().describe("Tool execution result data"),
|
|
84
75
|
error: import_zod_openapi.z.string().optional().describe("Error message if execution failed")
|
|
85
76
|
}).strict().describe("Tool execution response");
|
|
86
77
|
const ServerConfigResponseSchema = import_zod_openapi.z.object({
|
|
@@ -98,210 +89,216 @@ const ResourcesListResponseSchema = import_zod_openapi.z.object({
|
|
|
98
89
|
resources: import_zod_openapi.z.array(ServerResourceSchema).describe("Array of available resources")
|
|
99
90
|
}).strict().describe("List of resources from MCP server");
|
|
100
91
|
const ResourceContentSchema = import_zod_openapi.z.object({
|
|
101
|
-
content:
|
|
92
|
+
content: import_responses.JsonValueSchema.describe("Resource content data")
|
|
102
93
|
}).strict().describe("Resource content wrapper");
|
|
103
94
|
const ResourceContentResponseSchema = import_zod_openapi.z.object({
|
|
104
95
|
success: import_zod_openapi.z.boolean().describe("Success indicator"),
|
|
105
96
|
data: ResourceContentSchema.describe("Resource content")
|
|
106
97
|
}).strict().describe("Resource content response");
|
|
107
|
-
function
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
const listServersRoute = (0, import_zod_openapi.createRoute)({
|
|
124
|
-
method: "get",
|
|
125
|
-
path: "/mcp/servers",
|
|
126
|
-
summary: "List MCP Servers",
|
|
127
|
-
description: "Gets a list of all connected and failed MCP servers",
|
|
128
|
-
tags: ["mcp"],
|
|
129
|
-
responses: {
|
|
130
|
-
200: {
|
|
131
|
-
description: "Servers list",
|
|
132
|
-
content: { "application/json": { schema: ServersListResponseSchema } }
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
});
|
|
136
|
-
const getServerConfigRoute = (0, import_zod_openapi.createRoute)({
|
|
137
|
-
method: "get",
|
|
138
|
-
path: "/mcp/servers/{serverId}/config",
|
|
139
|
-
summary: "Get MCP Server Config",
|
|
140
|
-
description: "Retrieves the configuration for a specific MCP server",
|
|
141
|
-
tags: ["mcp"],
|
|
142
|
-
request: {
|
|
143
|
-
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") })
|
|
98
|
+
function mountMcpSubrouter(app, router) {
|
|
99
|
+
app.route("/", router);
|
|
100
|
+
}
|
|
101
|
+
const addServerRoute = (0, import_zod_openapi.createRoute)({
|
|
102
|
+
method: "post",
|
|
103
|
+
path: "/mcp/servers",
|
|
104
|
+
summary: "Add MCP Server",
|
|
105
|
+
description: "Connects a new MCP server dynamically",
|
|
106
|
+
tags: ["mcp"],
|
|
107
|
+
request: { body: { content: { "application/json": { schema: McpServerRequestSchema } } } },
|
|
108
|
+
responses: {
|
|
109
|
+
200: {
|
|
110
|
+
description: "Server connected",
|
|
111
|
+
content: { "application/json": { schema: ServerStatusResponseSchema } }
|
|
144
112
|
},
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
113
|
+
400: import_responses.BadRequestErrorResponse,
|
|
114
|
+
500: import_responses.InternalErrorResponse
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const listServersRoute = (0, import_zod_openapi.createRoute)({
|
|
118
|
+
method: "get",
|
|
119
|
+
path: "/mcp/servers",
|
|
120
|
+
summary: "List MCP Servers",
|
|
121
|
+
description: "Gets a list of all connected and failed MCP servers",
|
|
122
|
+
tags: ["mcp"],
|
|
123
|
+
responses: {
|
|
124
|
+
200: {
|
|
125
|
+
description: "Servers list",
|
|
126
|
+
content: { "application/json": { schema: ServersListResponseSchema } }
|
|
127
|
+
},
|
|
128
|
+
500: import_responses.InternalErrorResponse
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
const getServerConfigRoute = (0, import_zod_openapi.createRoute)({
|
|
132
|
+
method: "get",
|
|
133
|
+
path: "/mcp/servers/{serverId}/config",
|
|
134
|
+
summary: "Get MCP Server Config",
|
|
135
|
+
description: "Retrieves the configuration for a specific MCP server",
|
|
136
|
+
tags: ["mcp"],
|
|
137
|
+
request: {
|
|
138
|
+
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") })
|
|
139
|
+
},
|
|
140
|
+
responses: {
|
|
141
|
+
200: {
|
|
142
|
+
description: "Server configuration",
|
|
143
|
+
content: { "application/json": { schema: ServerConfigResponseSchema } }
|
|
144
|
+
},
|
|
145
|
+
404: {
|
|
146
|
+
description: "Not found",
|
|
147
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
154
148
|
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
const updateServerRoute = (0, import_zod_openapi.createRoute)({
|
|
152
|
+
method: "put",
|
|
153
|
+
path: "/mcp/servers/{serverId}",
|
|
154
|
+
summary: "Update MCP Server",
|
|
155
|
+
description: "Updates configuration for an existing MCP server",
|
|
156
|
+
tags: ["mcp"],
|
|
157
|
+
request: {
|
|
158
|
+
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") }),
|
|
159
|
+
body: { content: { "application/json": { schema: McpServerUpdateSchema } } }
|
|
160
|
+
},
|
|
161
|
+
responses: {
|
|
162
|
+
200: {
|
|
163
|
+
description: "Server updated",
|
|
164
|
+
content: { "application/json": { schema: ServerStatusResponseSchema } }
|
|
165
165
|
},
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
content: { "application/json": { schema: ServerStatusResponseSchema } }
|
|
170
|
-
},
|
|
171
|
-
404: {
|
|
172
|
-
description: "Not found",
|
|
173
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
174
|
-
}
|
|
166
|
+
404: {
|
|
167
|
+
description: "Not found",
|
|
168
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
175
169
|
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
170
|
+
}
|
|
171
|
+
});
|
|
172
|
+
const toolsRoute = (0, import_zod_openapi.createRoute)({
|
|
173
|
+
method: "get",
|
|
174
|
+
path: "/mcp/servers/{serverId}/tools",
|
|
175
|
+
summary: "List Server Tools",
|
|
176
|
+
description: "Retrieves the list of tools available on a specific MCP server",
|
|
177
|
+
tags: ["mcp"],
|
|
178
|
+
request: {
|
|
179
|
+
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") })
|
|
180
|
+
},
|
|
181
|
+
responses: {
|
|
182
|
+
200: {
|
|
183
|
+
description: "Tools list",
|
|
184
|
+
content: { "application/json": { schema: ToolsListResponseSchema } }
|
|
185
185
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
content: { "application/json": { schema: ToolsListResponseSchema } }
|
|
190
|
-
},
|
|
191
|
-
404: {
|
|
192
|
-
description: "Not found",
|
|
193
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
194
|
-
}
|
|
186
|
+
404: {
|
|
187
|
+
description: "Not found",
|
|
188
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
195
189
|
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const deleteServerRoute = (0, import_zod_openapi.createRoute)({
|
|
193
|
+
method: "delete",
|
|
194
|
+
path: "/mcp/servers/{serverId}",
|
|
195
|
+
summary: "Remove MCP Server",
|
|
196
|
+
description: "Disconnects and removes an MCP server",
|
|
197
|
+
tags: ["mcp"],
|
|
198
|
+
request: {
|
|
199
|
+
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") })
|
|
200
|
+
},
|
|
201
|
+
responses: {
|
|
202
|
+
200: {
|
|
203
|
+
description: "Disconnected",
|
|
204
|
+
content: { "application/json": { schema: DisconnectResponseSchema } }
|
|
205
205
|
},
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
content: { "application/json": { schema: DisconnectResponseSchema } }
|
|
210
|
-
},
|
|
211
|
-
404: {
|
|
212
|
-
description: "Not found",
|
|
213
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
214
|
-
}
|
|
206
|
+
404: {
|
|
207
|
+
description: "Not found",
|
|
208
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
215
209
|
}
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
const restartServerRoute = (0, import_zod_openapi.createRoute)({
|
|
213
|
+
method: "post",
|
|
214
|
+
path: "/mcp/servers/{serverId}/restart",
|
|
215
|
+
summary: "Restart MCP Server",
|
|
216
|
+
description: "Restarts a connected MCP server",
|
|
217
|
+
tags: ["mcp"],
|
|
218
|
+
request: {
|
|
219
|
+
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") })
|
|
220
|
+
},
|
|
221
|
+
responses: {
|
|
222
|
+
200: {
|
|
223
|
+
description: "Server restarted",
|
|
224
|
+
content: { "application/json": { schema: RestartResponseSchema } }
|
|
225
225
|
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
content: { "application/json": { schema: RestartResponseSchema } }
|
|
230
|
-
},
|
|
231
|
-
404: {
|
|
232
|
-
description: "Not found",
|
|
233
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
234
|
-
}
|
|
226
|
+
404: {
|
|
227
|
+
description: "Not found",
|
|
228
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
235
229
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
const execToolRoute = (0, import_zod_openapi.createRoute)({
|
|
233
|
+
method: "post",
|
|
234
|
+
path: "/mcp/servers/{serverId}/tools/{toolName}/execute",
|
|
235
|
+
summary: "Execute MCP Tool",
|
|
236
|
+
description: "Executes a tool on an MCP server directly",
|
|
237
|
+
tags: ["mcp"],
|
|
238
|
+
request: {
|
|
239
|
+
params: import_zod_openapi.z.object({
|
|
240
|
+
serverId: import_zod_openapi.z.string().describe("The ID of the MCP server"),
|
|
241
|
+
toolName: import_zod_openapi.z.string().describe("The name of the tool to execute")
|
|
242
|
+
}),
|
|
243
|
+
body: { content: { "application/json": { schema: ExecuteToolBodySchema } } }
|
|
244
|
+
},
|
|
245
|
+
responses: {
|
|
246
|
+
200: {
|
|
247
|
+
description: "Tool executed",
|
|
248
|
+
content: { "application/json": { schema: ToolExecutionResponseSchema } }
|
|
249
249
|
},
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
content: { "application/json": { schema: ToolExecutionResponseSchema } }
|
|
254
|
-
},
|
|
255
|
-
404: {
|
|
256
|
-
description: "Not found",
|
|
257
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
258
|
-
}
|
|
250
|
+
404: {
|
|
251
|
+
description: "Not found",
|
|
252
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
259
253
|
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
const listResourcesRoute = (0, import_zod_openapi.createRoute)({
|
|
257
|
+
method: "get",
|
|
258
|
+
path: "/mcp/servers/{serverId}/resources",
|
|
259
|
+
summary: "List Server Resources",
|
|
260
|
+
description: "Retrieves all resources available from a specific MCP server",
|
|
261
|
+
tags: ["mcp"],
|
|
262
|
+
request: {
|
|
263
|
+
params: import_zod_openapi.z.object({ serverId: import_zod_openapi.z.string().describe("The ID of the MCP server") })
|
|
264
|
+
},
|
|
265
|
+
responses: {
|
|
266
|
+
200: {
|
|
267
|
+
description: "Server resources",
|
|
268
|
+
content: { "application/json": { schema: ResourcesListResponseSchema } }
|
|
269
269
|
},
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
content: { "application/json": { schema: ResourcesListResponseSchema } }
|
|
274
|
-
},
|
|
275
|
-
404: {
|
|
276
|
-
description: "Not found",
|
|
277
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
278
|
-
}
|
|
270
|
+
404: {
|
|
271
|
+
description: "Not found",
|
|
272
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
279
273
|
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
const getResourceContentRoute = (0, import_zod_openapi.createRoute)({
|
|
277
|
+
method: "get",
|
|
278
|
+
path: "/mcp/servers/{serverId}/resources/{resourceId}/content",
|
|
279
|
+
summary: "Read Server Resource Content",
|
|
280
|
+
description: "Reads content from a specific resource on an MCP server. This endpoint automatically constructs the qualified URI format (mcp:serverId:resourceId)",
|
|
281
|
+
tags: ["mcp"],
|
|
282
|
+
request: {
|
|
283
|
+
params: import_zod_openapi.z.object({
|
|
284
|
+
serverId: import_zod_openapi.z.string().describe("The ID of the MCP server"),
|
|
285
|
+
resourceId: import_zod_openapi.z.string().min(1, "Resource ID is required").transform((encoded) => decodeURIComponent(encoded)).describe("The URI-encoded resource identifier on that server")
|
|
286
|
+
})
|
|
287
|
+
},
|
|
288
|
+
responses: {
|
|
289
|
+
200: {
|
|
290
|
+
description: "Resource content",
|
|
291
|
+
content: { "application/json": { schema: ResourceContentResponseSchema } }
|
|
292
292
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
content: { "application/json": { schema: ResourceContentResponseSchema } }
|
|
297
|
-
},
|
|
298
|
-
404: {
|
|
299
|
-
description: "Not found",
|
|
300
|
-
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
301
|
-
}
|
|
293
|
+
404: {
|
|
294
|
+
description: "Not found",
|
|
295
|
+
content: { "application/json": { schema: import_responses.ApiErrorResponseSchema } }
|
|
302
296
|
}
|
|
303
|
-
}
|
|
304
|
-
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
300
|
+
const app = new import_zod_openapi.OpenAPIHono();
|
|
301
|
+
const serverRegistrationRouter = new import_zod_openapi.OpenAPIHono().openapi(addServerRoute, async (ctx) => {
|
|
305
302
|
const agent = await getAgent(ctx);
|
|
306
303
|
const { name, config, persistToAgent } = ctx.req.valid("json");
|
|
307
304
|
await agent.addMcpServer(name, config);
|
|
@@ -356,7 +353,8 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
356
353
|
throw import_core.MCPError.serverNotFound(serverId);
|
|
357
354
|
}
|
|
358
355
|
return ctx.json({ name: serverId, config: import_core.McpServerConfigSchema.parse(config) }, 200);
|
|
359
|
-
})
|
|
356
|
+
});
|
|
357
|
+
const serverUpdateRouter = new import_zod_openapi.OpenAPIHono().openapi(updateServerRoute, async (ctx) => {
|
|
360
358
|
const agent = await getAgent(ctx);
|
|
361
359
|
const { serverId } = ctx.req.valid("param");
|
|
362
360
|
const { config, persistToAgent } = ctx.req.valid("json");
|
|
@@ -382,15 +380,15 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
382
380
|
import_core.logger.info(`Saved server '${serverId}' to agent configuration file`);
|
|
383
381
|
} catch (saveError) {
|
|
384
382
|
const errorMessage = saveError instanceof Error ? saveError.message : String(saveError);
|
|
385
|
-
import_core.logger.warn(
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
);
|
|
383
|
+
import_core.logger.warn(`Failed to persist MCP server '${serverId}' update: ${errorMessage}`, {
|
|
384
|
+
error: saveError
|
|
385
|
+
});
|
|
389
386
|
}
|
|
390
387
|
}
|
|
391
388
|
const status = config.enabled === false ? "registered" : "connected";
|
|
392
389
|
return ctx.json({ status, name: serverId }, 200);
|
|
393
|
-
})
|
|
390
|
+
});
|
|
391
|
+
const serverToolsRouter = new import_zod_openapi.OpenAPIHono().openapi(toolsRoute, async (ctx) => {
|
|
394
392
|
const agent = await getAgent(ctx);
|
|
395
393
|
const { serverId } = ctx.req.valid("param");
|
|
396
394
|
const client = agent.getMcpClients().get(serverId);
|
|
@@ -402,11 +400,13 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
402
400
|
id: toolName,
|
|
403
401
|
name: toolName,
|
|
404
402
|
description: toolDef.description || "",
|
|
405
|
-
inputSchema: toolDef.parameters === void 0 ? void 0 : ToolInputSchema.parse(toolDef.parameters),
|
|
406
|
-
_meta: toolDef._meta
|
|
403
|
+
inputSchema: toolDef.parameters === void 0 ? void 0 : import_responses.ToolInputSchema.parse(toolDef.parameters),
|
|
404
|
+
_meta: toolDef._meta === void 0 ? void 0 : import_responses.JsonObjectSchema.parse(toolDef._meta)
|
|
407
405
|
}));
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
const response = { tools };
|
|
407
|
+
return ctx.json(response, 200);
|
|
408
|
+
});
|
|
409
|
+
const deleteServerRouter = new import_zod_openapi.OpenAPIHono().openapi(deleteServerRoute, async (ctx) => {
|
|
410
410
|
const agent = await getAgent(ctx);
|
|
411
411
|
const { serverId } = ctx.req.valid("param");
|
|
412
412
|
const clientExists = agent.getMcpClients().has(serverId) || agent.getMcpFailedConnections()[serverId];
|
|
@@ -414,8 +414,10 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
414
414
|
throw import_core.MCPError.serverNotFound(serverId);
|
|
415
415
|
}
|
|
416
416
|
await agent.removeMcpServer(serverId);
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
const response = { status: "disconnected", id: serverId };
|
|
418
|
+
return ctx.json(response, 200);
|
|
419
|
+
});
|
|
420
|
+
const restartServerRouter = new import_zod_openapi.OpenAPIHono().openapi(restartServerRoute, async (ctx) => {
|
|
419
421
|
const agent = await getAgent(ctx);
|
|
420
422
|
const { serverId } = ctx.req.valid("param");
|
|
421
423
|
import_core.logger.info(`Received request to POST /api/mcp/servers/${serverId}/restart`);
|
|
@@ -425,8 +427,10 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
425
427
|
throw import_core.MCPError.serverNotFound(serverId);
|
|
426
428
|
}
|
|
427
429
|
await agent.restartMcpServer(serverId);
|
|
428
|
-
|
|
429
|
-
|
|
430
|
+
const response = { status: "restarted", id: serverId };
|
|
431
|
+
return ctx.json(response, 200);
|
|
432
|
+
});
|
|
433
|
+
const execToolRouter = new import_zod_openapi.OpenAPIHono().openapi(execToolRoute, async (ctx) => {
|
|
430
434
|
const agent = await getAgent(ctx);
|
|
431
435
|
const { serverId, toolName } = ctx.req.valid("param");
|
|
432
436
|
const body = ctx.req.valid("json");
|
|
@@ -436,16 +440,25 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
436
440
|
}
|
|
437
441
|
try {
|
|
438
442
|
const rawResult = await client.callTool(toolName, body);
|
|
439
|
-
|
|
443
|
+
const response = {
|
|
444
|
+
success: true,
|
|
445
|
+
data: import_responses.JsonValueSchema.parse(rawResult)
|
|
446
|
+
};
|
|
447
|
+
return ctx.json(response, 200);
|
|
440
448
|
} catch (error) {
|
|
441
449
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
442
450
|
import_core.logger.error(
|
|
443
451
|
`Tool execution failed for '${toolName}' on server '${serverId}': ${errorMessage}`,
|
|
444
452
|
{ error }
|
|
445
453
|
);
|
|
446
|
-
|
|
454
|
+
const response = {
|
|
455
|
+
success: false,
|
|
456
|
+
error: errorMessage
|
|
457
|
+
};
|
|
458
|
+
return ctx.json(response, 200);
|
|
447
459
|
}
|
|
448
|
-
})
|
|
460
|
+
});
|
|
461
|
+
const listResourcesRouter = new import_zod_openapi.OpenAPIHono().openapi(listResourcesRoute, async (ctx) => {
|
|
449
462
|
const agent = await getAgent(ctx);
|
|
450
463
|
const { serverId } = ctx.req.valid("param");
|
|
451
464
|
const client = agent.getMcpClients().get(serverId);
|
|
@@ -453,18 +466,36 @@ function createMcpRouter(getAgent, getAgentConfigPath) {
|
|
|
453
466
|
throw import_core.MCPError.serverNotFound(serverId);
|
|
454
467
|
}
|
|
455
468
|
const resources = await agent.listResourcesForServer(serverId);
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
const agent = await getAgent(ctx);
|
|
459
|
-
const { serverId, resourceId } = ctx.req.valid("param");
|
|
460
|
-
const client = agent.getMcpClients().get(serverId);
|
|
461
|
-
if (!client) {
|
|
462
|
-
throw import_core.MCPError.serverNotFound(serverId);
|
|
463
|
-
}
|
|
464
|
-
const qualifiedUri = `mcp:${serverId}:${resourceId}`;
|
|
465
|
-
const content = await agent.readResource(qualifiedUri);
|
|
466
|
-
return ctx.json({ success: true, data: { content } }, 200);
|
|
469
|
+
const response = { success: true, resources };
|
|
470
|
+
return ctx.json(response, 200);
|
|
467
471
|
});
|
|
472
|
+
const getResourceContentRouter = new import_zod_openapi.OpenAPIHono().openapi(
|
|
473
|
+
getResourceContentRoute,
|
|
474
|
+
async (ctx) => {
|
|
475
|
+
const agent = await getAgent(ctx);
|
|
476
|
+
const { serverId, resourceId } = ctx.req.valid("param");
|
|
477
|
+
const client = agent.getMcpClients().get(serverId);
|
|
478
|
+
if (!client) {
|
|
479
|
+
throw import_core.MCPError.serverNotFound(serverId);
|
|
480
|
+
}
|
|
481
|
+
const qualifiedUri = `mcp:${serverId}:${resourceId}`;
|
|
482
|
+
const content = await agent.readResource(qualifiedUri);
|
|
483
|
+
const response = {
|
|
484
|
+
success: true,
|
|
485
|
+
data: { content: import_responses.JsonValueSchema.parse(content) }
|
|
486
|
+
};
|
|
487
|
+
return ctx.json(response, 200);
|
|
488
|
+
}
|
|
489
|
+
);
|
|
490
|
+
mountMcpSubrouter(app, serverRegistrationRouter);
|
|
491
|
+
mountMcpSubrouter(app, serverUpdateRouter);
|
|
492
|
+
mountMcpSubrouter(app, serverToolsRouter);
|
|
493
|
+
mountMcpSubrouter(app, deleteServerRouter);
|
|
494
|
+
mountMcpSubrouter(app, restartServerRouter);
|
|
495
|
+
mountMcpSubrouter(app, execToolRouter);
|
|
496
|
+
mountMcpSubrouter(app, listResourcesRouter);
|
|
497
|
+
mountMcpSubrouter(app, getResourceContentRouter);
|
|
498
|
+
return app;
|
|
468
499
|
}
|
|
469
500
|
// Annotate the CommonJS export names for ESM import in node:
|
|
470
501
|
0 && (module.exports = {
|