Exposes Express.js application endpoints as MCP tools, preserving existing schemas, authentication middleware, and supporting streaming responses including Server-Sent Events and chunked transfers
express_mcp
Expose your Express endpoints as MCP tools (mount to your app or run a standalone HTTP gateway), preserving schemas and auth behavior.
Inspiration: FastAPI-MCP — https://github.com/tadata-org/fastapi_mcp
Features
Zero Configuration: Works out-of-the-box with existing Express apps
Schema Preservation: Supports OpenAPI v3 and zod annotations
Auth Integration: Reuses existing Express middleware (no bypass)
Flexible Deployment: Mount to same app or run standalone
In-Process Efficiency: Direct middleware execution (no HTTP overhead)
🚀 Streaming Support: Handle Server-Sent Events, file downloads, and real-time data
📦 NPX/Bunx Commands: Easy CLI access with
npx expressjs-mcpandbunx expressjs-mcp
Installation
Option 1: Install from npm (Recommended)
Option 2: Clone and build locally
Quick Start
Option 1: CLI Commands (Recommended)
Option 2: Manual Setup
Native MCP Server (New!)
Express-MCP now includes a native MCP server using the official @modelcontextprotocol/sdk:
MCP Client Configuration
Once your Express server is running with MCP endpoints, you need to configure your MCP client to connect to it. Here are instructions for popular MCP clients:
For Cursor IDE
Open Cursor Settings:
Press
Cmd/Ctrl + ,to open settingsSearch for "MCP" or navigate to Extensions > MCP
Add MCP Server Configuration:
{ "mcpServers": { "expressjs-mcp": { "command": "node", "args": ["/path/to/your/project/server.js"], "env": { "NODE_ENV": "production" } } } }Alternative: Use Native MCP Server:
{ "mcpServers": { "expressjs-mcp": { "command": "npx", "args": ["expressjs-mcp", "--url", "http://localhost:3000/mcp"] } } }
For Claude Desktop
Edit Configuration File:
Open
claude_desktop_config.jsonin your Claude Desktop settingsLocation varies by OS:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
Add MCP Server:
{ "mcpServers": { "expressjs-mcp": { "command": "node", "args": ["/absolute/path/to/your/project/server.js"], "env": { "NODE_ENV": "production" } } } }Restart Claude Desktop after making changes
For Claude Web
Access MCP Settings:
Go to claude.ai
Click on your profile/settings
Look for "MCP Configuration" or "Model Context Protocol"
Add Server Configuration:
{ "mcpServers": { "expressjs-mcp": { "command": "node", "args": ["/path/to/your/project/server.js"] } } }
For VS Code with MCP Extension
Install MCP Extension:
Search for "MCP" in VS Code extensions
Install the official MCP extension
Configure in settings.json:
{ "mcp.servers": { "expressjs-mcp": { "command": "node", "args": ["/path/to/your/project/server.js"] } } }
For Other MCP Clients
Most MCP clients follow a similar configuration pattern:
Configuration Options
command: The command to run (usuallynodefor JavaScript/TypeScript)args: Array of arguments (path to your server file)env: Environment variables (optional)cwd: Working directory (optional)
Testing Your Configuration
Start your Express server:
node server.jsTest MCP endpoints:
# Check available tools curl http://localhost:3000/mcp/tools # Test a tool invocation curl -X POST http://localhost:3000/mcp/invoke \ -H "Content-Type: application/json" \ -d '{"toolName": "GET_/hello", "args": {}}'Verify in your MCP client:
The MCP client should show available tools
You should be able to invoke tools through the client interface
Troubleshooting
Common Issues:
Path Issues: Use absolute paths in your configuration
Permission Issues: Ensure the server file is executable
Port Conflicts: Make sure your Express server is running on the expected port
Environment Variables: Set
NODE_ENV=productionfor better performance
Debug Mode:
Check MCP Server Status:
Streaming Support
Express MCP supports three types of streaming for real-time data:
🌊 1. HTTP Chunked Streaming
📡 2. Server-Sent Events (SSE)
📄 3. NDJSON/JSON Lines
Testing All Streaming Types
Documentation
🚀 Quick MCP Setup - Get started in 3 steps
📁 Examples & Tutorials - Complete example walkthroughs
🔧 Working MCP Configurations - IMPORTANT: Working configs before npm publish
🚀 Publishing & CI/CD - Automated npm publishing workflow
MCP Client Setup - Detailed configuration guide
Streaming Guide - Comprehensive streaming documentation
Usage Guide - API reference and examples
Architecture - Technical overview
PRD - Product requirements
Development
Configuration Options
OpenAPI: Provide your OpenAPI v3 spec for rich schemas
Schema Annotations: Use zod for per-route type validation
Route Filtering: Include/exclude specific endpoints
Auth Preservation: Existing middleware runs unchanged
Streaming: Automatic detection and handling of streaming responses
Timeouts: Configurable request timeouts for long-running operations
Related MCP Servers
- -securityAlicense-qualityA Python-based MCP server that integrates OpenAPI-described REST APIs into MCP workflows, enabling dynamic exposure of API endpoints as MCP tools.Last updated -132MIT License
- -securityAlicense-qualityAn MCP server that exposes HTTP methods defined in an OpenAPI specification as tools, enabling interaction with APIs via the Model Context Protocol.Last updated -8MIT License
- -securityAlicense-qualityGenerate an MCP server for any OpenAPI documented endpoint.Last updated -312MIT License
- -securityFlicense-qualityA utility that integrates Model Context Protocol (MCP) into Express applications, offering both stateful session management and stateless request handling options.Last updated -43511