Mcp服务器基本示例
准备mcp服务器应用程序
1.安装软件包
pnpm install2.建造
pnpm buildMcp检查员
pnpm startpnpm inspectClaude桌面版
下载克劳德桌面版
设置桌面配置Claude
在VSCode中打开配置文件。
code ~/Library/Application\ Support/Claude/claude_desktop_config.json/用户/\[user\]/库/应用支持/Claude/Claude_desktop_config json
{
"mcpServers": {
"RandomNumber": {
"command": "node",
"args": ["/ABSOLUTE/PATH/TO/PARENT/FOLDER/build/index.js"]
}
}
}如果你使用 布置.
$ mise which node
/Users/[user]/.local/share/mise/installs/node/22.14.0/bin/node/用户/\[user\]/库/应用支持/Claude/Claude_desktop_config json
{
"mcpServers": {
"RandomNumber": {
"command": "/Users/[user]/.local/share/mise/installs/node/22.14.0/bin/node",
"args": ["/ABSOLUTE/PATH/TO/PARENT/FOLDER/build/index.js"]
}
}
}参考:https://github.com/modelcontextprotocol/servers/issues/64#issuecomment-2503152420
