This MCP server plugin empowers AI assistants like Claude and Cline with comprehensive code analysis capabilities. By connecting to a Neo4j graph database, it allows AI systems to analyze code structure, calculate quality metrics, extract documentation, and answer natural language questions about codebases.
To run the Code Analysis MCP Plugin, you'll need:
First, you need to install and set up the Neo4j database:
# Download and install Neo4j from the official website
# https://neo4j.com/download/
# Or using Docker
docker run \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
neo4j:latest
# Clone the repository
git clone https://github.com/your-username/code-analysis-mcp-plugin.git
cd code-analysis-mcp-plugin
# Install dependencies
pip install -r requirements.txt
# Configure the plugin
cp config.example.json config.json
Edit the config.json
file to include your Neo4j credentials and other settings:
{
"neo4j": {
"uri": "bolt://localhost:7687",
"user": "neo4j",
"password": "your-password"
},
"mcp": {
"port": 8080,
"host": "0.0.0.0"
}
}
To start the MCP server with the Code Analysis plugin:
python mcp_server.py --config config.json
To analyze a codebase and load it into the database:
python analyze_codebase.py --path /path/to/your/codebase --language python,javascript
Configure your AI assistant (Claude or Cline) to connect to the MCP server:
MCP Server URL: http://your-server-ip:8080
Plugin Name: code-analysis
Once connected, your AI assistant can answer sophisticated questions about your codebase:
Specify which languages to analyze:
python analyze_codebase.py --path /path/to/codebase --language python,javascript,java,typescript
Enable specific code quality metrics:
python analyze_codebase.py --path /path/to/codebase --metrics complexity,duplication,coverage
Check the logs for detailed error information:
tail -f logs/mcp_server.log
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "code-analysis" '{"command":"npx","args":["-y","code-mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"code-analysis": {
"command": "npx",
"args": [
"-y",
"code-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"code-analysis": {
"command": "npx",
"args": [
"-y",
"code-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect