RIDDL MCP Server¶
The RIDDL MCP (Model Context Protocol) server provides AI assistants with RIDDL language intelligence. It enables AI-assisted authoring of RIDDL specifications by giving language models access to parsing, validation, and context-aware generation capabilities.
Overview¶
The MCP server acts as a bridge between AI assistants and the RIDDL compiler. When an AI assistant needs to work with RIDDL, it can:
- Parse RIDDL specifications to understand their structure
- Validate models for syntax and semantic correctness
- Generate new RIDDL definitions based on context and descriptions
- Complete partial specifications with appropriate syntax
This enables workflows where domain experts describe what they want in natural language, and AI assistants translate those descriptions into valid RIDDL.
Setup¶
Prerequisites¶
- Docker Desktop installed and running
- macOS, Linux, or Windows with WSL2
Building the Docker Image¶
# Clone the repository
git clone https://github.com/ossuminc/riddl-mcp-server.git
cd riddl-mcp-server
# Build the Docker image
sbt Docker/publishLocal
Running the Server¶
- Open Docker Desktop Dashboard
- Find the
riddl-mcp-serverimage - Click Run → expand Optional Settings
- Set Host port to
8080 - Click Run
Alternatively, from the command line:
Verifying the Server¶
Check the server is running:
Authentication¶
The server requires API key authentication. Three methods are supported:
1. X-API-KEY Header (Recommended)¶
2. Query Parameter¶
Useful for clients that don't support custom headers:
3. Bearer Token¶
Standard Authorization header:
Configuring API Keys¶
API keys are configured via environment variables when running the container:
API Endpoints¶
Health Check¶
Returns server status. No authentication required.
Response:
Validate¶
Validates a RIDDL specification.
Request Body:
Response:
Or with errors:
{
"valid": false,
"messages": [
{
"severity": "error",
"message": "Undefined reference: Customer",
"location": {"line": 42, "column": 12}
}
]
}
Parse¶
Parses RIDDL and returns the abstract syntax tree.
Request Body:
Generate¶
Generates RIDDL definitions based on description and context.
Request Body:
{
"description": "An entity that tracks customer orders with status",
"context": "domain ECommerce { context OrderManagement { } }",
"type": "entity"
}
Integration with AI Assistants¶
Claude Desktop¶
Add to your Claude Desktop MCP configuration:
{
"mcpServers": {
"riddl": {
"url": "http://localhost:8080",
"headers": {
"X-API-KEY": "your-api-key"
}
}
}
}
IntelliJ AI Assistant¶
Configure in IntelliJ IDEA settings:
- Go to Settings → Tools → AI Assistant
- Add MCP server with URL:
http://localhost:8080?api_key=your-api-key
See the RIDDL IDEA Plugin for additional integration features.
Other MCP Clients¶
Any MCP-compatible client can connect using:
- Server URL:
http://localhost:8080 - Authentication: API key via header, query param, or bearer token
Usage Example¶
The typical workflow for AI-assisted RIDDL authoring:
- Author describes what they want in natural language
- AI sends the description to the MCP server's generate endpoint
- Server returns valid RIDDL syntax
- AI presents the generated RIDDL to the author
- Author refines the description if needed
- AI validates the final specification
Example conversation:
Author: I need an entity to track user sessions with login time, last activity, and expiration.
AI: Here's the generated entity:
Command Line Usage¶
The server includes a bridge script for command-line validation:
# Validate a RIDDL file from GitHub
./src/main/scripts/riddl-mcp-bridge.sh \
"https://raw.githubusercontent.com/org/repo/main/model.riddl"
The URL should be a GitHub "raw" content URL in the format:
Configuration¶
Environment variables for the Docker container:
| Variable | Description | Default |
|---|---|---|
API_KEYS |
Comma-separated list of valid API keys | (none) |
PORT |
Server port | 8080 |
LOG_LEVEL |
Logging verbosity (debug, info, warn, error) | info |
Troubleshooting¶
Server Not Starting¶
- Check Docker Desktop is running
- Verify port 8080 is not in use:
lsof -i :8080 - Check container logs in Docker Desktop
Authentication Errors (401)¶
- Verify your API key is correct
- Check the authentication method matches server configuration
- For IntelliJ, use query parameter:
?api_key=your-key
Validation Timeouts¶
For large RIDDL specifications:
- Increase Docker container memory limits
- Consider validating smaller portions
- Check network connectivity to GitHub for URL-based validation
Resources¶
- GitHub Repository
- MCP Protocol Specification
- Author's Guide - AI-assisted authoring workflow
- RIDDL Language Reference