Code Analysis MCP Server
代码分析 MCP 服务器
模型上下文协议 (MCP) 服务器,使 AI 模型能够通过自然语言对话理解和分析代码库。
✨ 亮点
自然代码探索:询问有关代码库的高级问题
"What are all the different payment providers integrated in the system?"深度代码理解:提取有关数据模型和系统架构的见解
"How does the user authentication flow work from frontend to database?"动态分析:跟踪数据流并了解系统关系
"Show me all the places where we calculate transaction fees"
Related MCP server: Notion MCP Server
限制
此工具是Aider等更复杂的代码分析工具/副驾驶的一个更简单的替代方案。虽然它缺乏 Aider 等工具的高级代码分析功能和稳健性,但如果您已经订阅了 Claude Pro,它为代码库探索提供了一个轻量级的解决方案。主要优点如下:
经济高效:使用您现有的 Claude Pro 订阅意味着无需额外的 API 成本,这与分析大型代码库时可能变得昂贵的工具不同
简单设置:只需最少的配置即可快速上手
基本分析:有利于高级代码理解和探索
请注意,由于其代码分析方法更简单,与更专业的工具相比,它可能会犯更多错误或提供不太详细的见解。
🚀 快速入门
安装服务器:
git clone https://github.com/saiprashanths/code-analysis-mcp.git
cd code-analysis-mcp安装Claude 桌面应用。有关使用 Claude 桌面应用设置 MCP 服务器的更多说明,请参阅文档
在Claude Desktop的配置文件中配置服务器:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"code-analysis": {
"command": "uv",
"args": [
"--directory",
"/PATH/TO/YOUR/REPO",
"run",
"code_analysis.py"
]
}
}
}重新启动 Claude Desktop 并开始分析您的代码!
确保工具正确设置
单击工具图标将显示
code-analysis工具单击集成按钮应显示
analyze_code_repository提示
💡 使用示例
您可以按照以下方式使用该工具来理解复杂的代码库:
首先点击下面显示的analyze_code_repository提示符。这将引导您完成初始化代码库并开始使用。
You: How does the transaction processing work in this system?
Claude: Let me analyze the data flow for transactions.
Looking at the codebase, I can see that transaction processing happens through several key components:
1. Raw transaction data is captured in the `TransactionEvent` model with fields for:
- Payment status
- Amount
- Fee calculations
- Processing timestamps
2. This data is then processed through the PaymentSummary model, which:
- Validates payment provider responses
- Calculates processing fees
- Records transaction status
Would you like me to explain any part of this in more detail?
You: What are the key database tables involved?
Claude: The main tables in the transaction processing pipeline are:
1. transaction_events: Stores raw payment events
2. payment_summary: Processed transaction records
3. payment_providers: Provider configuration
4. merchant_accounts: Account-specific settings
Let me know if you'd like to see the schema for any of these tables!🔧 可用工具
初始化存储库
初始化代码存储库以供分析:
initialize_repository("/path/to/repo")
# Output: Successfully initialized code repository at: /path/to/repo获取仓库信息
检索有关已初始化存储库的信息:
get_repo_info()
# Output:
# Code Repository Information:
# Path: /path/to/repo
# Exists: True
# Is Directory: True
# Found .gitignore file获取仓库结构
检查存储库文件结构:
get_repo_structure(depth=2)
# Output:
# 📁 src/
# 📁 api/
# 📄 routes.py
# 📄 models.py
# 📁 utils/
# 📄 helpers.py
# 📄 main.py读取文件
阅读并分析具体文件:
read_file("src/api/models.py")
# Output:
# File: src/api/models.py
# Language: python
# Size: 2.3 KB
#
# [File contents...]⚙️ 技术细节
默认扫描深度:3级
最大文件大小:1MB
每个文件的最大行数:1000
忽略 .gitignore 中列出的路径
仅限本地文件系统访问
验证文件路径以防止目录遍历
📝 许可证
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
Available Tools
4 toolsget_repo_infoB
Get information about the currently initialized code repository.
Inputs: no named parameters.
get_repo_structureB
Get the structure of files and directories in the repository.
Args:
sub_path: Optional subdirectory path relative to repository root
depth: Optional maximum depth to traverse (default is 3)
Inputs: sub_path, depth.
initialize_repositoryC
Initialize the repository path for future code analysis operations.
Args:
path: Path to the repository root directory that contains the code to analyze
Inputs: path (required).
read_fileB
Read and display the contents of a file from the repository.
Args:
file_path: Path to the file relative to repository root
Inputs: file_path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct purpose: initialize_repository sets up the context, get_repo_info provides metadata, get_repo_structure shows the file hierarchy, and read_file accesses file contents. There is no overlap in functionality, making tool selection straightforward for an agent.
All tools follow a consistent verb_noun pattern (e.g., initialize_repository, get_repo_info, get_repo_structure, read_file). The naming is uniform and predictable, using snake_case throughout with clear action descriptors.
With 4 tools, the count is reasonable for a code analysis server, covering core operations like initialization, metadata retrieval, structure viewing, and file reading. However, it feels slightly thin, as advanced analysis features (e.g., linting, dependency checks) are absent, though not essential for basic functionality.
The toolset covers basic repository operations (initialize, info, structure, read), but there are notable gaps for a code analysis domain, such as missing tools for analyzing code quality (e.g., lint, test), searching within files, or modifying content. Agents can perform foundational tasks but may hit dead ends for deeper analysis.
Maintenance
Related MCP Connectors
Every employee asks your codebase from Claude, without access to it. Statistics on each developer.
The Ramp MCP server enables users to securely connect Ramp with AI assistants like ChatGPT and Claude to query financial data and take actions using natural language. It transforms Ramp's developer API into a SQL interface that LLMs can query, allowing admins to analyze spend trends, identify cost savings, and run complex SQL analyses on comprehensive datasets (transactions, purchase orders, vendors, users), while all users can manage cards, view transactions, request reimbursements, and get expense policy answers.
Enterprise code intelligence for M&A, security audits, and tech debt. Hosted server with 200k free.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- FlicenseBqualityDmaintenanceA server that enables Claude Desktop users to access the Claude API directly, allowing them to bypass Professional Plan limitations and use advanced features like custom system prompts and conversation management.134-
- FlicenseNot gradedqualityDmaintenanceA simple server that integrates with Claude to allow querying and manipulating Notion pages and databases through natural language prompts.-
- FlicenseNot gradedqualityDmaintenanceA server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.1-

Inkeep MCP Serverofficial
AlicenseNot gradedqualityDmaintenanceA server that connects Claude to your documentation via Inkeep's API, enabling AI-powered interactions with your documentation content.25MIT