内容
# mcp-tools
该仓库作为一个示例,展示如何使用 Go 或 Python 定义自己的 MCP 服务器。
## 快速开始
### MCP 服务器 JSON 路径
- `~/Library/Application Support/Claude/claude_desktop_config.json`
- `~/.cursor/mcp.json`
### Go
从一个包含 `go` 二进制文件的 shell 中运行 neovim/claude desktop/vscode/cursor。
#### 本地
```json
{
"mcpServers": {
"github.com/fredrikaverpil/mcp-tools": {
"command": "go",
"args": [
"-C",
"/absolute/path/to/mcp-tools",
"run",
"./cmd/cmd-tools/main.go"
]
}
}
}
```
#### 非本地
```json
{
"mcpServers": {
"github.com/fredrikaverpil/mcp-tools": {
"command": "go",
"args": [
"run",
"github.com/fredrikaverpil/mcp-tools/cmd/cmd-tools@latest"
]
}
}
}
```
### Python
从一个包含 `uv` 二进制文件的 shell 中运行 neovim/claude desktop/vscode/cursor,并且需要在 `pyproject.toml` 中指定所需的依赖项。
#### 本地
```sh
cd mcp-tools
# 安装 uv(如果尚未安装),macOS 示例
brew install uv
# 安装依赖项
uv sync
```
将以下内容添加到 MCP 服务器 JSON 设置中(路径取决于您使用的应用程序):
```json
{
"mcpServers": {
"github.com/fredrikaverpil/mcp-tools": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/mcp-tools", "run", "server.py"]
}
}
}
```
## 参考资料
- [MCP 文档](https://modelcontextprotocol.io)
- [MCP GitHub 组织](https://github.com/modelcontextprotocol)
- [MCP 服务器](https://github.com/modelcontextprotocol/servers)
- [非官方 Go 实现](https://github.com/mark3labs/mcp-go)
- [官方 Python SDK](https://github.com/modelcontextprotocol/python-sdk)