AutoFixture MCP服务器
模型上下文协议(MCP)服务器,为 汽车夹具 测试库。此服务器在Docker容器中运行,可以轻松地与VSCode、Cursor或Claude Desktop集成。
特性
- 快速入门指南:使用AutoFixture基础知识开始运行
- 方法搜索:搜索特定的AutoFixture方法及其用法
- 类信息:核心AutoFixture类的详细文档
- 包裹信息:所有AutoFixture扩展的NuGet包详细信息
- 使用模式:常见模式和代码示例
- 最佳实践:使用AutoFixture的推荐方法
- GitHub文档:直接从存储库获取最新文档
可用工具
- 快速启动:获取AutoFixture快速入门指南和基本使用示例
- 搜索方法:搜索AutoFixture方法(例如,“创建”、“构建”、“冻结”)
- 获取密码信息:获取有关“Fixture”或“IFixture”等课程的详细信息
- get_packages:按类别列出AutoFixture NuGet包(核心/模拟/测试/所有)
- get_usage_pattern:获取常见的使用模式(例如,“自定义”、“autoaq”、“xunit”)
- get_best_pactics:获取AutoFixture最佳实践和建议
- fetch_github_docs:从GitHub获取最新文档(README、备忘单、常见问题解答)
先决条件
- Docker已安装在您的系统上
- Node.js 20+(用于本地开发)
- VSCode、光标或克劳德桌面
快速设置
选项1:使用Docker(推荐)
- 构建Docker镜像:
docker build -t autofixture-mcp-server:latest .- 测试服务器:
docker run --rm -i autofixture-mcp-server:latest选项2:使用Docker Compose
docker-compose up -d与游标/VCode集成
光标设置
- 打开光标设置(Cmd+Shift+P→ “首选项:打开用户设置(JSON)”)
- 添加MCP服务器配置:
{
"mcp": {
"servers": {
"autofixture": {
"command": "/Users/admin/dev/mcp/mcp-wrapper.sh"
}
}
}
}或者使用提供的配置文件:
# Copy the configuration
cat cursor-mcp-config.json
# Add to your Cursor settings带克劳德代码的VSCode
- 安装Claude Code扩展
- 打开MCP配置文件:
- 在macOS上: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - 在Linux上: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - 在Windows上: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
- 添加服务器配置:
{
"mcpServers": {
"autofixture": {
"command": "/Users/admin/dev/mcp/mcp-wrapper.sh",
"args": [],
"env": {}
}
}
}Claude桌面设置
- 打开克劳德桌面设置:
- 在macOS上: ~/Library/Application Support/Claude/claude_desktop_config.json - 在Windows上: %APPDATA%\Claude\claude_desktop_config.json - 在Linux上: ~/.config/Claude/claude_desktop_config.json
- 添加服务器配置:
{
"mcpServers": {
"autofixture": {
"command": "/Users/admin/dev/mcp/mcp-wrapper.sh",
"args": [],
"env": {}
}
}
}- 重新启动克劳德桌面
地方发展设置
如果您想在本地开发或修改服务器:
- 安装依赖项:
npm install- 构建项目:
npm run build- 在本地运行(不使用Docker):
npm start- 自动重建开发模式:
npm run dev用法示例
集成后,您可以在对话中使用MCP服务器:
示例1:入门
User: "Use the autofixture MCP to show me how to get started with AutoFixture"
AI: [Calls get_quick_start tool and provides quick start guide]示例2:搜索方法
User: "Search for methods related to creating objects in AutoFixture"
AI: [Calls search_methods with query "create" and shows available methods]示例3:获取使用模式
User: "Show me how to use AutoFixture with xUnit"
AI: [Calls get_usage_pattern with pattern "xunit" and provides examples]示例4:包装信息
User: "What AutoFixture packages are available for mocking?"
AI: [Calls get_packages with category "mocking" and lists all mocking packages]配置文件
mcp-config.json:通用MCP配置cursor-mcp-config.json:光标特定配置claude_desktop_config.json:Claude桌面配置docker-compose.yml:Docker编写配置mcp-wrapper.sh:用于Docker集成的Shell脚本包装器
故障排除
服务器未启动
- 确保Docker正在运行:
docker ps - 检查Docker日志:
docker logs autofixture-mcp-server - 重建映像:
docker build -t autofixture-mcp-server:latest .
包装器脚本的权限问题
chmod +x mcp-wrapper.sh游标/VCode未检测到服务器
- 添加配置后重新启动编辑器
- 检查包装器脚本路径是否为绝对路径
- 验证Docker是否已安装:
docker --version
手动测试服务器
# Run the wrapper script directly
./mcp-wrapper.sh
# Or use Docker directly
docker run --rm -i autofixture-mcp-server:latest项目结构
.
├── src/
│ └── index.ts # Main MCP server implementation
├── dist/ # Compiled JavaScript (generated)
├── Dockerfile # Docker image configuration
├── docker-compose.yml # Docker Compose setup
├── mcp-wrapper.sh # Shell wrapper for Docker
├── package.json # Node.js dependencies
├── tsconfig.json # TypeScript configuration
├── mcp-config.json # Generic MCP config
├── cursor-mcp-config.json # Cursor-specific config
├── claude_desktop_config.json # Claude Desktop config
└── README.md # This file建筑
服务器是使用以下方式构建的:
- TypeScript:类型安全服务器实现
- @模型上下文协议/sdk:官方MCP SDK
- 轴:用于获取GitHub文档的HTTP客户端
- 再见:HTML解析(用于未来的增强)
- 码头工人:容器化,便于部署
贡献
请随时使用其他工具扩展服务器:
- 在中添加新的工具定义
ListToolsRequestSchema处理器 - 在中实现工具逻辑
CallToolRequestSchema处理器 - 重建Docker镜像
许可证
麻省理工学院
资源
版本
1.0.0
______________________________________________________________________
使用MCP构建,通过AutoFixture增强AI辅助开发。
