monosketch-mcp
An MCP server that enables AI agents to create beautiful ASCII diagrams using Unicode box-drawing characters, with support for stateful canvas operations, multiple shape types, and style customization.
README
monosketch-mcp
An MCP server that gives AI agents the ability to create beautiful ASCII diagrams using Unicode box-drawing characters. Built on the rendering engine from MonoSketch.
┌──────────────────┐ ┌──────────────────┐
│ │ │ │
│ Frontend │──────▶│ API │
│ │ │ │
└──────────────────┘ └────────┬─────────┘
│
│
┌────────▼─────────┐
│ │
│ Database │
│ │
└──────────────────┘
Setup
Requires Bun runtime.
git clone https://github.com/supersterling/monosketch-mcp.git
cd monosketch-mcp
bun install
Add to Claude Code
claude mcp add monosketch -- bun run /path/to/monosketch-mcp/index.ts
Add to Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"monosketch": {
"command": "bun",
"args": ["run", "/path/to/monosketch-mcp/index.ts"]
}
}
}
Tools
render_scene
Stateless one-shot rendering. Pass an array of shapes, get back ASCII art.
{
"shapes": [
{
"type": "rectangle",
"x": 0, "y": 0, "width": 20, "height": 5,
"border": { "enabled": true }
},
{
"type": "text",
"x": 0, "y": 0, "width": 20, "height": 5,
"content": "Hello World",
"horizontalAlign": "center",
"verticalAlign": "middle",
"border": { "enabled": true }
}
]
}
Output:
┌──────────────────┐
│ │
│ Hello World │
│ │
└──────────────────┘
Canvas Tools (Stateful)
Build diagrams incrementally across multiple tool calls:
| Tool | Description |
|---|---|
create_canvas |
Create a named canvas session |
add_shape |
Add a shape to a canvas |
modify_shape |
Update shape properties |
remove_shape |
Remove a shape |
render_canvas |
Render current state to ASCII |
list_canvases |
List active sessions |
clear_canvas |
Remove all shapes |
Utilities
| Tool | Description |
|---|---|
list_styles |
List all available border, fill, and anchor styles |
measure_text |
Compute bounding box for word-wrapped text |
Shape Types
Rectangle
{ "type": "rectangle", "x": 0, "y": 0, "width": 10, "height": 4,
"border": { "enabled": true, "style": "S1", "corner": "rounded" },
"fill": { "enabled": true, "style": "F1" } }
Text
{ "type": "text", "x": 0, "y": 0, "width": 20, "height": 3,
"content": "Centered text", "horizontalAlign": "center", "verticalAlign": "middle",
"border": { "enabled": true } }
Line
{ "type": "line",
"points": [{"x": 0, "y": 2}, {"x": 10, "y": 2}, {"x": 10, "y": 5}],
"stroke": { "enabled": true },
"endAnchor": "A1" }
Group
{ "type": "group", "children": [
{ "type": "rectangle", "x": 0, "y": 0, "width": 10, "height": 3, "border": { "enabled": true } },
{ "type": "rectangle", "x": 15, "y": 0, "width": 10, "height": 3, "border": { "enabled": true } }
]}
Style Reference
Border / Stroke Styles
| ID | Name | Characters |
|---|---|---|
| S1 | Thin (default) | ─ │ ┌ ┐ └ ┘ |
| S2 | Bold | ━ ┃ ┏ ┓ ┗ ┛ |
| S3 | Double | ═ ║ ╔ ╗ ╚ ╝ |
| S4 | Rounded | ─ │ ╭ ╮ ╰ ╯ |
Fill Styles
| ID | Name | Character |
|---|---|---|
| F1 | Space | (opaque blank) |
| F2 | Solid | █ |
| F3 | Medium shade | ▒ |
| F4 | Light shade | ░ |
| F5 | Diagonal | ▚ |
Anchor Styles (Line Endpoints)
| ID | Name | L R U D |
|---|---|---|
| A1 | Filled arrow | ◀ ▶ ▲ ▼ |
| A12 | Hollow arrow | ◁ ▷ △ ▽ |
| A2 | Filled square | ■ ■ ■ ■ |
| A21 | Hollow square | □ □ □ □ |
| A220 | Filled diamond | ◆ ◆ ◆ ◆ |
| A221 | Hollow diamond | ◇ ◇ ◇ ◇ |
| A3 | Hollow circle | ○ ○ ○ ○ |
| A5 | Filled circle | ● ● ● ● |
Dash Patterns
Add "dash": { "dash": 3, "gap": 1 } to any shape for dashed borders/strokes.
Line Crossing
When lines cross, junction characters are automatically resolved:
│
────┼────
│
The engine handles all combinations of single, bold, and double line styles with correct Unicode junction characters (T-junctions, crosses, corners).
Tests
bun test
208 tests covering geometry primitives, bitmap rendering, board compositing, crossing resolution, shape hierarchy, renderer pipeline, canvas management, and end-to-end integration scenarios.
Architecture
The rendering engine was extracted from MonoSketch, an open-source ASCII diagram editor.
Shape Description (JSON)
→ BitmapFactory (per shape type)
→ MonoBitmap (sparse character matrix)
→ MonoBoard (tiled canvas with crossing resolution)
→ ASCII string output
Engine modules:
engine/geo/— Point, Rect, Size geometry primitivesengine/shape/— Shape hierarchy (Rectangle, Text, Line, Group)engine/style/— Stroke, fill, anchor, and alignment stylesengine/bitmap/— Sparse bitmap matrix and per-shape rendering factoriesengine/board/— Tiled canvas compositing with Unicode line crossing resolution
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.