高级代码分析MCP服务器
🚀 具有知识图和AI洞察力的高级代码分析系统
一个复杂的MCP服务器,结合了Neo4j知识图、人工智能分析和大型代码项目的高级静态分析。
✨ 主要特点
- 🧠 AI驱动的分析 与GPT-4/Claude一起获得高级见解
- 📊 高级知识图谱 使用Neo4j处理复杂关系
- 🔍 自然语言查询 没有学习曲线
- 🏗️ 深度架构分析
- ⚡ 并行处理 对于大型项目
- 🛡️ 自动化安全分析
- 📈 综合质量指标
🎯 绩效目标
- 最多1000万行代码 不到30分钟
- 10+并发分析
- 查询响应时间\<1秒 对于大多数查询
- 95%以上的准确率 实体与关系检测
🚀 快速设置
系统要求
- Node.js 18+
- Docker&Docker编写
- 8GB+内存
- 100GB+磁盘空间
使用Docker进行设置
# Clone the project
git clone https://github.com/ItamarZand88/advanced-code-analysis-mcp.git
cd advanced-code-analysis-mcp
# Setup environment configuration
cp .env.example .env
# Edit .env with your settings
# Run the system
docker-compose up -d
# Check status
curl http://localhost:3000/health本地安装
# Install dependencies
npm install
# Build the project
npm run build
# Run in development
npm run dev
# Run in production
npm start📖 基本用法
存储库分析
import { MCPServer } from './dist/index.js';
const server = new MCPServer();
// Start analysis
const result = await server.analyzeRepository(
'https://github.com/microsoft/vscode',
'main',
{
includeTests: true,
enableAIInsights: true,
parallelWorkers: 8
}
);
console.log(`Job ID: ${result.jobId}`);自然语言查询
// Example queries
const queries = [
'Show me the most complex functions in the system',
'Find circular dependencies',
'Which files are missing tests?',
'Show me potential security vulnerabilities',
'What are the main architectural patterns?'
];
for (const query of queries) {
const result = await server.queryGraph(query, graphId);
console.log(result.interpretation);
}高级API
// Complexity analysis
const complexity = await server.getComplexityAnalysis(graphId);
// Dependency analysis
const dependencies = await server.getDependencyAnalysis(graphId);
// Quality assessment
const quality = await server.getQualityMetrics(graphId);
// Security analysis
const security = await server.getSecurityAnalysis(graphId);🔧 高级配置
分析设置
// .env
MAX_CONCURRENT_ANALYSES=10
PARALLEL_WORKERS=16
MAX_FILE_SIZE=50485760 // 50MB
INCLUDE_TESTS=true
ENABLE_AI_INSIGHTS=trueAI配置
AI_PROVIDER=openai
AI_MODEL=gpt-4
OPENAI_API_KEY=your_key_here
ANTHROPIC_API_KEY=your_key_hereNeo4j配置
NEO4J_URI=bolt://localhost:7687
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=secure_password
NEO4J_DATABASE=codeanalysis📊 监控和指标
- Neo4j浏览器: http://localhost:7474
- Grafana仪表板: http://localhost:3001(管理员/管理员)
- 普罗米修斯指标: http://localhost:9091
- 健康检查: http://localhost:3000/health
🎨 使用示例
1.企业代码审核
Analyze our main system for security issues and code smells2.开发人员入职培训
Show me the core components and how they interact3.重构规划
Find the most tightly coupled components and suggest where to break dependencies4.性能分析
Find bottlenecks and inefficient algorithms🛠️ 发展
运行测试
npm test
npm run test:watch
npm run test:coverage代码质量和Linting
npm run lint
npm run lint:fix
npm run format生产建设
npm run build
npm run docker:build📚 其他文件
🤝 贡献
- 分叉项目
- 创建要素分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
📄 许可证
根据MIT许可证分发。看 LICENSE 了解更多信息。
🙋♂️ 支持
______________________________________________________________________
⭐ 如果这个项目对你有帮助,别忘了给它打上明星!
