loading…
Search for a command to run...
loading…
A minimal tool server demonstrating Model Context Protocol (MCP) interactions via local CLI and WebSocket transports. It provides tools for simple greeting resp
A minimal tool server demonstrating Model Context Protocol (MCP) interactions via local CLI and WebSocket transports. It provides tools for simple greeting responses and making external HTTP API calls using a configurable base URL.
Quick demo to show the local MCP client/server example.
Prerequisites
Install (if you haven't already):
npm install
Run the demo (spawns multiple clients):
npm run demo
Or run a single client with a custom name:
node client.js Stephen
What it does
server.js is a minimal newline-delimited JSON tool server exposing say_hello.client.js spawns server.js, sends { tool: 'say_hello', args: { name } }, and logs the response.demo.js runs several client.js instances concurrently to showcase multiple requests and responses.Web demo
npm run web
# then open http://localhost:3000 in a browser
The web UI lets you type a name and click "Send say_hello" to demonstrate the MCP request/response flow over WebSocket.
Calling external APIs from the server
call_api tool.Usage (CLI/stdin): send a request like:
{ "id": 1, "tool": "call_api", "args": { "path": "/status" } }
If EXTERNAL_API_BASE is set in the environment the path will be resolved relative to that base. Example (PowerShell):
$env:EXTERNAL_API_BASE = 'https://api.example.com'
echo '{ "id": 1, "tool": "call_api", "args": { "path": "/status" } }' | node server.js
The server will return a JSON response containing status, headers, and body (parsed JSON when possible).
Want a web-based demo or a demo that uses the installed @modelcontextprotocol/sdk transport? I can implement that next.
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-server-demo": {
"command": "npx",
"args": []
}
}
}