mcp-patent-diagrams
v1.1.0
Published
MCP server for generating patent-quality technical diagrams using multiple backends (Mermaid, Graphviz, PlantUML, SVG)
Maintainers
Readme
mcp-patent-diagrams
An MCP (Model Context Protocol) server for generating patent-quality technical diagrams. Supports multiple rendering backends: Mermaid, Graphviz DOT, PlantUML, and pure SVG primitives.
Features
- Multiple Backends: Automatically selects the best diagram backend based on figure description
- Patent-Quality Output: Monochrome, clean lines, consistent fonts, reference numeral support
- Deterministic: No external web services, reproducible outputs
- Graceful Degradation: Returns DSL/spec even when renderers are unavailable
- Works with Claude Code: Designed for AI-assisted patent drafting workflows
Installation
From NPM
npm install -g mcp-patent-diagramsFrom Source
git clone <repository-url>
cd mcp-patent-diagrams
npm install
npm run buildQuick Start
Configure with Claude Code
Add to your Claude Code MCP configuration (~/.claude/claude_desktop_config.json or similar):
{
"mcpServers": {
"patent-diagrams": {
"command": "npx",
"args": ["mcp-patent-diagrams"]
}
}
}Or if installed globally:
{
"mcpServers": {
"patent-diagrams": {
"command": "mcp-patent-diagrams"
}
}
}Usage
Once configured, Claude Code can generate patent diagrams with commands like:
Generate a block diagram for FIG. 1 showing a neural network accelerator
with input buffer (100), compute array (110), weight memory (120),
and output buffer (130).Standalone Usage
# Run directly
npx mcp-patent-diagrams
# Or if installed globally
mcp-patent-diagramsDevelopment
npm run dev # Start with tsx (hot reload)
npm run build # Build TypeScript
npm run start # Run built version
npm run typecheck # Type check without buildingTools
The server exposes four tools:
1. diagram_choose_backend
Analyzes a figure description and recommends the optimal rendering backend.
Input:
figure_description(required): Natural language description of the diagrampreferred_backend(optional): Hint for preferred backendconstraints(optional): Additional constraints
Output:
- Recommended backend with rationale and confidence score
2. diagram_plan_from_description
Generates a complete diagram specification from a natural language description.
Input:
figure_description(required): Description of the diagramreference_numerals(optional): Map of element names to reference numbersstyle(optional): Style overrides
Output:
- Complete DiagramSpec with DSL and render plan
3. diagram_render
Renders a diagram specification to SVG/PNG/PDF.
Input:
spec(required): DiagramSpec or raw DSL stringbackend(optional): Backend overrideoutput_formats(optional): Array of formats (svg, png, pdf)output_dir(optional): Output directory
Output:
- Paths to generated artifacts
4. diagram_pack_bundle
Packages multiple rendered figures into a structured bundle.
Input:
figures(required): Array of figure metadatacover_sheet(optional): Cover sheet settingsoutput_dir(optional): Bundle output directory
Output:
- Bundle directory path with index
Backend Selection Heuristics
| Figure Type | Primary Backend | Fallback | |-------------|----------------|----------| | Cross-section, layer stack | SVG Primitives | PlantUML | | Flowchart, workflow, method | Mermaid | DOT | | Block diagram, architecture | DOT | Mermaid | | Timing diagram | Mermaid sequence | SVG Primitives | | Network schematic | DOT | PlantUML |
Dependencies
Required
- Node.js 18+
Optional (for rendering)
mmdc(mermaid-cli) for Mermaid diagramsdot(Graphviz) for DOT diagramsplantumlCLI or JAR for PlantUML diagrams
If a renderer is not installed, the server will:
- Return the DSL/spec for external rendering
- Provide clear installation instructions
Patent Drawing Guidelines
- Monochrome: Black lines on white background
- Reference Numerals: Format as "Element Name (100)"
- Consistent Style: Same font and stroke width throughout
- Clear Labels: Legible at standard patent figure sizes
- No Gradients: Solid fills only
Documentation
- MCP Guidance - Detailed usage guide
- Tool Contracts - API specifications
- Example Workflow - Step-by-step examples
License
MIT
