Get the FREE Ultimate OpenClaw Setup Guide →

code2flow

Code2Flow MCP服务器,用于生成代码调用图并通过MCP协议提供服务

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio kursk-ye-code2flow-mcp-server python server.py \
  --env PYTHONUNBUFFERED="1"

How to use

The Code2Flow MCP server wraps the code2flow command-line tool behind the MCP (Model Context Protocol) interface. It exposes tools to generate code call graphs from source code in multiple languages (Python, JavaScript, Ruby, PHP), render the resulting graph as PNG images, and perform ancillary analyses such as version checks for code2flow and code complexity assessments. You can interact with the server through an MCP client to start a session, invoke tools like generate_call_graph, check_code2flow_version, and analyze_code_complexity, and then retrieve the produced image or data via resource identifiers. This makes it easy to integrate code2flow capabilities into AI workflows, CLIs, or automation pipelines that rely on a consistent MCP API.

How to install

Prerequisites:

  • Python 3.7+
  • Git
  • Code2Flow CLI installed in your environment

Install steps:

  1. Clone the repository
git clone https://github.com/kursk-ye/code2flow-mcp-server.git
cd code2flow-mcp-server
  1. Create and activate a virtual environment (recommended)
python -m venv venv
# Windows PowerShell
.\venv\Scripts\Activate.ps1
# macOS/Linux
source venv/bin/activate
  1. Install Python dependencies
pip install -r requirements.txt
  1. Install the code2flow CLI tool
pip install code2flow
  1. Run the MCP server (from the project root)
python server.py

Additional notes

Tips and notes:

  • Ensure the code2flow CLI is accessible in your environment (installed via pip).
  • The server runs a Python-based MCP service; you can adjust environment variables if needed, e.g., PYTHONUNBUFFERED to improve log readability.
  • The server is designed to support multiple languages (Python, JavaScript, Ruby, PHP) for generating call graphs and can output PNG images of the graphs.
  • If you deploy this in production, consider running behind a reverse proxy and securing MCP API access.
  • Common issues: mismatched Python version, missing code2flow CLI, or file path problems when providing source_paths. Use absolute paths when troubleshooting.

Related MCP Servers

Sponsor this space

Reach thousands of developers