A Model Context Protocol (MCP) server for Penrose - Create beautiful mathematical diagrams through natural language.
Overview
This MCP server provides tools and resources for creating mathematical diagrams using Penrose's domain-specific languages:
- Domain (DSL): Define mathematical types and relationships
- Substance: Describe mathematical objects and their relationships
- Style: Specify visual representation rules
Project Structure
.topos/
: Research materials and documentation (gitignored)
penrose-research/
: Design documents and specifications
mcp-examples/
: Reference MCP server implementations
mcp-spec/
: Official MCP protocol documentation
Development
Use the justfile to access documentation and reference materials:
# List all available commands
just --list
# View the server architecture
just architecture
# Access MCP specifications
just mcp-spec
License
MIT License - See LICENSE file for details
[
{
"description": "Create domain-specific language (DSL) definitions",
"inputSchema": {
"properties": {
"name": {
"description": "Domain name",
"type": "string"
},
"types": {
"items": {
"properties": {
"name": {
"description": "Type name",
"type": "string"
},
"predicates": {
"items": {
"properties": {
"args": {
"items": {
"type": "string"
},
"type": "array"
},
"name": {
"type": "string"
}
},
"required": [
"name",
"args"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"name"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"name",
"types"
],
"type": "object"
},
"name": "create_domain"
},
{
"description": "Define mathematical objects and relationships",
"inputSchema": {
"properties": {
"declarations": {
"items": {
"properties": {
"objects": {
"items": {
"type": "string"
},
"type": "array"
},
"type": {
"type": "string"
}
},
"required": [
"type",
"objects"
],
"type": "object"
},
"type": "array"
},
"domain": {
"description": "Reference to domain",
"type": "string"
},
"statements": {
"items": {
"properties": {
"args": {
"items": {
"type": "string"
},
"type": "array"
},
"predicate": {
"type": "string"
}
},
"required": [
"predicate",
"args"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"domain",
"declarations",
"statements"
],
"type": "object"
},
"name": "create_substance"
},
{
"description": "Define visual representation rules",
"inputSchema": {
"properties": {
"canvas": {
"properties": {
"height": {
"type": "number"
},
"width": {
"type": "number"
}
},
"required": [
"width",
"height"
],
"type": "object"
},
"rules": {
"items": {
"properties": {
"constraints": {
"items": {
"type": "string"
},
"type": "array"
},
"properties": {
"type": "object"
},
"selector": {
"type": "string"
}
},
"required": [
"selector",
"properties",
"constraints"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"canvas",
"rules"
],
"type": "object"
},
"name": "create_style"
},
{
"description": "Generate diagram from domain/substance/style",
"inputSchema": {
"properties": {
"domain": {
"type": "string"
},
"style": {
"type": "string"
},
"substance": {
"type": "string"
},
"variation": {
"type": "string"
}
},
"required": [
"domain",
"substance",
"style"
],
"type": "object"
},
"name": "generate_diagram"
}
]