Logo van MCP Joern

MCP Joern

Community
sfncat

A simple Joern MCP Server.

Uitgeversfncat
Repositorymcp-joern
TaalScala
Forks
13
Sterren
52
Beschikbare tools
0
Transporttypestdio
LicentieMIT
Links
  • Koppel tools aan AI-workflows

    MCP Joern biedt MCP-functionaliteit die compatibele AI-clients en agenten kunnen gebruiken.

  • 0 beschikbare tools

    Bekijk hieronder de aanroepbare acties, inclusief namen en beschrijvingen als de server die beschikbaar stelt.

  • Configuratie om direct te kopiëren

    Gebruik de installatievoorbeelden om deze server in je favoriete MCP-client te configureren.

  • Indicatoren van opensource-interesse

    52 sterren en 13 forks in de gekoppelde repository.

MseeP.ai Security Assessment Badge

Joern MCP Server

A simple MCP Server for Joern.

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:

    bash
    git clone https://github.com/sfncat/mcp-joern.git
    cd mcp-joern
  2. Install Python dependencies:

    bash
    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:

    bash
    joern -J-Xmx40G -J-XX:CompressedClassSpaceSize=1g -J-XX:MaxMetaspaceSize=2g \
          --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 -J-XX:CompressedClassSpaceSize=1g -J-XX:MaxMetaspaceSize=2g \
          --server --server-host 127.0.0.1 --server-port 16162 \
          --server-auth-username user --server-auth-password password --import server_tools_source.sc

    Why the extra JVM flags. Both defaults are too small and only fail after prolonged use, so the breakage looks like a dead server rather than a JVM sizing problem:

    • -XX:CompressedClassSpaceSize=1g — the Joern REPL compiles one class per query (rs$line$N). The default class space (128m) is exhausted after a few thousand queries, after which every query fails with NoClassDefFoundError: Could not initialize class rs$line$NNNN.
    • -XX:MaxMetaspaceSize=2g — keeps metaspace headroom in step with the class space.
    • -J-Xmx… — size the heap for your CPG. An undersized heap shows up as queries timing out (not as an OOM). We run -Xmx60G for a ~400 MB CPG. 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

    bash
    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

https://github.com/flankerhqd/jebmcp

https://docs.joern.io/server/

https://docs.joern.io/interpreter/

Change Log

v1.2.0 (2026-09-10)

Server-side call-graph tools (performance)

  • New Scala helpers in server_tools.sc: get_methods_by_name (indexed nameExact lookup, replacing full-CPG .filter(_.fullName.contains(...)) scans which time out on large CPGs), get_callee_chain (server-side BFS returning the whole call chain - method full name plus code, JDK/framework callees skipped - in one HTTP round-trip) and get_callee_chain_names (names only, no code).
  • New MCP tools exposing them: get_callee_chain_server, get_methods_by_name.
  • Effect: resolving one call chain drops from ~30 HTTP round-trips to 1.

HTTP client hardening (server.py)

  • joern_remote now uses a kept-alive requests.Session with a connection pool.
  • Retries transient failures 3 times, but fails fast on 401/403 (auth errors are not transient).
  • Returns an explicit ERROR: ... string on failure instead of None, so callers can tell a failure apart from a legitimately empty result.

Fixes

  • Credential key compatibility: the shipped .env uses USER_NAME/PASSWORD while host configs inject JOERN_AUTH_USERNAME/JOERN_AUTH_PASSWORD. Only the latter was read, so any launch without host-injected env (including the bundled test_mcp_client.py) failed with a silent 401. Both names are now accepted.
  • FastMCP compatibility: the log_level constructor argument was removed in fastmcp 2.x; it is now passed inside a try/except with a FASTMCP_LOG_LEVEL fallback.

Docs & housekeeping

  • Start command now includes -XX:CompressedClassSpaceSize=1g -XX:MaxMetaspaceSize=2g (see the note under "Start the Joern server" for why the defaults fail only after prolonged use).
  • Code comments are English only; Chinese is confined to README_cn.md and prompts_cn.md.
  • .gitignore: ignore local CPG artifacts (*.cpg), backups (*.bak-*) and the local credential-injecting run_verify.sh wrapper.
  • Version bumped to 1.2.0.

v1.3.0 (2026-09-10)

  • tests/fixture/: a self-contained Android fixture (crafted sources + build_fixture.sh) that builds a ~12 KB APK against API 36 / SDK extension level 17 and the matching CPG. Every construct that has broken the tooling before is present exactly once: a custom base receiver whose business entry is handleBroadCastReceive() (not onReceive), a 4-hop delegation chain across classes and an interface, a duplicated simple method name, an anonymous inner class, a SharedPreferences write (hd_member) at the chain end, framework calls the chain tool must skip, and a permission-gated receiver.
  • test_mcp_client.py is now an assertion-based regression gate over that fixture: it checks the chain/lookup tools, the legacy queries and the error path, and exits non-zero on failure. The ad-hoc verify_mcp.py was merged into it.
  • The fixture APK carries the same version as this package (pyproject.toml), so tests/fixture/fixture.apk and fixture.cpg are versioned together with the server.
  • Documentation and tool help no longer use the old NFC sample; they use the fixture.
  • Version 1.2.0 -> 1.3.0.

Tests

bash
cd tests/fixture && ./build_fixture.sh --cpg   # fixture.apk + fixture.cpg
cd ../.. && uv run test_mcp_client.py          # protocol-level regression gate

Gebruik MCP Joern MCP met meerdere AI-modellen

TypingMind koppelt MCP-tools aan de werkruimte. Zodra MCP Joern is verbonden, kun je deze dus met verschillende AI-modellen in TypingMind gebruiken, zonder de verbinding voor elk model apart in te stellen. Deze MCP-integratie draait lokaal via de TypingMind MCP-connector op je apparaat.

Installatiehandleiding voor de lokale connector

Gebruik dit als de MCP-server toegang nodig heeft tot lokale bestanden, apps of privébronnen op je computer.

1

Open de MCP-instellingen

Ga in TypingMind naar Instellingen, Geavanceerde instellingen en vervolgens Model Context Protocol. Kies daar Connector instellen.

  1. Open TypingMind in je browser.
  2. Klik op het pictogram Instellingen.
  3. Ga naar Geavanceerde instellingen.
  4. Open het gedeelte Model Context Protocol.
  5. Klik op Connector instellen en kies Dit apparaat.
Instelscherm voor de TypingMind MCP-connector met Dit apparaat geselecteerd
2

Voer de connectoropdracht uit

Kies Dit apparaat, kopieer de opdracht uit TypingMind en voer deze uit in Terminal. Laat het proces draaien zolang je MCP gebruikt.

  1. Kopieer de installatieopdracht die TypingMind toont.
  2. Open Terminal op macOS of Windows Terminal op Windows.
  3. Plak de opdracht en voer deze uit.
  4. Keur de pakketinstallatie goed als Terminal vraagt of je wilt doorgaan.
  5. Laat het proces in het Terminal-venster draaien zolang je MCP-tools gebruikt.
3

Voeg MCP Joern toe als server

Klik op Servers bewerken zodra de connectorstatus Gereed is en plak de MCP-serverconfiguratie.

  1. Wacht tot de connectorstatus Gereed aangeeft.
  2. Klik op Servers bewerken.
  3. Plak de MCP-serverconfiguratie van MCP Joern.
  4. Sla de serverlijst op.
  5. Vernieuw om te controleren of de connector nog steeds klaar is voor gebruik.
MCP-instellingen van TypingMind met een actieve server en de knop Servers bewerken
{
  "mcpServers": {
    "mcp-joern": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Gebruik de verbinding met verschillende modellen

Sla de serverlijst op, open Plug-ins en schakel de MCP-tools van MCP Joern in. Selecteer vervolgens een ondersteund AI-model in TypingMind en gebruik de tools in de chat of wijs ze toe aan een AI-agent.

  1. Open de pagina Plug-ins in TypingMind.
  2. Schakel de MCP-tools van MCP Joern in.
  3. Start een chat en kies het AI-model dat je wilt gebruiken.
  4. Gebruik de MCP-tools in een chat of wijs ze toe aan een AI-agent.
  5. Schakel wanneer nodig over naar een ander AI-model zonder opnieuw verbinding te maken met MCP.
TypingMind-chat met ingeschakelde MCP-tools en een geselecteerd AI-model
Kun je MCP Joern gebruiken om me hiermee te helpen?
MCP Joern
Zeker. Ik heb het gelezen.
Dit vond ik met MCP Joern.

Veelgestelde vragen

Waarvoor wordt de MCP-server MCP Joern gebruikt?

MCP Joern is een MCP-server waarmee compatibele AI-clients verbinding kunnen maken met externe tools en context. In TypingMind hoef je deze MCP-server maar één keer toe te voegen om de tools beschikbaar te maken in je AI-werkruimte.

Kan ik MCP Joern MCP met meerdere AI-modellen in TypingMind gebruiken?

Ja. TypingMind verbindt MCP-tools op werkruimteniveau. Daardoor kun je MCP Joern gebruiken met verschillende AI-modellen, zoals Claude, ChatGPT, Gemini of andere modellen die je in TypingMind hebt ingesteld, zonder de MCP-server voor elk model afzonderlijk in te stellen.

Waarom MCP Joern MCP gebruiken met TypingMind?

TypingMind is een van de beste interfaces voor chats met LLM's, omdat het meerdere AI-modellen, prompts, plug-ins, AI-agenten, API-sleutels en MCP-tools samenbrengt in één werkruimte. Als MCP Joern verbonden is, kun je de MCP-tools ervan gebruiken met je favoriete modellen en je chatworkflow overzichtelijk houden in TypingMind.

Hoe verbind ik MCP Joern MCP met TypingMind?

MCP Joern werkt via de lokale MCP-connector van TypingMind. Dit is de beste optie als de MCP-server toegang nodig heeft tot lokale bestanden, desktopapps, opdrachtregeltools of privébronnen op je computer.

Welke tools biedt MCP Joern MCP in TypingMind?

MCP Joern biedt MCP-functies die je kunt inschakelen via de pagina Plug-ins in TypingMind. Je kunt ze gebruiken in chats of toewijzen aan AI-agenten.

Moet ik mijn API-sleutels delen met TypingMind om MCP Joern MCP te gebruiken?

Nee. TypingMind werkt in de eerste plaats lokaal en laat je de controle houden over je modelaanbieders, API-sleutels, prompts en MCP-configuratie. Als MCP Joern authenticatie vereist, voeg je bij het maken van de verbinding de vereiste headers, OAuth-instellingen of lokale configuratie voor die MCP-server toe.

Gerelateerde MCP-servers

Toon alles

Maak nu je eigen AI-werkruimte

Schrijf je in voor onze nieuwsbrief en blijf op de hoogte van nieuwe functies en toekomstige weggeefacties 👇