loading…
Search for a command to run...
loading…
A comprehensive demonstration server that provides tools for calculations, weather, and note management alongside an interactive web interface. It showcases how
A comprehensive demonstration server that provides tools for calculations, weather, and note management alongside an interactive web interface. It showcases how AI assistants can seamlessly interact with external data sources and functions using the Model Context Protocol.
A comprehensive demonstration of the Model Context Protocol (MCP) - a standardized protocol that enables AI assistants to interact with external tools and data sources.
The Model Context Protocol is an open protocol that enables seamless integration between AI applications and external data sources. It provides:
This demo application showcases:
# Clone or navigate to the project directory
cd model-context-protocol
# Install dependencies
npm install
# Build the TypeScript code
npm run build
Start the interactive web interface:
npm run web
Then open your browser to:
http://localhost:3000
The web interface provides:
Run the demo client that showcases all features:
npm run client
This will:
Run just the MCP server (for integration with other clients):
npm run server
model-context-protocol/
├── src/
│ ├── server/
│ │ ├── index.ts # MCP server implementation
│ │ └── types.ts # TypeScript type definitions
│ ├── client/
│ │ └── index.ts # Demo client implementation
│ └── web/
│ ├── server.ts # Express web server
│ └── public/
│ └── index.html # Web interface
├── dist/ # Compiled JavaScript (after build)
├── package.json
├── tsconfig.json
└── README.md
npm run webhttp://localhost:3000 in your browser{
"tool": "calculate",
"arguments": {
"expression": "(10 + 5) * 2"
}
}
Result: 30
{
"tool": "get_weather",
"arguments": {
"location": "San Francisco",
"unit": "celsius"
}
}
Result: Weather data for San Francisco
{
"tool": "store_note",
"arguments": {
"title": "Project Ideas",
"content": "Build an MCP-powered application",
"tags": ["ideas", "projects", "mcp"]
}
}
Result: Note stored with unique ID
{
"tool": "retrieve_notes",
"arguments": {
"query": "project"
}
}
Result: All notes matching "project"
{
"tool": "generate_uuid",
"arguments": {}
}
Result: A new UUID like 550e8400-e29b-41d4-a716-446655440000
URI: mcp://demo/system-info
Returns current system stats including OS, memory, CPU info, and uptime.
URI: mcp://demo/notes-list
Returns all notes stored in the system.
The MCP server registers available tools and resources:
server.setRequestHandler(ListToolsRequestSchema, async () => ({
tools: [
{
name: "calculate",
description: "Perform mathematical calculations",
inputSchema: { /* JSON Schema */ }
}
]
}));
The client connects to the server via stdio transport:
const client = new Client({ name: "demo-client", version: "1.0.0" });
const transport = new StdioClientTransport({ command: "node", args: ["server.js"] });
await client.connect(transport);
The client discovers available capabilities:
const tools = await client.request({ method: "tools/list" }, ListToolsResultSchema);
The client calls a tool with parameters:
const result = await client.request({
method: "tools/call",
params: {
name: "calculate",
arguments: { expression: "2 + 2" }
}
}, CallToolResultSchema);
The client reads data resources:
const resource = await client.request({
method: "resources/read",
params: { uri: "mcp://demo/system-info" }
}, ReadResourceResultSchema);
npm run build
npm run dev
This will build and start the web interface.
npm run build - Compile TypeScript to JavaScriptnpm run server - Run the MCP servernpm run client - Run the demo clientnpm run web - Start the web interfacenpm run dev - Build and run web interfaceFunctions that can be executed by AI assistants. Each tool has:
Data sources that can be read. Each resource has:
mcp://demo/system-info)application/json)Pre-defined prompt templates that:
MIT
This is a demo application for learning purposes. Feel free to:
To build your own MCP server:
Built with ❤️ to demonstrate the power of Model Context Protocol
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"mcp-demo-application": {
"command": "npx",
"args": []
}
}
}