
archy
archy
README
Archy - Architectural Diagram Builder
Archy is an MCP (Model Context Protocol) server that generates architectural diagrams using Mermaid syntax. It can process both natural language descriptions and GitHub repository URLs to create various types of diagrams.
Features
- Generate diagrams from text descriptions
- Generate diagrams from GitHub repositories
- Support for all Mermaid diagram types:
- Flowcharts
- Sequence Diagrams
- Class Diagrams
- State Diagrams
- Entity Relationship Diagrams
- User Journeys
- Gantt Charts
- Pie Charts
- Quadrant Charts
- Requirement Diagrams
- Git Graphs
- C4 Diagrams
Installation
Prerequisites
- Node.js (v16 or higher)
- npm (v7 or higher)
- TypeScript (v5.8 or higher, included in dependencies)
Install from Source
-
Clone the repository:
git clone https://github.com/yourusername/archy.git cd archy
-
Install dependencies:
npm install
-
Build the project:
npm run build
This compiles the TypeScript source files to JavaScript in the
build
directory.
Automated MCP Installation
Archy includes a convenient installation script that automatically configures the MCP server for both VS Code and Claude:
npm run install-mcp
This script:
- Automatically detects the correct MCP settings locations for your operating system
- Updates the MCP configuration files for VS Code and Claude
- Prompts for a GitHub token for repository analysis (optional)
- Makes the server executable
No need to manually edit JSON configuration files like some kind of cave-dwelling animal! The script handles all the tedious configuration work for you, so you can focus on creating beautiful diagrams instead of wrestling with file paths and permissions.
Configuration
Configuration
Archy can be configured using environment variables:
GITHUB_TOKEN
: GitHub API token for authenticated requests (optional)OPENROUTER_API_KEY
: OpenRouter API key for AI-powered diagram generation (optional)
OpenRouter Integration
Archy includes integration with OpenRouter through LangChain, enabling enhanced AI-powered diagram generation. When an OpenRouter API key is configured, additional tools become available:
- AI-Enhanced Text-to-Diagram Generation: Generate more sophisticated diagrams from text descriptions
- Code-to-Diagram Generation: Analyze code and generate appropriate diagrams
- Diff Visualization: Generate diagrams showing differences between code versions
To use these features:
- Sign up for an account at OpenRouter
- Get your API key from the OpenRouter dashboard
- Set the
OPENROUTER_API_KEY
environment variable before running Archy
Image Export
Archy supports exporting Mermaid diagrams to various image formats:
- PNG: Raster image format suitable for web and documentation
- SVG: Vector image format that scales without losing quality
- PDF: Document format suitable for printing and sharing
Images can be exported with customizable dimensions and background colors.
Repository Evolution Tracking
Archy can analyze Git repositories to track their evolution over time:
- In-Memory Git: Clone and analyze repositories without writing to the file system
- Commit History: Track changes across multiple commits (limited to 10 by default)
- File Evolution: Track how specific files change over time
- Evolution Visualization: Generate diagrams showing the repository's evolution
MCP Integration
To use Archy with an MCP client, add it to your MCP settings file if you're a masochist:
{
"mcpServers": {
"archy": {
"command": "node",
"args": ["/path/to/archy/build/index.js"],
"env": {
"GITHUB_TOKEN": "your-github-token"
}
}
}
}
Available Tools
generate_diagram_from_text
Generates a Mermaid diagram from a text description.
Parameters:
description
: Text description of the diagram to generatediagramType
: Type of diagram to generate (e.g., 'flowchart', 'classDiagram', etc.)
Example:
{
"description": "A user authentication system with login, registration, and password reset",
"diagramType": "flowchart"
}
generate_diagram_from_github
Generates a Mermaid diagram from a GitHub repository.
Parameters:
repoUrl
: URL of the GitHub repositorydiagramType
: Type of diagram to generate (e.g., 'classDiagram', 'sequenceDiagram', etc.)
Example:
{
"repoUrl": "https://github.com/username/repository",
"diagramType": "classDiagram"
}
list_supported_diagram_types
Lists all supported diagram types with descriptions.
Parameters: None
AI-Powered Tools
The following tools are available when an OpenRouter API key is configured:
generate_diagram_from_text_with_ai
Generates a Mermaid diagram from a text description using AI (LangChain with OpenRouter).
Parameters:
description
: Text description of the diagram to generatediagramType
: Type of diagram to generate (e.g., 'flowchart', 'classDiagram', etc.)useAdvancedModel
: (Optional) Whether to use a more advanced AI model for complex diagrams
Example:
{
"description": "A microservice architecture with user service, product service, and order service communicating through a message queue",
"diagramType": "flowchart",
"useAdvancedModel": true
}
generate_diagram_from_code
Generates a Mermaid diagram from code using AI.
Parameters:
code
: The code to analyze and generate a diagram fromdiagramType
: Type of diagram to generate (e.g., 'classDiagram', 'flowchart', etc.)
Example:
{
"code": "class User { ... } class AuthService { ... }",
"diagramType": "classDiagram"
}
generate_diff_diagram
Generates a Mermaid diagram showing differences between two versions of code.
Parameters:
beforeCode
: The code before changesafterCode
: The code after changesdiagramType
: Type of diagram to generate (e.g., 'classDiagram', 'flowchart', etc.)
Example:
{
"beforeCode": "class User { ... }",
"afterCode": "class User { ... additional methods ... }",
"diagramType": "classDiagram"
}
export_diagram_to_image
Exports a Mermaid diagram to an image format (PNG, SVG, or PDF).
Parameters:
mermaidCode
: The Mermaid diagram code to exportformat
: (Optional) The image format to export to ('png', 'svg', 'pdf', default: 'png')width
: (Optional) The width of the image in pixels (default: 800)height
: (Optional) The height of the image in pixels (default: 600)backgroundColor
: (Optional) The background color of the image (CSS color or "transparent", default: '#ffffff')
Example:
{
"mermaidCode": "flowchart TD\n A[Start] --> B[End]",
"format": "svg",
"width": 1200,
"height": 800,
"backgroundColor": "#f0f0f0"
}
generate_repository_evolution_diagram
Generates a diagram showing the evolution of a repository over time.
Parameters:
repoUrl
: URL of the GitHub repositorydiagramType
: Type of diagram to generate (e.g., 'gitGraph', 'flowchart', etc.)filepath
: (Optional) Path to a specific file to trackcommitLimit
: (Optional) Maximum number of commits to analyze (default: 10)
Example:
{
"repoUrl": "https://github.com/username/repository",
"diagramType": "gitGraph",
"filepath": "src/main.js",
"commitLimit": 5
}
Examples
Generating a Class Diagram from Text
generate_diagram_from_text({
"description": "Create a class diagram for a library system with Book, Author, and Library classes. Books have titles and ISBNs. Authors have names and can write multiple books. Libraries contain many books.",
"diagramType": "classDiagram"
})
Result:
classDiagram
class Book {
+String title
+String ISBN
+getDetails()
}
class Author {
+String name
+List books
+addBook(Book)
}
class Library {
+List books
+addBook(Book)
+findBookByISBN(String)
}
Author "1" -- "n" Book: writes
Library "1" -- "n" Book: contains
Generating a Flowchart from GitHub
generate_diagram_from_github({
"repoUrl": "https://github.com/username/api-service",
"diagramType": "flowchart"
})
Result:
flowchart TD
A[Client] --> B[API Gateway]
B --> C{Authentication}
C -->|Valid| D[Route Request]
C -->|Invalid| E[Return 401]
D --> F[Service 1]
D --> G[Service 2]
D --> H[Service 3]
F --> I[Database]
G --> I
H --> I
Development
Running in Development Mode
To run the server in development mode with automatic reloading:
npm run dev
This uses nodemon
and ts-node
to run the TypeScript code directly without a separate build step, automatically restarting when files change.
Running the TypeScript Compiler
You can run the TypeScript compiler directly using the following methods:
Using the locally installed TypeScript
# Using npx to run the local TypeScript installation
npx tsc
# Compile with specific tsconfig file
npx tsc --project tsconfig.json
# Watch mode - automatically recompile when files change
npx tsc --watch
# Compile specific files
npx tsc src/index.ts src/server.ts
Using globally installed TypeScript
If you have TypeScript installed globally:
# Install TypeScript globally (if not already installed)
npm install -g typescript
# Run the TypeScript compiler
tsc
# Compile with specific tsconfig file
tsc --project tsconfig.json
# Watch mode
tsc --watch
Common TypeScript Compiler Options
--outDir <directory>
: Specify output directory for compiled files--target <ES version>
: Specify ECMAScript target version (e.g., ES2020)--module <module system>
: Specify module system (e.g., NodeNext)--declaration
: Generate .d.ts declaration files--sourceMap
: Generate source map files for debugging--strict
: Enable all strict type checking options--noEmit
: Check for errors without generating output files--noImplicitAny
: Raise error on expressions with implied 'any' type
For a complete list of compiler options, run npx tsc --help
or refer to the TypeScript documentation.
TypeScript Configuration
Archy is built with TypeScript using the following configuration:
{
"compilerOptions": {
"target": "ES2020",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"outDir": "build",
"declaration": true,
"sourceMap": true,
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "build"]
}
Key TypeScript features used:
- ES2020 target for modern JavaScript features
- NodeNext module resolution for compatibility with Node.js
- Declaration files generation for better type support
- Source maps for easier debugging
Project Structure
src/
: TypeScript source filessrc/index.ts
: Main entry point and server implementationsrc/server.ts
: Server implementationsrc/generators/
: Diagram generation logicsrc/utils/
: Utility functions and helpers
build/
: Compiled JavaScript outputexamples/
: Example usage scriptstest/
: Test files
推荐服务器

Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。