Skip to main content

Repository Architecture MCP Server

An MCP (Model Context Protocol) server that analyzes GitHub repositories and automatically generates visual architectural diagrams including dependency graphs, class diagrams, and data flow diagrams.

Features

  • Repository Analysis: Analyze both GitHub repositories (public/private) and local repositories
  • Multi-language Support: Parse Python, JavaScript, TypeScript, Java, and Go codebases
  • Dependency Diagrams: Visualize module dependencies and service interconnections
  • Class Diagrams: Generate UML class diagrams with inheritance relationships
  • Data Flow Diagrams: Show how data moves through the system
  • Multiple Export Formats: Support for Mermaid, SVG, and PNG outputs
  • Local Analysis: No GitHub token required for local repository analysis

Diagram Preview Tools

To preview the generated diagrams, you'll need appropriate tools or extensions depending on the output format:

Mermaid Diagrams

Mermaid diagrams can be previewed using:

VS Code Extensions:

  • Mermaid Preview by vstirbu: Install via VS Code Extensions marketplace

    • Search for "Mermaid Preview" in VS Code Extensions (Ctrl+Shift+X)
    • Click Install
    • Open any .md file containing Mermaid code blocks and use the preview pane
  • Markdown Preview Mermaid Support by Matt Bierner: Enhanced markdown preview with Mermaid support

    • Search for "Markdown Preview Mermaid Support" in VS Code Extensions
    • Provides live preview of Mermaid diagrams in markdown files

Online Tools:

Browser Extensions:

  • Mermaid Diagrams for Chrome/Firefox - Renders Mermaid in GitHub and other platforms

SVG Diagrams

SVG files can be viewed in:

  • Any modern web browser (Chrome, Firefox, Safari, Edge)
  • VS Code with SVG preview extensions
  • Image viewers that support SVG format

PNG Diagrams

PNG files can be viewed in:

  • Any image viewer or web browser
  • VS Code with image preview extensions
  • Built-in system image viewers

For the best experience, we recommend:

  1. Install the Mermaid Preview extension in VS Code for live Mermaid diagram preview
  2. Use the Markdown Preview Mermaid Support extension for enhanced markdown rendering
  3. Keep a browser tab open to Mermaid Live Editor for quick diagram testing

Installation

pip install -e .

For development:

pip install -e ".[dev]"

Verify Installation

Test that the server is working:

# Check command is available
repo-architecture-mcp --help

# Test server startup (Ctrl+C to stop)
repo-architecture-mcp --log-level DEBUG

Usage

As MCP Server

Run the server with stdio transport:

repo-architecture-mcp

With debug logging:

repo-architecture-mcp --log-level DEBUG

Available MCP Tools

  • analyze_repository: Analyze repository structure (GitHub URL or local path)
  • generate_dependency_diagram: Create dependency visualization
  • generate_class_diagram: Create class relationship diagram
  • generate_data_flow_diagram: Create data flow visualization
  • get_repository_summary: Get high-level repository statistics

Local Repository Analysis

For local repositories, you don't need a GitHub token:

# Analyze current directory
repo-architecture-mcp --analyze-local .

# Analyze specific local path  
repo-architecture-mcp --analyze-local /path/to/project

MCP Configuration

Quick Setup

  1. Copy the provided mcp.json to your MCP client configuration directory
  2. Set your GitHub token: export GITHUB_TOKEN=your_token_here
  3. Add the server to your MCP client

Basic MCP Configuration

For GitHub repositories:

{
  "mcpServers": {
    "repo-architecture": {
      "command": "repo-architecture-mcp",
      "args": ["--log-level", "INFO"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      },
      "disabled": false,
      "autoApprove": ["analyze_repository"]
    }
  }
}

For local repositories (no token needed):

{
  "mcpServers": {
    "repo-architecture-local": {
      "command": "repo-architecture-mcp",
      "args": ["--log-level", "INFO"],
      "cwd": "${workspaceFolder}",
      "disabled": false,
      "autoApprove": [
        "analyze_repository",
        "generate_dependency_diagram"
      ]
    }
  }
}

For Cursor IDE

Workspace Configuration for Local Analysis (.cursor/settings/mcp.json):

{
  "mcpServers": {
    "repo-architecture-local": {
      "command": "repo-architecture-mcp",
      "cwd": "${workspaceFolder}",
      "disabled": false,
      "autoApprove": [
        "analyze_repository",
        "generate_dependency_diagram"
      ]
    }
  }
}

User Configuration for GitHub (~/.cursor/settings/mcp.json):

{
  "mcpServers": {
    "repo-architecture": {
      "command": "repo-architecture-mcp",
      "args": ["--max-workers", "4"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      },
      "disabled": false,
      "autoApprove": ["analyze_repository"]
    }
  }
}

For GitHub Copilot Chat

This MCP server integrates seamlessly with GitHub Copilot Chat to provide architectural insights directly in your development workflow. Use the available tools through Copilot's chat interface to analyze repositories and generate diagrams.

Available Tools

  • analyze_repository: Analyze repository structure and code
  • generate_dependency_diagram: Create dependency visualizations
  • generate_class_diagram: Generate UML class diagrams
  • generate_data_flow_diagram: Create data flow diagrams
  • get_repository_summary: Get repository statistics

Configuration Options

The server accepts these command-line arguments:

  • --config PATH: Custom configuration file
  • --log-level LEVEL: Set logging level (DEBUG, INFO, WARNING, ERROR)
  • --github-token TOKEN: GitHub authentication token
  • --max-workers N: Number of parallel workers (default: 4)
  • --memory-limit MB: Memory limit in megabytes (default: 2048)
  • --cache-ttl HOURS: Cache time-to-live (default: 24)
  • --output-format FORMAT: Default output format (mermaid, svg, png)

Environment Variables

  • GITHUB_TOKEN: GitHub personal access token
  • LOG_LEVEL: Logging level
  • REPO_ARCH_CONFIG: Path to configuration file

See examples/mcp-config-examples.md for more detailed configuration examples and examples/local-repo-config.md for local repository setup.

Development

Project Structure

src/repo_architecture_mcp/
├── __init__.py          # Package initialization
├── main.py              # Main entry point
└── server.py            # Core MCP server implementation

Running Tests

pytest

Code Formatting

black src/ tests/

Type Checking

mypy src/

License

MIT License

Metadata

Release files for repo-architecture-mcp-server 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for repo-architecture-mcp-server 0.1.1
File Size Uploaded Provenance
repo_architecture_mcp_server-0.1.1.tar.gz 118.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for repo-architecture-mcp-server 0.1.1
File Interpreter ABI Platform
repo_architecture_mcp_server-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 213.4 kB

Release files / repo_architecture_mcp_server-0.1.1.tar.gz

Download URL repo_architecture_mcp_server-0.1.1.tar.gz
Size 118.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7d92e3aa269d9557b292daa53c5ee09b67e4d76857160adc8bcbbde99599452a
BLAKE2b-256 checksum
How to use checksums
e93bd65bd9c4e8af042ea9116e6a9d6306c00970bbba7f58b9465401a3577315
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / repo_architecture_mcp_server-0.1.1-py3-none-any.whl

Download URL repo_architecture_mcp_server-0.1.1-py3-none-any.whl
Size 95.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
408512708285a13ba806a437a0cb8d1b57389ae45b76aff180407bca750aa995
BLAKE2b-256 checksum
How to use checksums
4bc3101ec3f83d9135d5748e803843ef572b2e5977bb51acb2c7b330005e27f6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for repo-architecture-mcp-server 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page