Joern (Code Analysis)
About
Integrates with Joern's code analysis capabilities to enable static code analysis, vulnerability identification, and code structure understanding through a Python interface to Code Property Graphs.
Details
- Author
- sfncat
- Repository
- sfncat/mcp-joern
- GitHub stars
- 21
- Downloads
- 201
- License
- MIT License
- Categories
- AI, Design, Developer Tools, Search, Security, Frontend, Other
- Tags
- #web, #visualization
Jump to
- Code review and security analysis via Joern
- MCP‑based integration with LLMs
- Scala tools for server interaction
- Test clients to verify connectivity
- Environment variable configuration support
Setting up with Highlight
This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:
- Download and install Highlight from highlightai.com/download
- Navigate to the plugins tab and select "Add Custom Plugin"
-
Configure the plugin with the settings below
Plugin Name
Joern (Code Analysis)Command (node, npx, python, etc.)npxArguments-
Argument 1
-y -
Argument 2
@highlight/mcp-server
Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.
-
Argument 1
- Enable "Start Automatically" if you want the plugin to start when Highlight launches
From the repository
1. Start the Joern server:
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
Or
joern -J-Xmx40G --server --server-host 127.0.0.1 --server-port 16162 --server-auth-username user --server-auth-password password --import server_tools_source.sc
If you are using it under Windows, you may need to set the JVM system variables through the command line or in the system environment variables.
set _JAVA_OPTIONS=-Dfile.encoding=UTF-8
set joern logging level to ERROR
set SL_LOGGING_LEVEL=ERROR //windows
export SL_LOGGING_LEVEL=ERROR //linux
if you have the following warning
Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
you can disable it by setting the environment variable
set TERM=dumb
export TERM=dumb
to restore the default behavior
set TERM=xterm-256color
export TERM=xterm-256color
2. Copy env_example.txt to .env
Modify the configuration information to match the joern server startup configuration
3. Run the test connection:
Modify the information in test_mcp_client.py to confirm the joern server is working properly
uv run test_mcp_client.py
Starting MCP server test...
==================================================
Testing server connection...
[04/16/25 20:38:54] INFO Processing request of type CallToolRequest server.py:534
Connection test result: Successfully connected to Joern MCP, joern server version is XXX
4. Configure MCP server
Configure the mcp server in cline, refer to sample_cline_mcp_settings.json.
5. Use MCP server
Ask questions to the large language model, refer to prompts_en.md
- Python >= 3.10 (default 3.12) & uv
- Joern
1. Clone the project locally:
git clone https://github.com/sfncat/mcp-joern.git
cd mcp-joern
2. Install Python dependencies:
uv venv .venv
source .venv/bin/activate
uv sync
Claude Desktop / Cursor
Paste into your MCP client config file to install this server.
{
"mcpServers": {
"joern (code analysis)": {
"env": {},
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
}
}
Linux
{
"env": [],
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
Macos
{
"env": [],
"args": [
"-y",
"@highlight/mcp-server"
],
"command": "npx"
}
Windows
{
"env": [],
"args": [
"/c",
"npx",
"-y",
"@highlight/mcp-server"
],
"command": "cmd"
}
Joern MCP Server
A simple MCP Server for Joern.
<a href="https://glama.ai/mcp/servers/@sfncat/mcp-joern">
</a>
Project Introduction
This project is an MCP Server based on Joern, providing a series of features to help developers with code review and security analysis.
Environment Requirements
- Python >= 3.10 (default 3.12) & uv
- Joern
Installation Steps
1. Clone the project locally:
git clone https://github.com/sfncat/mcp-joern.git
cd mcp-joern
2. Install Python dependencies:
uv venv .venv
source .venv/bin/activate
uv sync
Project Structure
├── server.py # MCP Server main program
├── test_mcp_client.py # Test program for joern server and mcp tool
├── test_sc_tools.py # Direct test program for sc tools
├── common_tools.py # Common utility functions
├── server_tools.py # Server utility functions
├── server_tools.sc # Scala implementation of server utility functions
├── server_tools_source.sc # Scala implementation of server utility functions,use sourceCode to get the source code of method
├── requirements.txt # Python dependency file
├── sample_cline_mcp_settings.json # Sample cline mcp configuration file
└── env_example.txt # Environment variables example file
Usage
1. Start the Joern server:
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
Or
joern -J-Xmx40G --server --server-host 127.0.0.1 --server-port 16162 --server-auth-username user --server-auth-password password --import server_tools_source.sc
If you are using it under Windows, you may need to set the JVM system variables through the command line or in the system environment variables.
set _JAVA_OPTIONS=-Dfile.encoding=UTF-8
set joern logging level to ERROR
set SL_LOGGING_LEVEL=ERROR //windows
export SL_LOGGING_LEVEL=ERROR //linux
if you have the following warning
Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information)
you can disable it by setting the environment variable
set TERM=dumb
export TERM=dumb
to restore the default behavior
set TERM=xterm-256color
export TERM=xterm-256color
2. Copy env_example.txt to .env
Modify the configuration information to match the joern server startup configuration
3. Run the test connection:
Modify the information in test_mcp_client.py to confirm the joern server is working properly
uv run test_mcp_client.py
Starting MCP server test...
==================================================
Testing server connection...
[04/16/25 20:38:54] INFO Processing request of type CallToolRequest server.py:534
Connection test result: Successfully connected to Joern MCP, joern server version is XXX
4. Configure MCP server
Configure the mcp server in cline, refer to sample_cline_mcp_settings.json.
5. Use MCP server
Ask questions to the large language model, refer to prompts_en.md
Development Notes
- .env file is used to store environment variables
- .gitignore file defines files to be ignored by Git version control
- pyproject.toml defines the Python configuration for the project
- MCP tool development
- Implement in server_tools.sc, add definitions in server_tools.py, and add tests in test_mcp_client.py
Contribution Guidelines
Welcome to submit Issues and Pull Requests to help improve the project.
Welcome to add more tools.
References
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





