APiGen MCP Server (Python)
MCP (Model Context Protocol) server for APiGen - enables AI assistants like Claude to generate API code directly from conversations.
Features
- Generate Projects: Create complete API projects from SQL schemas or OpenAPI specs
- Preview Code: See generated code before writing files
- Validate Schemas: Check configuration and schema files for errors
- Add Entities/Fields: Incrementally build your data model
- Create Migrations: Generate database migration files
Installation
Prerequisites
- Python 3.10+
- APiGen CLI - Build the CLI JAR
- Java 25+ - Required to run the CLI
Install MCP Server
bash
pip install apigen-mcpConfiguration
Claude Desktop
Add to your Claude Desktop config:
json
{
"mcpServers": {
"apigen": {
"command": "apigen-mcp",
"args": [
"--cli-path", "/path/to/apigen-cli.jar",
"--working-dir", "/path/to/your/project"
]
}
}
}Available Tools
| Tool | Description |
|---|---|
generate_project | Generate complete API from schema file |
generate_from_sql | Generate API from SQL content in conversation |
preview_code | Preview generated code without writing files |
preview_sql | Preview code from SQL content |
validate_schema | Validate project configuration |
init_project | Initialize new APiGen project |
add_entity | Add entity with fields and relations |
add_field | Add field to existing entity |
create_migration | Generate database migrations |
list_languages | List supported languages |
list_databases | List supported databases |
get_help | Get CLI help |
Usage Examples
Generate from SQL in Conversation
User: Generate a Java Spring API for this schema:
CREATE TABLE products (
id BIGINT PRIMARY KEY,
name VARCHAR(200) NOT NULL,
price DECIMAL(10,2)
);
Claude: [Uses generate_from_sql tool with the SQL content]Preview Before Generating
User: Show me what code would be generated for products table
Claude: [Uses preview_sql tool to show Entity, Repository, Service, Controller]