Skip to main content
Glama

Example MCP Server

PROJECT_SUMMARY.md5.97 kB
# Project Completion Summary ## ✅ MCP Server Project Created Successfully Your complete Model Context Protocol (MCP) server is ready to use! ### What Was Generated A fully functional MCP server in Node.js + TypeScript with: - ✅ Proper project structure with TypeScript configuration - ✅ MCP stdio transport (JSON-RPC 2.0) - ✅ 2 sample tools: `ping` and `system_info` - ✅ Tool registry and handler dispatcher - ✅ Comprehensive error handling - ✅ Type-safe implementation - ✅ All source code compiled to JavaScript ### Project Structure ``` c:\Users\HP\Desktop\mcp\ ├── src/ │ ├── mcp/ │ │ └── server.ts (Main MCP server - 120 lines) │ ├── tools/ │ │ ├── ping.ts (Ping tool implementation) │ │ ├── system-info.ts (System info tool) │ │ └── registry.ts (Tool registry & dispatcher) │ ├── types/ │ │ └── index.ts (TypeScript type definitions) │ └── test-client.ts (Optional test client) ├── dist/ (Compiled JavaScript - ready to run) ├── package.json (Dependencies & scripts) ├── tsconfig.json (TypeScript configuration) ├── mcp.json (Claude Desktop manifest) ├── README.md (Full documentation) ├── QUICKSTART.md (Quick setup guide) ├── test-server.ps1 (PowerShell test script) └── .gitignore (Git configuration) ``` ### Files Created **Source Code (5 files)** - `src/mcp/server.ts` - Core MCP server (reads stdin, writes JSON-RPC responses) - `src/tools/ping.ts` - Ping tool ("pong" response) - `src/tools/system-info.ts` - System info tool (OS, CPU, memory, etc.) - `src/tools/registry.ts` - Tool registry with handler dispatcher - `src/types/index.ts` - TypeScript interfaces for MCP protocol **Configuration & Build (4 files)** - `package.json` - npm dependencies and build scripts - `tsconfig.json` - TypeScript compiler configuration - `mcp.json` - Claude Desktop integration manifest - `.gitignore` - Git ignore rules **Documentation (3 files)** - `README.md` - Complete reference documentation (570+ lines) - `QUICKSTART.md` - Quick setup and usage guide - `PROJECT_SUMMARY.md` - This file **Compiled Output** - `dist/` folder with all compiled `.js` files ready to run ### How to Use #### 1. Build & Run (Already Done!) ```bash npm install # Done ✅ npm run build # Done ✅ npm start # Ready to run ``` #### 2. Register with Claude Desktop Find your config file: - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` - **Linux**: `~/.config/Claude/claude_desktop_config.json` Add this entry: ```json { "mcpServers": { "example-mcp-server": { "command": "node", "args": ["C:\\Users\\HP\\Desktop\\mcp\\dist\\mcp\\server.js"], "env": {} } } } ``` Restart Claude Desktop, and Claude will have access to: - `ping` tool - `system_info` tool ### API Reference **Protocol**: JSON-RPC 2.0 over stdio **Available Methods** 1. `tools/list` - List all available tools ```json {"jsonrpc": "2.0", "id": 1, "method": "tools/list"} ``` 2. `tools/call` - Execute a tool ```json { "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "ping"} } ``` ### Tool Implementations #### ping - Input: None - Output: `"pong"` - Use: Connection test #### system_info - Input: None - Output: JSON with platform, arch, CPU count, memory, uptime, etc. - Use: Get system diagnostics ### Adding New Tools 1. Create `src/tools/my-tool.ts`: ```typescript export const myTool: Tool = { name: "my_tool", description: "What it does", inputSchema: { type: "object", properties: {}, required: [] } }; export const myToolHandler: ToolHandler = async (args) => { return { content: [{ type: "text", text: "Result" }] }; }; ``` 2. Register in `src/tools/registry.ts` 3. Rebuild: ```bash npm run build npm start ``` ### Build Scripts Available ```bash npm install # Install dependencies npm run build # Compile TypeScript → JavaScript npm start # Run the compiled server npm run dev # Run with ts-node (requires dev setup) ``` ### Key Features ✅ **MCP Compliant** - Follows Model Context Protocol specification ✅ **Stdio Transport** - Perfect for Claude Desktop local tools ✅ **Type Safe** - Full TypeScript with strict mode ✅ **Error Handling** - Proper JSON-RPC error codes and messages ✅ **Extensible** - Easy to add new tools ✅ **Well Documented** - README, QUICKSTART, and inline comments ✅ **Production Ready** - Source maps, error validation, clean architecture ### Testing Manual test command: ```bash # In terminal 1 npm start # In terminal 2 echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | node dist/mcp/server.js ``` PowerShell test script: ```bash .\test-server.ps1 ``` ### Next Steps 1. **Test locally**: `npm start` and send JSON-RPC messages 2. **Add tools**: Create new tools in `src/tools/` 3. **Register**: Add to Claude Desktop config 4. **Extend**: Modify MCP methods as needed ### Support & Documentation - See `README.md` for full API documentation - See `QUICKSTART.md` for quick reference - Check `src/types/index.ts` for TypeScript interfaces - Review tool examples in `src/tools/` ### Package Details - **Language**: TypeScript 5.3.3 - **Runtime**: Node.js 16+ - **Module System**: ES Modules - **Size**: Minimal dependencies (only TypeScript as dev dependency) - **License**: MIT --- **Status**: ✅ Ready to deploy and use with Claude Desktop Your MCP server is fully functional and can be immediately integrated with Claude Desktop for local tool access!

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/VIGNESH-2232005/mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server