我为克劳德桌面定制的MCP服务器
此存储库包含两个专为与Claude Desktop一起使用而设计的模型上下文协议(MCP)服务器:
Github_Server.py:提供与GitHub API交互的工具。Obsidian_Server.py:提供与本地黑曜石保险库交互的工具。
先决条件
- python 确保您已安装Python 3.8+,并且在系统的PATH中可用。
- 克劳德桌面: 你一定有 Claude桌面应用程序 安装。
- Python包: 强烈建议使用虚拟环境。
# Create and activate a virtual environment (e.g., venv)
python -m venv .venv
# On Windows: .venv\Scripts\activate
# On macOS/Linux: source .venv/bin/activate
# Install dependencies
pip install -r requirements.txt- API键和路径:
- A. GitHub个人访问令牌(PAT) 随着 repo 范围。 - 通往你的绝对之路 黑曜石金库 目录。
安装说明
要将这些服务器与ClaudeDesktop一起使用,您必须创建一个本地配置文件,该文件指向这些脚本并提供您的个人路径和API密钥。
此配置文件包含机密,不得提交给版本控制。
步骤1:找到您的Claude配置目录
在您的系统上找到Claude Desktop配置目录:
- 窗户:
%APPDATA%\Claude\(通常决定C:\Users\YourUsername\AppData\Roaming\Claude\) - macOS:
~/Library/Application Support/Claude/
第二步:创建 claude_desktop_config.json
- 在Claude配置目录中,创建一个名为
claude_desktop_config.json如果它还不存在。 - 复制的全部内容
config.template.json此存储库中的文件。 - 将内容粘贴到新的
claude_desktop_config.json文件。
步骤3:替换本地文件中的所有占位符
编辑您的本地 claude_desktop_config.json 并替换所有占位符(``)与您的实际信息。
占位符示例:
- **`
`**:
- 通过激活您的虚拟环境并运行以下命令来实现: - where python (Windows) - which python (macOS/Linux) - 示例(Windows): "C:\\Users\\Harsh\\projects\\your-mcp-project\\.venv\\Scripts\\python.exe"
- ``:
- 示例(Windows): "C:\\Users\\Harsh\\projects\\your-mcp-project" - 使用 双睫毛(\\) JSON格式。
"YOUR_GITHUB_PERSONAL_ACCESS_TOKEN_HERE":
- 将其替换为您的实际GitHub PAT。 - 例子: "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx"
- ``:
- 示例(Windows): "C:\\Users\\Harsh\\Documents\\MyObsidianVault"
步骤4:保存并重新启动
- 将更改保存到
claude_desktop_config.json. - 完全退出并重新启动Claude Desktop 加载新的服务器配置。
- 如果成功,两台服务器都将出现在Claude聊天的“搜索和工具”部分。
填写的期末考试示例 claude_desktop_config.json (不要承诺这一点)
{
"mcpServers": {
"MyGitHubServer": {
"command": "C:\\Users\\Harsh\\projects\\your-mcp-project\\.venv\\Scripts\\python.exe",
"args": [
"C:\\Users\\Harsh\\projects\\your-mcp-project\\Github_Server.py"
],
"env": {
"GITHUB_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"PYTHONUNBUFFERED": "1"
},
"cwd": "C:\\Users\\Harsh\\projects\\your-mcp-project"
},
"MyObsidianServer": {
"command": "C:\\Users\\Harsh\\projects\\your-mcp-project\\.venv\\Scripts\\python.exe",
"args": [
"C:\\Users\\Harsh\\projects\\your-mcp-project\\Obsidian_Server.py"
],
"env": {
"VAULT_PATH": "C:\\Users\\Harsh\\Documents\\MyObsidianVault",
"PYTHONUNBUFFERED": "1"
},
"cwd": "C:\\Users\\Harsh\\projects\\your-mcp-project"
}
}
}