A minimal, complete demonstration of the Model Context Protocol (MCP) featuring both server and client implementations with prompts, tools, and resources.
This project showcases the core capabilities of MCP:
- Prompts: Pre-defined templates for common tasks
- Tools: Callable functions that perform operations
- Resources: Accessible data sources
graph LR
subgraph Local [Local Machine]
direction TB
Client["Client (IDE/CLI)"]
subgraph LServer ["Local Server (Node.js)"]
direction TB
LStdi["Stdio Transport"]
LHandlers["Request Handlers"]
LTools["Tool Manager"]
LPrompts["Prompt Manager"]
LResources["Resource Manager"]
LStdi <--> LHandlers
LHandlers --> LTools
LHandlers --> LPrompts
LHandlers --> LResources
end
Client <-->|stdio| LStdi
LResources <--> LocalFiles["Local Files (JSON)"]
end
subgraph Cloud [Cloudflare Workers]
direction TB
RemoteClient["Client (IDE/CLI)"]
subgraph WServer [Worker Server]
direction TB
WHTTP["HTTP/SSE Transport"]
WHandlers["Request Handlers"]
WTools["Tool Manager"]
WPrompts["Prompt Manager"]
WResources["Resource Manager"]
WHTTP <--> WHandlers
WHandlers --> WTools
WHandlers --> WPrompts
WHandlers --> WResources
end
RemoteClient <-->|SSE/POST| WHTTP
WResources <--> MemRes["In-Memory Data"]
end
%% Align tops
Client ~~~ RemoteClient
| Category | Name | Description | Inputs |
|---|---|---|---|
| Prompt | creative-writing |
Generates a creative writing prompt based on a topic and style. | topic* (string), style (string, optional) |
| Prompt | code-review |
Creates a structured code review request. | language* (string), code* (string) |
| Prompt | explain-concept |
Explains a technical concept at a specified expertise level. | concept* (string), level (string, optional) |
| Tool | calculate |
Performs basic arithmetic operations (add, subtract, multiply, divide). | operation* ("add"|"subtract"|"multiply"|"divide"), a* (number), b* (number) |
| Tool | generate-uuid |
Generates a random UUID v4. | - |
| Tool | get-weather |
Returns simulated weather data for a given city. | city* (string) |
| Tool | reverse-string |
Reverses the provided text string. | text* (string) |
| Resource | quotes://all |
Retrieves a collection of programming quotes. | - |
| Resource | facts://all |
Retrieves a collection of technology facts. | - |
simplest-mcp/
├── local/ # Local MCP server implementation
│ ├── server.js # stdio transport server
│ ├── client.js # Local client demo
│ └── test.sh # Test script
├── remote/ # Cloudflare Workers implementation
│ ├── src/
│ │ └── worker.js # HTTP/SSE transport server
│ ├── proxy.js # SSE proxy for remote connection
│ ├── wrangler.toml # Workers configuration
│ └── client.js # Remote client demo
├── resources/ # Shared sample data
│ ├── quotes.json
│ └── facts.json
├── package.json # Project configuration
└── README.md # Documentation
git clone https://github.com/hissain/simplest-mcp.git
cd simplest-mcp
npm install# Run local demo
npm run client:local
# Or manually
node local/client.jsDeploy:
npm install -g wrangler
wrangler login
npm run deployTest Remote:
# Local dev server
npm run start:remote
# Remote client test
npm run client:remote -- http://localhost:8787Works with Google Antigravity IDE, Claude Desktop, and VS Code (Cline).
Add this to your IDE's MCP configuration file (e.g., claude_desktop_config.json, mcp.json, or Antigravity config):
{
"mcpServers": {
"simplest-mcp": {
"command": "node",
"args": ["/absolute/path/to/simplest-mcp/local/server.js"]
}
}
}Use this configuration to connect to the deployed Cloudflare Worker:
JSON Config:
{
"mcpServers": {
"simplest-mcp-remote": {
"command": "node",
"args": [
"/absolute/path/to/simplest-mcp/remote/proxy.js",
"https://your-worker.workers.dev/sse"
]
}
}
}VS Code (Cline) UI:
- Command:
MCP: Add Server - Name:
simplest-mcp-remote - Type:
sse - URL:
https://your-worker.workers.dev/sse
Demonstrates stdio transport:
npm run client:localDemonstrates HTTP/SSE transport:
npm run client:remote -- https://your-worker.workers.dev/sseUsing @modelcontextprotocol/sdk:
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
// Local Connection
const transport = new StdioClientTransport({
command: 'node',
args: ['local/server.js'],
});
const client = new Client({ name: 'my-client', version: '1.0.0' }, { capabilities: {} });
await client.connect(transport);Using mcp package:
from mcp import Client, StdioServerParameters
from mcp.client.stdio import stdio_client
server_params = StdioServerParameters(
command="node",
args=["local/server.js"],
)
async with stdio_client(server_params) as (read, write):
async with Client(read, write) as session:
# Initialize
await session.initialize()
# List tools
tools = await session.list_tools()
print(tools)Run the automated test suite:
./test.shThe test script will:
- Check for Node.js installation
- Install dependencies if needed
- Run the client demo
- Verify all features work correctly
Edit server.js and add to the PROMPTS object:
const PROMPTS = {
'my-prompt': {
name: 'my-prompt',
description: 'Description of my prompt',
arguments: [
{
name: 'param1',
description: 'Parameter description',
required: true,
},
],
},
};Add to the tools list in ListToolsRequestSchema handler and implement in CallToolRequestSchema handler.
Add resource files to the resources/ directory and register them in the ListResourcesRequestSchema and ReadResourceRequestSchema handlers.
This project is licensed under the MIT License - see the LICENSE file for details.
Md. Sazzad Hissain Khan
Contributions, issues, and feature requests are welcome!
Give a star if this project helped you understand MCP!
- MCP Servers - Official MCP server implementations
- MCP TypeScript SDK - TypeScript SDK for MCP
Made with care by Md. Sazzad Hissain Khan