loading…
Search for a command to run...
loading…
A lightweight Node.js-based MCP server that exposes custom tools via HTTP and Server-Sent Events (SSE) for clients like Postman. It allows users to register too
A lightweight Node.js-based MCP server that exposes custom tools via HTTP and Server-Sent Events (SSE) for clients like Postman. It allows users to register tools with type-safe validation to establish bidirectional communication with MCP clients.
A lightweight Model Context Protocol (MCP) server built with Node.js that exposes custom tools via HTTP/SSE for clients like Postman.
This project implements an MCP server that communicates with external clients using Server-Sent Events (SSE) over HTTP. It demonstrates how to:
greet tool that clients can invoke.
├── index.js # Main MCP server implementation
├── package.json # Project dependencies and metadata
├── package-lock.json # Dependency lock file
├── .gitignore # Git ignore rules
└── README.md # This file
git clone https://github.com/gunjankum06/mcp.git
cd mcp
npm install
node index.js
You should see:
🚀 Server ready at http://localhost:3000/sse
MCP clients (like Postman, Claude, or custom applications) can connect to the server:
http://localhost:3000/ssehttp://localhost:3000/message to invoke toolsgreetGreets a person by name.
Parameters:
name (string, required): The name of the person to greetResponse:
{
"content": [
{
"type": "text",
"text": "Hello {name}! MCP is running on your laptop."
}
]
}
Example:
POST http://localhost:3000/message
Content-Type: application/json
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "greet",
"arguments": {
"name": "John"
}
}
}
MCP Server (McpServer)
SSE Transport (SSEServerTransport)
/message callbacks back to the serverExpress API
/sse (GET): Endpoint for client connection initialization/message (POST): Endpoint for receiving client messagesClient Server
| |
|---- GET /sse -------> |
| Create SSE Transport
| Connect MCP Server
|<----- SSE Stream ---- |
| |
|---- POST /message ------> |
| (tool call request) Process Request
| |
|<----- Response ------- |
| (tool response) |
The server is configured in index.js with:
MyPostmanServer1.0.03000To modify these, edit the corresponding values in the code.
/message routeTo add a new tool, use the server.tool() method:
server.tool(
"toolName",
{ param1: z.string(), param2: z.number() },
async ({ param1, param2 }) => ({
content: [{ type: "text", text: `Result: ${param1} ${param2}` }]
})
);
For development with auto-reload, install nodemon:
npm install --save-dev nodemon
nodemon index.js
If port 3000 is already in use, modify the port number in index.js:
app.listen(YOUR_PORT, () => {
console.log(`🚀 Server ready at http://localhost:YOUR_PORT/sse`);
});
MIT
gunjankum06 - GitHub user
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mypostmanserver": {
"command": "npx",
"args": []
}
}
}PRs, issues, code search, CI status
Database, auth and storage
Reference / test server with prompts, resources, and tools.
Secure file operations with configurable access controls.