Building and Connecting an MCP Server to Claude Desktop
说明与用途
构建并连接 MCP 服务器到 Claude Desktop,使开发者能够快速将外部资源和工具集成到 LLM 中,无需编写单独的适配器。
问题
Developers need a standardized way to expose external resources and tools to LLM hosts like Claude Desktop without writing custom adapters for each integration.
结果
After following the workflow, developers can run an MCP server locally or expose it publicly, register it with Claude Desktop, and leverage real‑time file access, memory, and tool invocation without writing custom adapters.
工作流
- 1. Install Claude Desktop and enable MCP/Extensions in settings.
- 2. Prepare a development environment (Node.js ≥16 or Python 3.10+, optional ngrok).
- 3. Clone the reference MCP servers from https://github.com/modelcontextprotocol/servers or create a new project folder.
- 4. If cloning, navigate to a server folder (e.g., memory), run
npm installandnpm run devto start the server (default http://localhost:3000). - 5. If creating a new server, run
npm init -y,npm install @modelcontextprotocol/server, and create aserver.jswith a minimal tool implementation. - 6. Start the server with
node server.jsand verify the manifest endpoint and tool response. - 7. Open Claude Desktop → Settings → Developer (or Connectors).
- 8. For local testing, locate or create
claude_desktop_config.jsonin the appropriate OS folder and add the server manifest URL or token. - 9. Grant any requested permissions in the client prompt.
- 10. Verify the server appears in the MCP/Extensions panel and can be used in prompts.
证据
MCP has moved quickly from concept to practical ecosystem: an open specification and multiple reference servers are available
Claude Desktop settings → Developer (or Connectors) to add a remote/local MCP server
- 记录日期: 2026-09-22T16:15:36.710Z