使用说明
DevFlow MCP
用于理解项目结构、符号、模式和依赖关系的代码分析MCP服务器。
什么是DevFlow?
DevFlow提供 综合代码分析 通过AST解析和模式检测。它通过分析结构、关系和模式来帮助AI代理理解代码库:
- 项目分析 -提取元数据、依赖关系和结构
- 体系结构分析 -了解项目组织和层次
- 符号分析 -在代码库中查找和跟踪符号
- 模式检测 -识别设计模式和反模式
- 依赖图 -可视化模块之间的关系
- Git分析 -提取决策并跟踪变化速度
快速开始
# Install
npm install -g devflow-mcp
# Configure your AI agent (see Setup Guide)
# Then use tools like:
# - getProjectOnboarding
# - getArchitecture
# - findSymbol
# - detectPatterns
🌐 仪表板: 当MCP服务器运行时,仪表板会自动找到可用端口,并可在浏览器中访问。使用 DEVFLOW_DASHBOARD_AUTO_OPEN=true 自动启动它!
📚 文档索引 -完整的文档
分析工具
DevFlow提供七类分析工具:
项目工具
getProjectOnboarding-提取项目元数据和依赖关系
体系结构工具
getArchitecture-通过符号和图案获取架构概述
符号工具
findSymbol-按名称和类型搜索符号findReferences-查找对某个符号的所有引用
图案工具
detectPatterns-检测代码中的设计模式detectAntiPatterns-识别代码气味和反模式
图形工具
getDependencyGraph-构建文件之间的依赖关系图
Git工具
getRecentDecisions-从git提交中提取决策analyzeChangeVelocity-分析文件更改频率
上下文工具
getContextForFile-获取全面的文件上下文summarizeFile-生成文件摘要
看 使用指南 以获取详细示例。
由代理设置
克劳德桌面版
创建 mcp.json 在项目根目录中:
{
"mcpServers": {
"devflow": {
"command": "devflow",
"args": ["serve"]
}
}
}
然后使用分析工具,如:
getProjectOnboarding-获取项目概述getArchitecture-了解项目结构findSymbol-定位代码符号
光标
创建 mcp.json 在项目根目录中:
{
"mcpServers": {
"devflow": {
"command": "devflow",
"args": ["serve", "--stdio"]
}
}
}
在Composer或聊天中使用:
getProjectOnboarding-获取项目元数据getArchitecture-分析项目结构findSymbol-搜索符号detectPatterns-查找设计模式getContextForFile-获取文件上下文
泽德
添加到您的 settings.json:
{
"context_servers": {
"devflow": {
"command": "devflow",
"args": ["serve", "--stdio"]
}
}
}
在助手中使用:
getProjectOnboarding-项目概况getArchitecture-架构分析findSymbol-符号搜索detectPatterns-模式检测getContextForFile-文件上下文
安装指南 -详细的配置说明
文档
入门指南
参考
📖 完整文档索引
主要特点
- 基于AST的分析 -通过AST解析深入理解代码
- 插件架构 -可扩展的语言支持
- 模式检测 -识别设计模式和代码气味
- 相关性分析 -可视化关系和依赖关系
- Git集成 -提取决策并跟踪变化速度
- 类型安全 -带有Zod验证的完整TypeScript
- 交叉平台的 -与Claude Desktop、Cursor、Zed配合使用
- 快速高效 -缓存和增量分析支持
为什么选择DevFlow?
理解大型代码库具有挑战性:
- ❌ 手动代码探索很耗时
- ❌ 难以跟踪符号关系
- ❌ 模式检测需要深厚的知识
- ❌ 依赖性分析很复杂
DevFlow提供:
- ✅ 自动代码分析
- ✅ 符号搜索和参考跟踪
- ✅ 模式和反模式检测
- ✅ 依赖关系图可视化
- ✅ Git历史洞察
项目状态
分析引擎: ✅ 生产就绪
- ✅ 项目和架构分析工具
- ✅ 符号搜索和参考查找
- ✅ 模式检测(设计模式和反模式)
- ✅ 依赖图生成
- ✅ Git分析工具
- ✅ 文件上下文和摘要
- ✅ Types/JavaScript支持
- ✅ 综合集成测试
- ✅ Zod模式的完全类型安全
- ✅ 跨平台MCP兼容性
技术栈
- TypeScript 5.3+ -类型安全和开发人员经验
- MCP-SDK -标准协议实施
- Bun 1.3.2 -快速运行、包管理和测试
- ts变形 -TypeScript AST操作
- 简单git -Git存储库分析
- 萨德 -架构验证
发展
快速命令
# Install dependencies
bun install
# Run tests
bun test
# Type check
bun run type-check
# Build standalone executable
bun run build
# The build creates a single executable at dist/devflow
# with embedded Bun runtime and bytecode compilation
# Lint & format
bun run lint:fix
bun run format
测试
# All tests
bun test
# Watch mode
bun test --watch
# Coverage
bun test --coverage
# AI agent mode (quiet output, only failures)
bun run test:ai
# Unit tests only
bun test tests/unit
# Integration tests only
bun test tests/integration
测试指导 -详细的测试文档
贡献
DevFlow正在积极维护,欢迎投稿!
重点领域:
- 语言插件实现(Python、Go、Rust)
- AST分析改进
- 性能优化
- 模式检测增强
- 测试改进
入门指南:
- 复刻仓库
- 创建要素分支
- 进行更改
- 运行测试:
bun test - 提交拉取请求
推之前:
bun run lint:fix # Fix linting
bun run format # Format code
bun run type-check # Check types
bun test # Run tests
看 安装指南 详细的开发说明。
建筑
DevFlow使用一个干净的、模块化的架构,专注于代码分析:
src/
├── core/
│ ├── config.ts # Project root detection
│ ├── storage/ # File I/O abstraction
│ └── analysis/ # Analysis engine and plugins
│ ├── engine.ts # Analysis orchestrator
│ ├── plugins/ # Language plugins
│ ├── cache/ # Caching system
│ └── git/ # Git analyzer
├── mcp/
│ └── tools/ # Analysis tools
│ ├── project.ts # Project tools
│ ├── architecture.ts # Architecture tools
│ ├── symbols.ts # Symbol tools
│ ├── patterns.ts # Pattern tools
│ ├── graph.ts # Graph tools
│ ├── git.ts # Git tools
│ └── context.ts # Context tools
├── server.ts # Main MCP server
└── index.ts # Public API
架构文档 -技术深潜
安全
- 路径验证 -所有文件操作都经过验证,以防止遍历攻击
- 类型安全 -带有Zod模式验证的完整TypeScript
- 无外部通话 -项目本地的一切
- Git友好 -易于审核版本控制中的更改
安全策略 -详细信息
许可证
麻省理工学院-用DevFlow构建你想要的任何东西。
资源
外部:
文档:
有关问题、疑问或建议,请在GitHub上打开问题。