MCP AI POC
Provides AI-powered development tools including code generation, refactoring, debugging, performance optimization, and test generation, along with smart prompts for code analysis and documentation, and a built-in knowledge base of coding best practices.
README
MCP AI POC (Still in progress)
MCP (Model Context Protocol) Server with AI-powered development tools and resources.
What This Project Provides
This project provides a comprehensive MCP server that offers:
🛠️ AI-Powered Tools
- Code Generation: Generate production-ready code from specifications
- Code Refactoring: Improve existing code for better maintainability, performance, or readability
- Debugging Assistant: Analyze and fix code issues with detailed explanations
- Performance Optimization: Identify bottlenecks and optimize code performance
- Test Generation: Create comprehensive unit tests for any codebase
📋 Smart Prompts
- Code Analysis: Deep analysis for quality, security, and best practices
- Documentation Generation: Auto-generate docs in multiple styles (Google, Sphinx, NumPy)
- Code Review: Comprehensive reviews with focus on specific areas
- Concept Explanation: Explain programming concepts at different skill levels
📚 Knowledge Resources
- Python Coding Guidelines: Best practices and style guides
- Design Patterns Reference: Common patterns with examples
- Security Best Practices: Security guidelines and vulnerability prevention
- Performance Optimization Guide: Strategies for faster, more efficient code
Quick Start
1. Installation
# Clone and set up the project
git clone <your-repo-url>
cd mcp-ai-poc
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
pip install -r dev-requirements.txt # For development and testing
# Install in editable mode
pip install -e .
2. Set Up Environment
# Set your OpenAI API key
export OPENAI_API_KEY="your-api-key-here"
3. Run as MCP Server
# Start MCP server
python src/run.py
# or
python -m mcp_poc.standalone_server
4. Run Tests (Optional)
# Run all tests
pytest
# Run with verbose output
pytest -v
# Run specific test file
pytest src/tests/test_server.py
MCP Integration
Using with MCP-Compatible Clients
This server implements the Model Context Protocol and can be used with any MCP-compatible client like Claude Desktop, etc.
Configuration Example
Add to your MCP client configuration:
{
"mcpServers": {
"mcp-ai-poc": {
"command": "python",
"args": ["/path/to/mcp-ai-poc/src/run.py"],
"env": {
"OPENAI_API_KEY": "your-api-key-here"
}
}
}
}
Available MCP Capabilities
Tools:
generate_code- Generate code from specificationsrefactor_code- Refactor existing codedebug_code- Debug and fix code issuesoptimize_performance- Optimize code performancegenerate_tests- Generate unit tests
Prompts:
analyze_code- Comprehensive code analysisgenerate_documentation- Create documentationcode_review- Perform code reviewsexplain_concept- Explain programming concepts
Resources:
coding-guidelines://python- Python best practicespatterns://design-patterns- Design patterns referencesecurity://best-practices- Security guidelinesperformance://optimization-guide- Performance tips
Key Features
🚀 Comprehensive MCP Server
This project provides a full-featured MCP server with production-ready capabilities:
🔧 Architecture
- Standalone Server: No external MCP dependencies required
- JSON-RPC Protocol: Implements MCP's communication protocol
- Modular Design: Separate modules for AI tools, server logic, and utilities
- Error Handling: Robust error handling for production use
- Comprehensive Testing: Full test suite with pytest for reliability
💡 Practical AI Tools
Each tool is designed to solve real development problems:
- Code Generation: Handles specifications with context awareness
- Refactoring: Focuses on specific goals (performance, readability, etc.)
- Debugging: Provides root cause analysis and fixes
- Optimization: Identifies bottlenecks with trade-off analysis
- Testing: Generates comprehensive test suites
📖 Rich Knowledge Base
Built-in resources provide instant access to:
- Coding standards and best practices
- Security guidelines
- Performance optimization strategies
- Design pattern references
Use Cases
For Individual Developers
- Code Review: Get instant feedback on your code
- Learning: Understand concepts and best practices
- Debugging: Get help with tricky bugs
- Documentation: Generate docs automatically
For Teams
- Consistency: Enforce coding standards across the team
- Knowledge Sharing: Built-in best practices and patterns
- Code Quality: Automated analysis and suggestions
- Onboarding: Help new team members learn patterns
For AI Assistants
- Enhanced Capabilities: Provide AI assistants with powerful development tools
- Context-Aware Help: Tools understand programming context
- Structured Responses: Well-formatted, actionable output
- Resource Access: Built-in knowledge base for common questions
Project Structure
src/
├── mcp_poc/ # Main package
│ ├── __init__.py # Package initialization
│ ├── app.py # Main application (chat + server entry)
│ ├── ai_tools.py # OpenAI client and utilities
│ ├── standalone_server.py # MCP server implementation
│ └── mcp_server.py # Alternative MCP server (requires mcp package)
├── tests/ # Test suite
│ ├── test_app.py # Application tests
│ └── test_server.py # MCP server tests
└── run.py # Main entry point
Configuration & Dependencies:
├── requirements.txt # Runtime dependencies
├── dev-requirements.txt # Development and testing dependencies
├── pyproject.toml # Project configuration and build settings
└── mcp_config.json # MCP client configuration example
Documentation: # Comprehensive docs
├── docs/
│ ├── CONTEXT.md # Project overview
│ ├── ARCHITECTURE.md # Technical details
│ ├── API.md # API reference
│ ├── DEVELOPMENT.md # Development guide
│ ├── EXAMPLES.md # Usage examples
│ └── TROUBLESHOOTING.md # Common issues
└── README.md # This file
Documentation
For AI Assistants
- 📋 Project Context - High-level overview and AI guidelines
- 🏗️ Architecture - Code structure and design patterns
- 📚 API Reference - Detailed function and class documentation
For Developers
- 🛠️ Development Guide - Setup, testing, and contribution guidelines
- 💡 Examples - Usage examples and integration patterns
- 🐛 Troubleshooting - Common issues and solutions
Enhanced Features
🎯 Intelligent Code Analysis
- Multi-dimensional code quality assessment
- Security vulnerability detection
- Performance bottleneck identification
- Best practice recommendations
🔄 Context-Aware Refactoring
- Goal-specific refactoring (performance, readability, maintainability)
- Language-specific optimizations
- Preservation of functionality
- Clear change explanations
🐛 Advanced Debugging
- Root cause analysis
- Step-by-step problem breakdown
- Fixed code with explanations
- Prevention strategies
⚡ Performance Optimization
- Algorithmic improvements
- Memory usage optimization
- Concurrency recommendations
- Trade-off analysis
🧪 Comprehensive Testing
- Framework-specific test generation
- Edge case coverage
- Multiple testing strategies
- Production-ready test code
Next Steps for Further Enhancement
1. Add More Tools
- API Documentation Generator: Auto-generate API docs
- Database Query Optimizer: Optimize SQL queries
- Dependency Analyzer: Analyze and update dependencies
- Code Complexity Analyzer: Measure and reduce complexity
2. Enhanced Resources
- Framework-Specific Guides: React, Django, FastAPI guides
- Language References: Support for more programming languages
- Architecture Patterns: Microservices, event-driven, etc.
- DevOps Best Practices: CI/CD, deployment, monitoring
3. Integration Features
- Git Integration: Analyze commits, generate changelogs
- IDE Plugins: VS Code, IntelliJ extensions
- CI/CD Integration: Automated code analysis in pipelines
- Slack/Teams Bots: Team collaboration features
4. Advanced AI Features
- Multi-Model Support: Support for different AI models
- Custom Training: Fine-tune models for specific codebases
- Code Similarity Detection: Find similar code patterns
- Automated Testing: AI-generated integration tests
This enhanced MCP server transforms your simple chat client into a powerful development assistant that can be integrated into any MCP-compatible environment, providing immediate value to developers and AI assistants alike.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。