Skip to content

Commit e32beaa

Browse files
authored
Allow custom MCP path (#17)
* Allow custom MCP path * Bump version
1 parent 28d92ab commit e32beaa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

deno.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@deco/mcp",
3-
"version": "0.5.6",
3+
"version": "0.6.0",
44
"exports": {
55
".": "./mod.ts",
66
"./http": "./mcp/http.ts"

mcp/server.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export interface Options<TManifest extends AppManifest> {
5151
exclude?: Array<keyof (TManifest["actions"] & TManifest["loaders"])>;
5252
blocks?: Array<keyof TManifest>;
5353
basePath?: string;
54+
/**
55+
* Custom path for MCP messages endpoint. Defaults to /mcp/messages if not provided.
56+
*/
57+
mcpPath?: string;
5458
middlewares?: {
5559
listTools?: ListToolsMiddleware[];
5660
callTool?: CallToolMiddleware[];
@@ -328,7 +332,8 @@ export function mcpServer<TManifest extends AppManifest>(
328332
}
329333

330334
// Main message endpoint - handles both stateless requests and SSE upgrades
331-
if (path === `${options?.basePath ?? ""}${MESSAGES_ENDPOINT}`) {
335+
const mcpPath = options?.mcpPath ?? MESSAGES_ENDPOINT;
336+
if (path === `${options?.basePath ?? ""}${mcpPath}`) {
332337
// For stateless transport
333338
const transport = new HttpServerTransport();
334339
await mcp.server.connect(transport);

0 commit comments

Comments
 (0)