Code Analysis MCP Server
About
A modular MCP server for code analysis, supporting file operations, code search, and structure analysis.
Details
- Author
- zeocax
- Categories
- Developer Tools, Search
Jump to
Setup
Install Code Analysis MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/zeocax/code-mcp
Follow the installation instructions in the repository README, then restart your MCP client.
A modular MCP (Model Context Protocol) server for code analysis with file operations, code search, and structure analysis capabilities.
- 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)
- search_code: Search for patterns in code using regex
- find_definition: Find symbol definitions (functions, classes, variables)
- analyze_structure: Analyze code structure (imports, classes, functions)
# Clone the repository git clone https://github.com/yourusername/code-mcp.git cd code-mcp # Create virtual environment python -m venv venv # Activate environment source venv/bin/activate # On Unix/macOS venv\Scripts\activate # On Windows # Install dependencies pip install -r requirements.txt
Add to your Claude Desktop configuration file:
macOS:~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:%APPDATA%\Claude\claude_desktop_config.json
{ "mcpServers": { "code-analyzer": { "command": "python", "args": ["/absolute/path/to/code-mcp/server.py"] } } }
{ "models": [...], "mcpServers": { "code-analyzer": { "command": "python", "args": ["/absolute/path/to/code-mcp/server.py"] } } }
Any MCP-compatible client can use this server by pointing to theserver.pyfile.
{ "tool": "read_file", "arguments": { "path": "src/main.py", "encoding": "utf-8" // optional, default: utf-8 } }
List files in a directory with optional pattern matching.
{ "tool": "list_files", "arguments": { "directory": "./src", // optional, default: current dir "pattern": ".py", // optional, default: "recursive": true // optional, default: false } }
{ "tool": "file_info", "arguments": { "path": "src/main.py" } }
Search for patterns in code files using regex.
{ "tool": "search_code", "arguments": { "pattern": "def.test", // regex pattern "directory": "./src", // optional "file_pattern": ".py", // optional "case_sensitive": false // optional, default: true } }
{ "tool": "find_definition", "arguments": { "symbol": "MyClass", "directory": "./src", // optional "language": "python" // optional: python, javascript } }
{ "tool": "analyze_structure", "arguments": { "path": "src/main.py", "include_docstrings": true // optional, default: false } }
Compare old and new architecture versions and intelligently update the new file.
{ "tool": "update_with_architecture", "arguments": { "old_file": "src/legacy/module.py", // Reference file (old architecture) "new_file": "src/modern/module.py", // Target file (will be updated) "backup": true // optional, default: true } }
To use the AI-powered tools, you need to configure your API keys:
AI_PROVIDER=openai OPENAI_API_KEY=your-openai-api-key # or AI_PROVIDER=anthropic ANTHROPIC_API_KEY=your-anthropic-api-key
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.
./test_llm.sh # or python tests/test_llm.py
- "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"
# Example of calling tools programmatically import asyncio from mcp import Client async def main(): client = Client() # Read a file result = await client.call_tool("read_file", { "path": "src/main.py" }) # Search for patterns result = await client.call_tool("search_code", { "pattern": "TODO|FIXME", "directory": "./", "recursive": True }) # Analyze structure result = await client.call_tool("analyze_structure", { "path": "src/main.py", "include_docstrings": True }) asyncio.run(main())
The server follows a modular architecture:
├── server.py # Main MCP server ├── tools/ # Tool definitions │ ├── file_tools.py # File operations │ └── code_tools.py # Code analysis tools ├── handlers/ # Request handlers │ ├── file_handler.py │ ├── search_handler.py │ └── analyze_handler.py └── core/ # Core services ├── file_system.py # File system operations └── code_parser.py # Code parsing logic
- Python (.py)
- JavaScript/TypeScript (.js, .ts, .jsx, .tsx)
- Java (.java)
- C/C++ (.c, .cpp, .h)
- Go (.go)
- Rust (.rs)
- Ruby (.rb)
- And more...
- File access is restricted to prevent directory traversal
- Large files are handled efficiently with streaming
- Search results are limited to prevent memory issues
Feel free to submit issues and enhancement requests!
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
Persistent code index using Tree-sitter for fast, precise code search. Replaces grep with ~50 token responses instead of 2000+.
A platform-agnostic code analysis library with semantic search capabilities and MCP server support.
A server for code indexing, searching, and analysis, enabling LLMs to interact with code repositories.
Fast semantic code search for AI agents — find symbols, references, and callers across any codebase. Pre-built index committed to git, instant queries via MCP.
Advanced code search and transformation powered by ugrep and ast-grep for modern development workflows.
Search all of GitHub from your AI agent — find libraries, drill into repos, find code patterns.
Structural codebase indexer with 17 query tools. 87% token reduction. Zero dependencies.
Source-code intelligence for agents, powered by OpenGrok and Go.
A local MCP server providing powerful code analysis and search capabilities for software projects.
A local-first semantic code search tool with vector and regex capabilities, designed for AI assistants.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.




