MCP Code Flow Analyzer
# MCP Code Flow Analyzer
An MCP (Model Context Protocol) server for analyzing and tracing business code flows across your codebase. Helps developers quickly understand the complete execution path of features from frontend to backend to database.
## Features
- **Business Flow Tracing**: Follow function calls from entry points through the entire codebase
- **Multi-Language Support**: TypeScript, JavaScript
- **Smart Symbol Extraction**: Automatically identifies functions, classes, variables, and imports
- **Call Graph Analysis**: Builds and traverses function call relationships
- **Clickable Links**: Generate VSCode and GitHub links for quick navigation
- **Flexible Configuration**: YAML-based project configuration
## Installation
```bash
npm install
npm run build
```
## Usage
### 1. Configure Your Project
Create a `.flowanalysis.yaml` file:
```yaml
version: '1.0'
project:
name: "my-project"
languages: [typescript]
rootPath: "."
sourceConfig:
include: ["src/**/*.ts"]
exclude: ["**/*.test.ts", "node_modules/**"]
analysisConfig:
maxCallDepth: 10
crossFileAnalysis: true
linkConfig:
vscode: { enabled: true }
github:
enabled: true
repository: "https://github.com/owner/repo"
```
### 2. Configure in VSCode
```json
{
"modelContextProtocol": {
"servers": {
"code-flow-analyzer": {
"command": "node",
"args": ["/path/to/mcp-server/dist/index.js"],
"env": { "PROJECT_ROOT": "${workspaceFolder}" }
}
}
}
}
```
## MCP Tools
- `traceBusinessFlow` — Trace the complete execution path from an entry point
- `findCallers` — Find all functions that call a given function
- `getProjectInfo` — Get metadata about the project and analysis results
- `generateFlowDiagram` — Generate a Mermaid call graph diagram
## Architecture
```
MCP Server (index.ts)
├── Project Config Manager
├── Code Analysis Manager
│ ├── Parser Factory
│ │ ├── TypeScript Parser
│ └── Symbol Table
├── Call Graph Analyzer
└── Link Generators
├── VSCode Link Generator
└── GitHub Link Generator
```
## Development
```bash
npm run build # Build
npm run typecheck # Type check
npm run start # Run server
npm run dev # Build + run
```
## License
MIT
TDQS
Scored across 7 tools
Most tools have distinct purposes, but there is some overlap between findCallers and whoTriggers, and between generateFlowDiagram and traceBusinessFlow. Descriptions help differentiate, but agents might occasionally confuse them.
All tool names follow a consistent verb_noun pattern in camelCase (e.g., findCallers, generateFlowDiagram), making them predictable and easy to understand. 'whoTriggers' is slightly different but still verb-like.
With 7 tools, the server is well-scoped, covering essential code flow analysis functions without being overwhelming. Each tool serves a clear role.
The tool set covers search, call graph analysis, critical point detection, and visualization. Minor gaps exist, such as lacking a tool for comparing flows or detailed function metadata, but it sufficiently handles core analysis tasks.