Skip to content

Commit dd7ede7

Browse files
committed
feat: middleware pattern
1 parent 6b4d99f commit dd7ede7

79 files changed

Lines changed: 597 additions & 219 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/server/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"hono": "catalog:runtimeServerOnly",
3939
"@modelcontextprotocol/examples-shared": "workspace:^",
4040
"@modelcontextprotocol/server": "workspace:^",
41+
"@modelcontextprotocol/express": "workspace:^",
4142
"cors": "catalog:runtimeServerOnly",
4243
"express": "catalog:runtimeServerOnly",
4344
"zod": "catalog:runtimeShared"

examples/server/src/elicitationFormExample.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import { randomUUID } from 'node:crypto';
1111

12-
import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server';
12+
import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/express';
1313
import { type Request, type Response } from 'express';
1414

1515
// Create MCP server - it will automatically use AjvJsonSchemaValidator with sensible defaults

examples/server/src/elicitationUrlExample.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import { randomUUID } from 'node:crypto';
1111

1212
import { setupAuthServer } from '@modelcontextprotocol/examples-shared';
13-
import type { CallToolResult, ElicitRequestURLParams, ElicitResult, OAuthMetadata } from '@modelcontextprotocol/server';
13+
import type { CallToolResult, ElicitRequestURLParams, ElicitResult, OAuthMetadata } from '@modelcontextprotocol/express';
1414
import {
1515
checkResourceAllowed,
1616
createMcpExpressApp,
@@ -21,7 +21,7 @@ import {
2121
requireBearerAuth,
2222
StreamableHTTPServerTransport,
2323
UrlElicitationRequiredError
24-
} from '@modelcontextprotocol/server';
24+
} from '@modelcontextprotocol/express';
2525
import cors from 'cors';
2626
import type { Request, Response } from 'express';
2727
import express from 'express';

examples/server/src/honoWebStandardStreamableHttp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
*/
99

1010
import { serve } from '@hono/node-server';
11-
import type { CallToolResult } from '@modelcontextprotocol/server';
12-
import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/server';
11+
import type { CallToolResult } from '@modelcontextprotocol/express';
12+
import { McpServer, WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/express';
1313
import { Hono } from 'hono';
1414
import { cors } from 'hono/cors';
1515
import * as z from 'zod/v4';

examples/server/src/inMemoryEventStore.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { EventStore, JSONRPCMessage } from '@modelcontextprotocol/server';
1+
import type { EventStore, JSONRPCMessage } from '@modelcontextprotocol/express';
22

33
/**
44
* Simple in-memory implementation of the EventStore interface for resumability

examples/server/src/jsonResponseStreamableHttp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { randomUUID } from 'node:crypto';
22

3-
import type { CallToolResult } from '@modelcontextprotocol/server';
4-
import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server';
3+
import type { CallToolResult } from '@modelcontextprotocol/express';
4+
import { createMcpExpressApp, isInitializeRequest, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/express';
55
import type { Request, Response } from 'express';
66
import * as z from 'zod/v4';
77

examples/server/src/mcpServerOutputSchema.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This demonstrates how to easily create tools with structured output
55
*/
66

7-
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server';
7+
import { McpServer, StdioServerTransport } from '@modelcontextprotocol/express';
88
import * as z from 'zod/v4';
99

1010
const server = new McpServer({

examples/server/src/simpleSseServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { CallToolResult } from '@modelcontextprotocol/server';
2-
import { createMcpExpressApp, McpServer, SSEServerTransport } from '@modelcontextprotocol/server';
1+
import type { CallToolResult } from '@modelcontextprotocol/express';
2+
import { createMcpExpressApp, McpServer, SSEServerTransport } from '@modelcontextprotocol/express';
33
import type { Request, Response } from 'express';
44
import * as z from 'zod/v4';
55

examples/server/src/simpleStatelessStreamableHttp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { CallToolResult, GetPromptResult, ReadResourceResult } from '@modelcontextprotocol/server';
2-
import { createMcpExpressApp, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/server';
1+
import type { CallToolResult, GetPromptResult, ReadResourceResult } from '@modelcontextprotocol/express';
2+
import { createMcpExpressApp, McpServer, StreamableHTTPServerTransport } from '@modelcontextprotocol/express';
33
import type { Request, Response } from 'express';
44
import * as z from 'zod/v4';
55

examples/server/src/simpleStreamableHttp.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type {
88
PrimitiveSchemaDefinition,
99
ReadResourceResult,
1010
ResourceLink
11-
} from '@modelcontextprotocol/server';
11+
} from '@modelcontextprotocol/express';
1212
import {
1313
checkResourceAllowed,
1414
createMcpExpressApp,
@@ -21,7 +21,7 @@ import {
2121
McpServer,
2222
requireBearerAuth,
2323
StreamableHTTPServerTransport
24-
} from '@modelcontextprotocol/server';
24+
} from '@modelcontextprotocol/express';
2525
import type { Request, Response } from 'express';
2626
import * as z from 'zod/v4';
2727

0 commit comments

Comments
 (0)