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-mcp
andbunx 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 settings - Search for "MCP" or navigate to Extensions > MCP
- Press
- Add MCP Server Configuration:
- Alternative: Use Native MCP Server:
For Claude Desktop
- Edit Configuration File:
- Open
claude_desktop_config.json
in your Claude Desktop settings - Location varies by OS:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
- Open
- Add MCP Server:
- 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:
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:
For Other MCP Clients
Most MCP clients follow a similar configuration pattern:
Configuration Options
command
: The command to run (usuallynode
for 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:
- Test MCP endpoints:
- 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=production
for 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
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Exposes Express.js API endpoints as MCP tools, preserving existing schemas and authentication behavior. Supports streaming responses and can be mounted directly to existing Express apps or run as a standalone gateway.
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 -2110PythonMIT 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 -8PythonMIT License
- -securityAlicense-qualityGenerate an MCP server for any OpenAPI documented endpoint.Last updated -273GoMIT 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 -527TypeScript