用于全栈开发的MCP服务器
一系列全面的模型上下文协议(MCP)服务器,旨在通过Claude Desktop增强您的开发工作流程。这些服务器使Claude能够与您的数据库、Git存储库、API、Docker容器和开发工具进行交互。
 ](https://nodejs.org/)
🚀 特性
📦 可用服务器
- 文件系统服务器 -文件操作和代码导航
- 数据库服务器 -PostgreSQL和MySQL管理
- Git服务器 -存储库操作和历史分析
- API测试服务器 -REST API测试和验证
- DevTools服务器 -Docker、日志和系统监控
📋 先决条件
- Node.js v18或更高版本
- Claude桌面应用程序
- Docker(可选,适用于DevTools服务器)
- PostgreSQL/MySQL(可选,用于数据库服务器)
🛠️ 安装
快速设置
# Clone the repository
git clone https://github.com/yourusername/mcp-servers.git
cd mcp-servers
# Install dependencies
npm install
# Run the setup script
chmod +x setup.sh
./setup.sh手动设置
- 再进行
npm install- 配置Claude桌面
创建或编辑: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)或 %APPDATA%/Claude/claude_desktop_config.json (Windows)
{
"mcpServers": {
"filesystem": {
"command": "node",
"args": ["/absolute/path/to/server.js"]
},
"database": {
"command": "node",
"args": ["/absolute/path/to/database-server.js"],
"env": {
"PG_HOST": "localhost",
"PG_PORT": "5432",
"PG_DATABASE": "your_database",
"PG_USER": "your_user",
"PG_PASSWORD": "your_password"
}
},
"git": {
"command": "node",
"args": ["/absolute/path/to/git-server.js"]
},
"api-testing": {
"command": "node",
"args": ["/absolute/path/to/api-testing-server.js"]
},
"devtools": {
"command": "node",
"args": ["/absolute/path/to/devtools-server.js"]
}
}
}- 重新启动克劳德桌面
📖 服务器文档
1.文件系统服务器
提供用于读取、写入和导航代码库的文件系统操作。
可用工具:
read_file-读取文件内容write_file-将内容写入文件list_directory-列出目录内容
示例用法:
Claude: "Read the contents of src/App.js"
Claude: "List all files in the components directory"
Claude: "Create a new file called utils.js with helper functions"______________________________________________________________________
2.数据库服务器
直接通过Claude管理PostgreSQL和MySQL数据库。
可用工具:
execute_query-运行SQL查询get_schema-检索表架构get_table_stats-获取数据库统计信息generate_migration-创建迁移脚本
示例用法:
Claude: "Show me all tables in my PostgreSQL database"
Claude: "Get the schema for the users table"
Claude: "Query all orders from the last 7 days"
Claude: "Generate a migration to add email column to users table"配置: 在Claude配置中设置这些环境变量:
PG_HOST,PG_PORT,PG_DATABASE,PG_USER,PG_PASSWORD(PostgreSQL)MYSQL_HOST,MYSQL_PORT,MYSQL_DATABASE,MYSQL_USER,MYSQL_PASSWORD(MySQL)
______________________________________________________________________
3.Git服务器
与Git存储库交互以进行版本控制操作。
可用工具:
git_status-获取存储库状态git_log-查看提交历史记录git_diff-显示差异git_branches-列出分支generate_commit_message-自动生成提交消息git_blame-逐行显示作者身份git_search_commits-搜索提交历史记录
示例用法:
Claude: "Show me the git status of /path/to/my/project"
Claude: "Get the last 20 commits with their authors"
Claude: "Show me what changed in the last commit"
Claude: "Generate a commit message for my staged changes"
Claude: "Who last modified line 50 of app.js"______________________________________________________________________
4.API测试服务器
使用全面的测试功能测试和验证REST API。
可用工具:
http_request-发出HTTP请求test_endpoint-运行测试场景generate_test_cases-自动生成测试用例performance_test-负载测试validate_response-架构验证
示例用法:
Claude: "Test my API at http://localhost:3000/api/users with a GET request"
Claude: "Run a performance test on my health check endpoint with 50 requests"
Claude: "Generate test cases for my /api/products POST endpoint"
Claude: "Validate this response against my JSON schema"______________________________________________________________________
5.DevTools服务器
管理Docker容器、监控日志和运行开发工具。
可用工具:
docker_ps-列出容器docker_logs-查看容器日志docker_exec-在容器中执行命令docker_compose-管理Docker编写docker_stats-资源使用统计run_command-执行shell命令monitor_logs-尾部日志文件check_ports-检查端口使用情况npm_scripts-列出并运行npm脚本
示例用法:
Claude: "Show me all running Docker containers"
Claude: "Get the last 100 lines from the 'web' container logs"
Claude: "Check what process is using port 3000"
Claude: "List all npm scripts in /path/to/project"
Claude: "Restart my docker-compose services"🎯 用例
面向全栈开发人员
晨间例行:
Claude: "Show me all running Docker containers"
Claude: "Get git status of my main project"
Claude: "Show me database table statistics"调试:
Claude: "Check the last 200 lines of the API container logs"
Claude: "Show me recent commits by John Doe"
Claude: "Query failed login attempts from the last hour"API开发:
Claude: "Test my new /api/auth endpoint"
Claude: "Generate test cases for user registration"
Claude: "Run performance tests on the search endpoint"代码审查:
Claude: "Show me the diff for the last 3 commits"
Claude: "Who last modified the authentication module?"
Claude: "Read all TypeScript files in the services directory"🔧 发展
测试单个服务器
# Test filesystem server
node server.js
# Test database server
node database-server.js
# Test git server
node git-server.js
# Test API testing server
node api-testing-server.js
# Test devtools server
node devtools-server.js添加自定义工具
每台服务器都遵循相同的模式:
// Add to ListToolsRequestSchema
{
name: "your_tool_name",
description: "Tool description",
inputSchema: {
type: "object",
properties: {
// your parameters
},
required: ["param1"]
}
}
// Add to CallToolRequestSchema
case "your_tool_name": {
// your implementation
return {
content: [{
type: "text",
text: "result"
}]
};
}🤝 贡献
欢迎投稿!请按照以下步骤操作:
- 分叉存储库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
🐛 故障排除
服务器未连接
- 检查节点版本
node --version # Should be v18 or higher- 手动验证服务器
node server.js # Should output: "Server running on stdio"- 检查Claude桌面配置
- 确保路径是绝对的 - 验证Node.js路径是否正确 - 检查JSON语法错误
- 查看日志
- 打开Claude桌面开发人员设置 - 点击“打开日志文件夹” - 检查特定于服务器的日志文件
常见错误
“SyntaxError:意外标记”
- 将Node.js更新到v18或更高版本
- 确保
"type": "module"在package.json中
“找不到模块”
- 跑
npm install在项目目录中 - 检查是否安装了所有依赖项
“权限被拒绝”
- 确保执行权限:
chmod +x setup.sh - 检查日志文件的文件系统权限
数据库连接失败
- 验证配置中的数据库凭据
- 确保数据库服务器正在运行
- 检查网络连接
📝 许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
🙏 致谢
📞 支持
🗺️ 路线图
- \[\]添加MongoDB支持
- \[\]Redis集成
- \[\]Kubernetes工具
- \[\]AWS/云提供商集成
- \[\]CI/CD管道工具
- \[\]松弛/不协调通知
- \[\]使用AI进行高级日志分析
- \[\]性能监控仪表板
______________________________________________________________________
由以下材料制成❤️ 面向开发者社区
*如果你觉得这有用,请⭐ 将存储库星化!*
