Skip to content

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 ​

  1. Python 3.10+
  2. APiGen CLI - Build the CLI JAR
  3. Java 25+ - Required to run the CLI

Install MCP Server ​

bash
pip install apigen-mcp

Configuration ​

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 ​

ToolDescription
generate_projectGenerate complete API from schema file
generate_from_sqlGenerate API from SQL content in conversation
preview_codePreview generated code without writing files
preview_sqlPreview code from SQL content
validate_schemaValidate project configuration
init_projectInitialize new APiGen project
add_entityAdd entity with fields and relations
add_fieldAdd field to existing entity
create_migrationGenerate database migrations
list_languagesList supported languages
list_databasesList supported databases
get_helpGet 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]

Released under the MIT License.