Gathering detailed insights and metrics for mcp-http-server
Gathering detailed insights and metrics for mcp-http-server
Gathering detailed insights and metrics for mcp-http-server
Gathering detailed insights and metrics for mcp-http-server
@aashari/boilerplate-mcp-server
TypeScript MCP server boilerplate with STDIO and HTTP transport support, CLI tools, and extensible architecture
@devpartner/mcp-server
MCP STDIO-to-HTTP proxy for DEVPartner - Forwards all requests to HTTP MCP server for perfect feature parity
@purinton/mcp-server
A Node.js server for the Model Context Protocol (MCP) with dynamic tool loading, HTTP API, and authentication.
atlas-mcp-server
ATLAS (Adaptive Task & Logic Automation System): An MCP server enabling LLM agents to manage projects, tasks, and knowledge via a Neo4j-backed, three-tier architecture. Facilitates complex workflow automation and project management through LLM Agents.
The Open-sourced Multimodal AI Agent Stack connecting Cutting-edge AI Models and Agent Infra.
npm install mcp-http-server
Typescript
Module System
Node Version
NPM Version
TypeScript (92.09%)
MDX (4.09%)
JavaScript (1.63%)
CSS (1.52%)
Less (0.32%)
HTML (0.22%)
Shell (0.06%)
Dockerfile (0.06%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
Apache-2.0 License
15,153 Stars
556 Commits
1,349 Forks
137 Watchers
102 Branches
41 Contributors
Updated on Jul 13, 2025
Latest Version
1.2.2
Package Id
mcp-http-server@1.2.2
Unpacked Size
41.67 kB
Size
10.60 kB
File Count
11
NPM Version
10.9.2
Node Version
22.15.0
Published on
Jul 09, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A high performance HTTP+SSE Server with Request Headers for MCP Server.
1npm i mcp-http-server -S
1import { startSseAndStreamableHttpMcpServer } from 'mcp-http-server'; 2import { createServer } from './server.js'; 3 4await startSseAndStreamableHttpMcpServer({ 5 port: 3000, 6 createMcpServer: async (params) => { 7 console.log('Request headers:', params.headers); 8 return createServer(); 9 }, 10});
startSseAndStreamableHttpMcpServer(params)
Parameter | Type | Description |
---|---|---|
port | number | Port to listen on (default: 8080) |
host | string | Host to bind to (default: '::') |
stateless | boolean | Enable stateless mode for streamable HTTP (default: true) |
middlewares | MiddlewareFunction[] | Custom Express middlewares |
routes | RoutesConfig | Custom route configuration |
logger | Logger | Custom logger instance |
createMcpServer | function | Factory function to create MCP server instances |
The server supports flexible route configuration through the routes
parameter.
By default, the server uses the following routes:
1{ 2 prefix: '/', // Route prefix for all endpoints 3 mcp: '/mcp', // MCP endpoint path 4 message: '/message', // Message endpoint path for SSE 5 sse: '/sse' // SSE endpoint path 6}
This creates the following endpoints:
/mcp
- MCP HTTP transport/mcp
- Returns 405 (Method Not Allowed) or SSE stream/sse
- SSE connection endpoint/message
- SSE message endpointYou can customize routes using the routes
configuration:
1await startSseAndStreamableHttpMcpServer({
2 port: 3000,
3 routes: {
4 prefix: '/api/v1',
5 mcp: '/custom-mcp',
6 message: '/custom-message',
7 sse: '/custom-sse'
8 },
9 createMcpServer: async () => createServer(),
10});
This creates endpoints at:
/api/v1/custom-mcp
- MCP HTTP transport/api/v1/custom-mcp
- Returns 405 or SSE stream/api/v1/custom-sse
- SSE connection endpoint/api/v1/custom-message
- SSE message endpointroutes.prefix
string
'/'
routes.mcp
string
'/mcp'
routes.message
string
'/message'
routes.sse
string
'/sse'
The server automatically handles leading/trailing slashes in paths:
1// These configurations are equivalent: 2routes: { 3 prefix: '/api/v2/', 4 mcp: 'mcp-endpoint', 5 sse: '/sse-endpoint/' 6} 7 8routes: { 9 prefix: '/api/v2', 10 mcp: '/mcp-endpoint', 11 sse: 'sse-endpoint' 12}
Both result in:
/api/v2/mcp-endpoint
/api/v2/sse-endpoint/
1import { startSseAndStreamableHttpMcpServer } from 'mcp-http-server'; 2import { Server } from '@modelcontextprotocol/sdk/server/index.js'; 3 4const server = await startSseAndStreamableHttpMcpServer({ 5 port: 3000, 6 createMcpServer: async () => { 7 return new Server( 8 { name: 'my-server', version: '1.0.0' }, 9 { capabilities: { tools: {} } } 10 ); 11 }, 12}); 13 14console.log(`Server running at ${server.url}`);
1import { startSseAndStreamableHttpMcpServer } from 'mcp-http-server'; 2 3const authMiddleware = (req, res, next) => { 4 const token = req.headers.authorization; 5 if (!token) { 6 return res.status(401).json({ error: 'Unauthorized' }); 7 } 8 next(); 9}; 10 11await startSseAndStreamableHttpMcpServer({ 12 port: 3000, 13 host: 'localhost', 14 routes: { 15 prefix: '/api/v1', 16 mcp: '/mcp', 17 sse: '/events' 18 }, 19 middlewares: [authMiddleware], 20 createMcpServer: async (context) => { 21 console.log('User agent:', context.headers['user-agent']); 22 return createServer(); 23 }, 24});
1import { program } from 'commander'; 2import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; 3 4program 5 .name('mcp-server') 6 .description('MCP server with HTTP and stdio support') 7 .version('1.0.0') 8 .option('--host <host>', 'host to bind server to') 9 .option('--port <port>', 'port to listen on for HTTP transport') 10 .option('--prefix <prefix>', 'route prefix for HTTP endpoints', '/api') 11 .action(async (options) => { 12 try { 13 if (options.port || options.host) { 14 // HTTP/SSE transport 15 await startSseAndStreamableHttpMcpServer({ 16 host: options.host, 17 port: options.port ? parseInt(options.port) : undefined, 18 routes: { 19 prefix: options.prefix, 20 }, 21 createMcpServer: async (params) => { 22 console.log('HTTP request from:', params.headers['user-agent']); 23 return createServer(); 24 }, 25 }); 26 } else { 27 // Stdio transport 28 const server = createServer(); 29 const transport = new StdioServerTransport(); 30 await server.connect(transport); 31 console.debug('MCP Server running on stdio'); 32 } 33 } catch (error) { 34 console.error('Error:', error); 35 process.exit(1); 36 } 37 }); 38 39program.parse();
1await startSseAndStreamableHttpMcpServer({
2 stateless: false, // Enable stateful mode
3 createMcpServer: async () => createServer(),
4});
In stateful mode:
1await startSseAndStreamableHttpMcpServer({
2 stateless: true, // Default
3 createMcpServer: async () => createServer(),
4});
In stateless mode:
startSseAndStreamableHttpMcpServer
returns a McpServerEndpoint
object:
1interface McpServerEndpoint { 2 url: string; // Full URL to MCP endpoint 3 sseUrl: string; // Full URL to SSE endpoint 4 port: number; // Server port 5 close: () => void; // Function to close server 6}
Example:
1const endpoint = await startSseAndStreamableHttpMcpServer({ 2 port: 3000, 3 routes: { prefix: '/api' }, 4 createMcpServer: async () => createServer(), 5}); 6 7console.log('MCP endpoint:', endpoint.url); // http://localhost:3000/api/mcp 8console.log('SSE endpoint:', endpoint.sseUrl); // http://localhost:3000/api/sse 9 10// Gracefully shutdown 11process.on('SIGTERM', () => { 12 endpoint.close(); 13});
MIT
No vulnerabilities found.
Reason
30 commit(s) and 24 issue activity found in the last 90 days -- score normalized to 10
Reason
security policy file detected
Details
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
project has 15 contributing companies or organizations
Details
Reason
SAST tool is not run on all commits -- score normalized to 9
Details
Reason
28 out of 29 merged PRs checked by a CI test -- score normalized to 9
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 6/30 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
no update tool detected
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
project is not fuzzed
Details
Reason
37 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-12T18:31:21Z
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More