M

MCP-Joern多模态代码审查工具

@sfncat/mcp-joern
0 Stars 426 次浏览 sfncat 更新于 2026-08-23

一个基于Joern的简单MCP(多模态会话插件)服务器,通过自然语言接口提供代码审查和安全分析功能。

该服务暂未提供标准配置,请参考 README 手动接入

服务介绍

Joern MCP Server

一个基于Joern的简单MCP服务器。

项目介绍

该项目是一个基于Joern的MCP服务器,提供了一系列功能以帮助开发人员进行代码审查和安全分析。

环境要求

  • Python >= 3.10 (默认3.12) & uv
  • Joern

安装步骤

  1. 本地克隆项目:

    git clone https://github.com/sfncat/mcp-joern.git
    cd mcp-joern
    
  2. 安装Python依赖项:

    uv venv .venv
    source .venv/bin/activate
    uv sync
    

项目结构

├── 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

使用方法

  1. 启动Joern服务器:

    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
    或者
    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
    
  2. env_example.txt复制为.env
    修改配置信息以匹配Joern服务器启动配置

  3. 运行测试连接:
    修改test_mcp_client.py中的信息以确认Joern服务器正常工作

    uv run test_mcp_client.py
    正在开始MCP服务器测试...
    ==================================================
    测试服务器连接...
    [04/16/25 20:38:54] INFO     处理类型为CallToolRequest的请求                                                                                                                     server.py:534
    连接测试结果:成功连接到Joern MCP, joern服务器版本为XXX
    
  4. 配置MCP服务器
    在cline中配置mcp服务器,参考sample_cline_mcp_settings.json

  5. 使用MCP服务器
    向大型语言模型提问,参考prompts_en.md

开发注意事项

  • .env文件用于存储环境变量
  • .gitignore文件定义了Git版本控制要忽略的文件
  • pyproject.toml定义了项目的Python配置
  • MCP工具开发
    • server_tools.sc中实现,在server_tools.py中添加定义,并在test_mcp_client.py中添加测试

贡献指南

欢迎提交Issues和Pull Requests以帮助改进项目。

欢迎添加更多工具。

参考资料

https://github.com/flankerhqd/jebmcp

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

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

相关 MCP 服务