Provides regex-based code searching and structural analysis for C and C++ source and header files.
Supports searching for patterns and analyzing the code structure and definitions of JavaScript and JSX files.
Connects with OpenAI's API to facilitate AI-powered code updates and support for thinking-based models like o1.
Enables deep code analysis, structure identification, and symbol definition searching for Python source files.
Facilitates file operations and structural code analysis for Ruby source files.
Supports finding symbol definitions and analyzing code structures within Rust programming projects.
Allows for the analysis of TypeScript code structures and searching for symbol definitions within TS and TSX files.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Code Analysis MCP Serverfind where the class 'UserModel' is defined"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Code Analysis MCP Server
A modular MCP (Model Context Protocol) server for code analysis with file operations, code search, and structure analysis capabilities.
Features
š File Operations
read_file: Read contents of any code file
list_files: List files in directories with pattern matching
file_info: Get detailed file information (size, type, line count)
š Code Search
search_code: Search for patterns in code using regex
find_definition: Find symbol definitions (functions, classes, variables)
š Code Analysis
analyze_structure: Analyze code structure (imports, classes, functions)
Installation
Usage
1. With Claude Desktop
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Then restart Claude Desktop.
2. With Continue.dev (VS Code)
Add to your Continue configuration:
3. With Other MCP Clients
Any MCP-compatible client can use this server by pointing to the server.py file.
Available Tools
š read_file
Read the contents of a file.
š list_files
List files in a directory with optional pattern matching.
ā¹ļø file_info
Get detailed information about a file.
š search_code
Search for patterns in code files using regex.
šÆ find_definition
Find where a symbol is defined.
šļø analyze_structure
Analyze the structure of a code file.
š¤ update_with_architecture
Compare old and new architecture versions and intelligently update the new file.
AI Configuration
To use the AI-powered tools, you need to configure your API keys:
Copy
.env.exampleto.env:cp .env.example .envEdit
.envand add your API keys:AI_PROVIDER=openai OPENAI_API_KEY=your-openai-api-key # or AI_PROVIDER=anthropic ANTHROPIC_API_KEY=your-anthropic-api-key
Thinking Models Support
The tool automatically handles "thinking" models (like o1, o1-preview) that include reasoning in their responses:
Thinking sections are automatically removed
Only the actual code is extracted
Supports various thinking formats:
<think>,[thinking], etc.
Install AI dependencies:
pip install openai anthropicTest LLM connectivity:
./test_llm.sh # or python tests/test_llm.py
Examples
In Claude Desktop
After configuring, you can ask Claude:
"Read the file src/main.py"
"Search for all functions that contain 'test' in the src directory"
"Find where the class 'UserModel' is defined"
"Analyze the structure of app.py"
"List all Python files in the project"
Programmatic Usage
Architecture
The server follows a modular architecture:
Supported Languages
Python (.py)
JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
Java (.java)
C/C++ (.c, .cpp, .h)
Go (.go)
Rust (.rs)
Ruby (.rb)
And more...
Security
File access is restricted to prevent directory traversal
Large files are handled efficiently with streaming
Search results are limited to prevent memory issues
Contributing
Feel free to submit issues and enhancement requests!
License
MIT