MCP Development Environment
Provides a Docker-based development environment with Python and Node.js MCP servers, enabling file operations, SQL queries, Redis caching, and debugging for building and testing MCP servers.
README
MCP Development Environment
A comprehensive Docker-based development environment for building and testing Model Context Protocol (MCP) servers.
🎯 What's Included
Core Services:
- Python MCP Server (Port 8000) - Full-featured implementation with debugging
- Node.js MCP Server (Port 3000) - Alternative implementation
- PostgreSQL (Port 5432) - Database with sample data
- Redis (Port 6379) - Caching layer
- Nginx File Server (Port 8080) - Static file serving with CORS
Development Features:
- Hot reloading for both Python and Node.js
- Built-in debugger support (Python: 5678, Node.js: 9229)
- Comprehensive logging and monitoring
- Pre-configured testing frameworks
- Sample data and schemas
- Code quality tools (linting, formatting, type checking)
🚀 Quick Start
- Setup the environment:
# Make the setup script executable and run it
chmod +x setup.sh
./setup.sh
- Verify everything is working:
# Check service status
docker-compose ps
# Test endpoints
curl http://localhost:8080/health # File server
curl http://localhost:8000/health # Python MCP server
curl http://localhost:3000/health # Node.js MCP server
- Start developing:
# Edit the Python MCP server
vim src/main.py
# View logs in real-time
docker-compose logs -f mcp-server
# Run tests
docker-compose exec mcp-server python -m pytest
🔧 Key Features of the MCP Servers
Available Tools:
write_file- Write content to filesexecute_sql- Run database queriescache_set/get- Redis cache operationslist_directory- Browse file systemanalyze_data- Basic data analysis on CSV files
Resources:
- File system access to
/datadirectory - Database table schemas and sample data
- Configuration files and documentation
Sample Usage:
# The Python server provides tools for:
await mcp_server.call_tool("write_file", {
"path": "analysis.txt",
"content": "Sample analysis results"
})
await mcp_server.call_tool("execute_sql", {
"query": "SELECT * FROM users WHERE department = $1",
"parameters": ["Engineering"]
})
🐛 Debugging Setup
Python (VSCode):
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"connect": {"host": "localhost", "port": 5678},
"pathMappings": [
{"localRoot": "${workspaceFolder}/src", "remoteRoot": "/app/src"}
]
}
Node.js (Chrome DevTools):
- Open
chrome://inspect - Connect to
localhost:9229
📊 Monitoring & Logs
# View all service logs
docker-compose logs -f
# Monitor specific service
docker-compose logs -f mcp-server
# Check resource usage
docker stats
# Database operations
docker-compose exec postgres psql -U mcp_user -d mcp_dev
# Redis operations
docker-compose exec redis redis-cli
🛠️ Development Workflow
The environment supports both transport methods:
- stdio (default) - For direct MCP client integration
- HTTP/WebSocket - For web-based development and testing
You can easily switch between implementations or run both simultaneously for comparison and testing.
🗂️ Project Structure
mcp/
├── src/ # Python MCP server source
│ └── main.py # Main Python server implementation
├── src-node/ # Node.js MCP server source
│ └── server.js # Main Node.js server implementation
├── db/ # Database initialization scripts
│ ├── init.sql # Schema and tables
│ └── sample_data.sql # Sample data
├── data/ # Data files (mounted to containers)
├── static/ # Static files served by Nginx
├── tests/ # Test suites
├── .vscode/ # VSCode debug configuration
├── docker-compose.yml # Service definitions
├── python.Dockerfile # Python server container
├── node.Dockerfile # Node.js server container
├── nginx.conf # Nginx configuration
├── setup.sh # Setup and management script
└── README.md # This file
🔧 Management Commands
The setup.sh script provides convenient management:
./setup.sh setup # Initial setup and start (default)
./setup.sh start # Start services
./setup.sh stop # Stop services
./setup.sh restart # Restart services
./setup.sh status # Show service status
./setup.sh logs # Show service logs
./setup.sh clean # Remove everything (with confirmation)
./setup.sh help # Show help
🧪 Testing
Both Python and Node.js servers include comprehensive test suites:
# Run Python tests
docker-compose exec mcp-server python -m pytest tests/ -v
# Run Node.js tests
docker-compose exec mcp-server-node npm test
# Run tests with coverage
docker-compose exec mcp-server python -m pytest tests/ --cov=src
🔍 Database Schema
The PostgreSQL database includes several sample tables:
users- User accounts with departments and rolesproducts- Product catalog with categories and inventoryorders- Order history with status trackingorder_items- Order line itemsanalytics_events- Event tracking dataapp_config- Application configuration
📡 API Endpoints
File Server (Port 8080):
GET /health- Health checkGET /data/- Browse data directoryGET /static/- Browse static filesGET /api/docs- API documentation
Python MCP Server (Port 8000):
GET /health- Health check- MCP protocol via stdio transport
Node.js MCP Server (Port 3000):
GET /health- Health check- MCP protocol via stdio transport
🚨 Troubleshooting
Services not starting:
- Check Docker is running:
docker info - Check port conflicts:
netstat -tulpn | grep :8000 - View startup logs:
docker-compose logs
Database connection issues:
# Test database connectivity
docker-compose exec postgres pg_isready -U mcp_user
# Connect to database manually
docker-compose exec postgres psql -U mcp_user -d mcp_dev
Redis connection issues:
# Test Redis connectivity
docker-compose exec redis redis-cli ping
Debug not working:
- Ensure debug ports (5678, 9229) are not in use
- Check firewall settings
- Verify VSCode debug configuration matches container setup
🤝 Contributing
- Fork the repository
- Make changes in your environment
- Test thoroughly with provided test suites
- Submit a pull request
📄 License
This project is provided as-is for development and testing purposes.
This environment gives you a complete MCP development platform with real databases, caching, file systems, and debugging tools - perfect for building and testing production-ready MCP servers!
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。