A simple Model Context Protocol (MCP) server built with the official TypeScript SDK that demonstrates the three MCP primitives: Tools, Resources, and Prompts.
Model Context Protocol is an open protocol by Anthropic that standardizes how LLMs connect to external tools and data sources. Think of it as USB-C for AI integrations — build once, works with any MCP-compatible host (Claude Desktop, Cursor, OpenClaw, etc.).
┌─────────────┐ JSON-RPC ┌──────────────────┐
│ MCP Host │ ◄──────────► │ MCP Server │
│ (LLM app) │ stdio/SSE │ (this project) │
└─────────────┘ └──────────────────┘
| Primitive | Purpose | Example in this server |
|---|---|---|
| Tools | Functions the LLM can invoke | get_system_info, generate_password, convert_timestamp |
| Resources | Data the LLM can read | config://server |
| Prompts | Reusable prompt templates | summarize-system |
Returns current system info: hostname, platform, CPU, memory, uptime, load average.
Generate a random cryptographically-secure password.
Parameters:
length(4-128, default 16)uppercase(default true)lowercase(default true)numbers(default true)symbols(default false)
Convert between Unix timestamp and human-readable date.
Parameters:
value— Unix timestamp (number) or ISO date string
# Install dependencies
npm install
# Run the server (stdio transport)
npm start
# Or use the MCP Inspector for testing
npm run inspectAdd to your claude_desktop_config.json:
{
"mcpServers": {
"system-info": {
"command": "node",
"args": ["/path/to/mcp-example-server/index.js"]
}
}
}Add to your openclaw.json under mcp.servers:
{
"mcp": {
"servers": {
"system-info": {
"command": "node",
"args": ["index.js"],
"cwd": "/path/to/mcp-example-server"
}
}
}
}MIT