MCPSERV.CLUB
MCP-Mirror

Code2Flow MCP Server

MCP Server

Generate code call graphs via MCP protocol

Stale(50)
0stars
1views
Updated Mar 24, 2025

About

A lightweight MCP server that wraps the code2flow CLI to produce call‑graph images in PNG format. It supports multiple languages, offers version checks and code complexity analysis, making it ideal for AI applications needing structured code visualization.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

Code2Flow MCP Server Overview

The Code2Flow MCP server turns the command‑line code2flow utility into a first‑class Model Context Protocol service. By exposing the tool through MCP, it lets AI assistants such as Claude or Cursor generate visual call‑flow diagrams of arbitrary codebases without the user having to install or run any tooling locally. This solves a common pain point for developers: the need to manually run static analysis tools, parse their output, and then embed the resulting diagrams into documentation or code reviews. With a single HTTP endpoint, an AI assistant can request a call graph, receive an image ID, and then retrieve the PNG directly from the server—streamlining the workflow from code understanding to presentation.

The server’s core value lies in its language‑agnostic call‑graph generation. It supports Python, JavaScript, Ruby, and PHP out of the box, automatically detecting file types and applying appropriate parsing rules. For each request, developers can specify which directories or files to analyze, include or exclude patterns, and an optional output path. The service then runs code2flow under the hood, captures its PNG output, stores it in a managed resource pool, and returns a lightweight reference that the AI can embed or manipulate further. This abstraction removes the burden of dependency management and command‑line intricacies from the developer, allowing focus on higher‑level architecture discussions.

Key capabilities are exposed as MCP tools and resources:

  • – produces a PNG call‑flow diagram for the supplied source paths and language.
  • – verifies that the underlying code2flow binary is available and reports its version, ensuring compatibility.
  • – returns a simple complexity metric for a given file, useful for highlighting hotspots.

Resources provide static information and retrieved assets:

  • offers quick reference documentation.
  • lists the four supported languages.
  • lets clients fetch a generated diagram by its identifier.

In practice, the server is ideal for continuous integration pipelines, where an AI assistant can automatically generate architecture diagrams during a build and embed them in release notes. It also shines in code review assistants, enabling on‑the‑fly visualization of new functions or modules. For educational tools, the server can provide instant visual feedback to students learning about function calls and module dependencies. Because the service runs locally or in a private cloud, it respects data privacy while still offering rich AI‑driven insights.

Overall, the Code2Flow MCP server bridges a gap between static analysis tooling and conversational AI workflows. By wrapping code2flow in a standardized protocol, it delivers a reusable, language‑aware visualization service that scales from individual developers to large teams, enhancing productivity and clarity in software development.