This Joern MCP Server provides a simple interface for code review and security analysis through Joern's capabilities. It allows you to leverage Joern's static analysis features through a Model Context Protocol server.
git clone https://github.com/sfncat/mcp-joern.git
cd mcp-joern
uv venv .venv
source .venv/bin/activate
uv sync
Start the Joern server with the necessary configuration:
joern -J-Xmx40G --server --server-host 127.0.0.1 --server-port 16162 --server-auth-username user --server-auth-password password --import server_tools.sc
Copy the example environment file to create your own:
cp env_example.txt .env
Edit the .env
file to match your Joern server configuration settings
Modify the information in demo.py
and run it to verify the Joern server connection:
python demo.py
You should see output similar to:
127.0.0.1:16162
Successfully connected to Joern MCP, joern server version is XXX
Configure the MCP server in cline by referring to the sample_cline_mcp_settings.json
file. This file contains the necessary settings for the MCP integration.
To interact with the MCP server and ask questions to the large language model, refer to the prompts_en.md
file for example prompts and usage patterns.
The MCP server provides various tools for code analysis:
server_tools.py
server_tools.sc
with corresponding definitions in server_tools.py
These tools can help with tasks such as code vulnerability detection, dependency analysis, and more when used through the MCP protocol.
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 > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.