Skip to main content
Glama
SevenDeadlyCommits

FastAPI Scaffolder MCP Server

FastAPI Scaffolder

FastAPI Scaffolder is a developer tool and AI system agent that transforms human- and machine-readable YAML architecture specifications into production-ready FastAPI applications.

It provides both a CLI interface for humans and a Model Context Protocol (MCP) server for AI agents (Gemini, Claude Desktop, Cursor, Windsurf, LangChain) to generate modular APIs instantly.


Capabilities

  • Dual Interface: Native CLI for developers and a zero-dependency JSON-RPC 2.0 MCP server for AI models.

  • Declarative Schemas: Define microservices, endpoints, HTTP methods, Pydantic request/response payloads, and service dependencies in single or split YAML files.

  • Modular Generation: Renders complete project structures complete with typed Pydantic models, FastAPI routers, configuration, dependency wiring, and test suites.

  • Python 3.14 Ready: Built natively without third-party wrapper bottlenecks or SDK version locks.


Related MCP server: MCP Server Template

Installation

Prerequisites

  • Python >= 3.10 (Tested up to 3.14)

  • uv or pip

Install Locally (Editable Mode)

# Clone and enter directory
cd fastapi-scaffolder

# Install with CLI and MCP entry points
pip install -e .

This registers two global commands in your active virtual environment:

  • scaffold — Human-facing CLI tool

  • scaffold-mcp — Executable stdio MCP server for AI clients


Schema Specification (architecture.yaml)

Define your API architecture using standard YAML:

system_name: PaymentInvoicingPlatform
version: 1.0.0

services:
  - name: AuthService
    description: Handles user authentication and tokens
    dependencies: []
    endpoints:
      - path: /auth/login
        method: POST
        summary: Authenticate user
        request_body:
          - name: email
            type: str
          - name: password
            type: str
        response_body:
          - name: access_token
            type: str

  - name: InvoiceService
    description: Manages client invoices
    dependencies:
      - AuthService
    endpoints:
      - path: /invoices
        method: POST
        summary: Create client invoice
        request_body:
          - name: client_email
            type: str
          - name: amount
            type: float
        response_body:
          - name: invoice_id
            type: str
          - name: status
            type: str

Usage Guide

1. Human CLI Usage

Scaffold an app directly from the terminal using the scaffold command:

# Generate app from YAML spec
scaffold -i architecture.yaml -o ./my_fastapi_app

# Combine multiple service specs
scaffold -i auth_service.yaml billing_service.yaml -o ./monorepo_app

2. AI Setup with Model Context Protocol (MCP)

scaffold-mcp communicates over Standard Input/Output (stdio) via JSON-RPC 2.0.

Cursor / Claude Desktop / Windsurf Setup

Add fastapi-scaffolder to your MCP configuration file (claude_desktop_config.json or Cursor MCP settings):

{
  "mcpServers": {
    "fastapi-scaffolder": {
      "command": "/path/to/your/venv/bin/scaffold-mcp",
      "args": []
    }
  }
}

Replace /path/to/your/venv/bin/scaffold-mcp with the absolute path returned by which scaffold-mcp.

System Prompt Directive for AI Agents

Add this instruction to your LLM system prompt so it outputs compliant YAML to invoke the tool:

FastAPI Scaffolder Schema Directive:

When generating an API, output a YAML string structured as follows:

system_name: MySystem
version: 1.0.0
services:
  - name: ServiceName
    description: Summary of responsibility
    dependencies: []
    endpoints:
      - path: /items/{id}
        method: GET
        summary: retrieve item
        response_body:
          - name: id
            type: str

Pass this raw YAML string to the build_fastapi_app tool with output_directory.


3. Usage with Google Gemini SDK

To run fastapi-scaffolder inside Gemini agent workflows:

from google import genai
from google.genai import types
from scaffolder.mcp_server import execute_scaffold

client = genai.Client()

# Pass the tool execution function to Gemini
response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="Design a user profile microservice in YAML and build the code in ./user_service",
    config=types.GenerateContentConfig(
        tools=[execute_scaffold]
    )
)

# Execute the returned function call
if response.function_calls:
    for call in response.function_calls:
        if call.name == "execute_scaffold":
            result = execute_scaffold(call.args)
            print(result)

Testing the MCP Server Manually

Verify that the MCP server starts and receives messages via stdio:

# Run server executable
scaffold-mcp

Paste this test payload into stdout and press Enter:

{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}

Expected Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "build_fastapi_app",
        "description": "Scaffolds a complete FastAPI codebase from a YAML architecture definition.",
        "inputSchema": {
          "type": "object",
          "properties": {
            "yaml_spec": {
              "type": "string",
              "description": "Raw YAML string matching the SystemArchitecture schema."
            },
            "output_directory": {
              "type": "string",
              "description": "Output directory path for generated files.",
              "default": "./generated_app"
            }
          },
          "required": ["yaml_spec"]
        }
      }
    ]
  }
}

Available Tools

1 tool
build_fastapi_appB

Scaffolds a complete FastAPI codebase from a YAML architecture definition.

ParametersJSON Schema
NameRequiredDescriptionDefault
yaml_specYesRaw YAML string matching the SystemArchitecture schema.
output_directoryNoOutput directory path for generated files../generated_app

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

There are no annotations, so the description carries the full burden for behavioral transparency. It mentions scaffolding a codebase, which implies side effects, but it does not disclose whether the tool overwrites existing files in the output directory, requires network access, validates the YAML, or has any other side effects. This is a significant gap for a code generation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence (10 words) that front-loads the key action and outcome. Every word earns its place, with no redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool that creates a complete codebase, the description is too thin. It lacks critical context such as whether the output directory will be created or overwritten, what the generated code includes, error behaviors, or prerequisites. The schema covers parameters but not the tool's overall behavior, making the description insufficient for a complex operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters having descriptive text in the schema. The description adds minimal meaning beyond that, only restating that the YAML is an architecture definition. It does not explain the SystemArchitecture schema or clarify any subtle behaviors, so the baseline of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's function with a specific verb 'scaffolds' and a specific resource ('complete FastAPI codebase') and input ('YAML architecture definition'). It is not a tautology and gives a clear purpose, though there are no sibling tools to differentiate from, so it doesn't mention alternatives.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: use this when you have a YAML architecture definition and want a FastAPI codebase. However, it provides no explicit when-to-use guidance, no exclusions, and no alternative tools to consider, so it only meets the baseline for implied usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev0.1.0
    • First observedbuild_fastapi_app

TDQS

A3.6/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap. The tool has a distinct and singular purpose.

Naming Consistency5/5

The single tool name 'build_fastapi_app' follows a clear verb_noun pattern, and consistency is trivially maintained with only one tool.

Tool Count3/5

A single tool feels thin for a server, but it is borderline appropriate given the narrow, focused purpose of scaffolding FastAPI apps from YAML definitions.

Completeness5/5

The tool fully covers the stated domain of scaffolding a complete FastAPI codebase. There are no obvious missing operations for the intended workflow.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    Enables AI coding agents to generate standardized code using scaffolding templates, enforce architectural patterns, and validate outputs programmatically. Supports creating projects from boilerplates and adding features to existing codebases while maintaining team conventions.
    161
    AGPL 3.0
  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    A scaffold project for building FastAPI-based Model Context Protocol servers with automatic tool discovery and router capabilities.
    -
  • F
    license
    B
    quality
    D
    maintenance
    A specialized toolchain that guides AI agents through a structured 'Atomic Development' workflow for building Python FastAPI and Supabase backends. It manages project scaffolding and enforces dependency-ordered generation of database models, API routes, and tests.
    9
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A production-ready Python scaffold for building Model Context Protocol (MCP) servers using FastMCP. It provides a structured framework for developers and AI agents to rapidly develop, test, and manage custom tools and workflows.
    1
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SevenDeadlyCommits/fast_api_scaffolder'

If you have feedback or need assistance with the MCP directory API, please join our Discord server