Skip to content

Commit 47eff5a

Browse files
committed
.changeset/dull-ads-shake.md src/next/mcp-api-handler.ts
1 parent 4513571 commit 47eff5a

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.changeset/dull-ads-shake.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vercel/mcp-adapter": patch
3+
---
4+
5+
Fix allowing both async and non async handlers

src/next/mcp-api-handler.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ export function calculateEndpoints({
152152
sseEndpoint: fullSseEndpoint,
153153
sseMessageEndpoint: fullSseMessageEndpoint,
154154
} = basePath != null
155-
? deriveEndpointsFromBasePath(basePath)
156-
: {
155+
? deriveEndpointsFromBasePath(basePath)
156+
: {
157157
streamableHttpEndpoint,
158158
sseEndpoint,
159159
sseMessageEndpoint,
@@ -203,7 +203,9 @@ async function initializeRedis({
203203
}
204204

205205
export function initializeMcpApiHandler(
206-
initializeServer: (server: McpServer) => Promise<void>,
206+
initializeServer:
207+
| ((server: McpServer) => Promise<void>)
208+
| ((server: McpServer) => void),
207209
serverOptions: ServerOptions = {},
208210
config: Config = {
209211
redisUrl: process.env.REDIS_URL || process.env.KV_URL,
@@ -633,7 +635,7 @@ function createFakeIncomingMessage(
633635

634636
// Create a readable stream that will be used as the base for IncomingMessage
635637
const readable = new Readable();
636-
readable._read = (): void => {}; // Required implementation
638+
readable._read = (): void => { }; // Required implementation
637639

638640
// Add the body content if provided
639641
if (body) {

0 commit comments

Comments
 (0)