Simple guides introducing Fabrica with hands-on examples.
Detailed reference for running Fabrica as a local Model Context Protocol (MCP) server.
fabrica mcp starts a local MCP server over stdio so agents and editor integrations can inspect and modify Fabrica projects in a constrained workspace.
Key characteristics:
Content-Length headers (primary)--workspacedry_run and execute; mutating tools default to dry_runrecommended_next_calls in mutating tool resultsinvalid_argumentsDuring initialize, Fabrica follows the go-sdk negotiation policy:
Currently tested against:
2024-11-05 as a preserved supported version2025-11-25 as the current latest supported fallback versionfabrica mcp --workspace /path/to/workspace
| Flag | Type | Default | Description |
|---|---|---|---|
--workspace |
string | . |
Root directory allowed for all MCP operations |
initializenotifications/initializedresources/listresources/templates/listtools/listtools/callInspect a project and return key metadata:
project_name, module)Inputs:
project_path (optional, default .)Validate project structure and config consistency.
Inputs:
project_path (optional, default .)Returns:
status: ok, warning, or errorissues: machine-readable issue entries with severity, code, and messageCurrent checks include:
.fabrica.yaml or apis.yamlapis/<group>/<version>)apis.yaml and storage version type filesCreate a new Fabrica project.
Required inputs:
project_nameOptional inputs:
target_dir, module, descriptiongroup, storage_version, versionsauth, metrics, events, events_busreconcile, reconcile_workers, reconcile_requeuestorage_type, db, validation_modemode (dry_run or execute)Dry-run output includes planned_files and planned_steps.
Add a resource type file and update apis.yaml.
Required inputs:
resource_nameOptional inputs:
project_path, versionwith_validation, with_status, with_versioningpackage, forcemode (dry_run or execute)Dry-run output includes planned_files and planned_steps.
Replace the generated Spec and/or Status fields for a resource using structured field definitions.
Required inputs:
resource_nameOptional inputs:
project_path, versionspec_fields, status_fieldsmode (dry_run or execute)Each field object supports:
name (Go field name)type (Go type)json_namerequiredvalidationdescriptionDry-run output includes the resource file that would be updated.
Add a new API version and optionally copy type files from another version.
Required inputs:
new_versionOptional inputs:
project_path, from, forcemode (dry_run or execute)Dry-run output includes planned_files and planned_steps.
Run code generation for selected artifact groups.
Optional inputs:
project_pathartifacts (handlers, storage, client, openapi)force, debug, fabrica_sourcemode (dry_run or execute)Dry-run output includes predicted planned_files and planned_steps.
The response also separates existing generated artifacts into possible_files so agents can distinguish files that may already exist from files the selected generation mode intends to write.
Run go mod tidy in the target project.
Optional inputs:
project_pathmode (dry_run or execute)Dry-run output includes planned_files (go.mod, go.sum) and planned_steps.
Run go build for a Fabrica project.
Optional inputs:
project_pathpackages (default ["./..."])mode (dry_run or execute)Execute output includes command output and a status.
Run go test for a Fabrica project.
Optional inputs:
project_pathpackages (default ["./..."])mode (dry_run or execute)Execute output includes command output and a status.
Check generated API runtime endpoints.
Optional inputs:
project_pathbase_url (default http://localhost:8080)start_server (default false)server_arguments (default ["./cmd/server"])timeout_seconds (default 20)mode (dry_run or execute)When start_server is true, the tool runs go run temporarily, checks /health and /openapi.json, then stops the server.
Return exact MCP tool-call sequences for common API construction workflows.
Optional inputs:
goal: new_crud_api, add_resource, or verify_projectMutating tools support:
dry_run: return intended impact, no filesystem changesexecute: apply changesIf omitted, mode defaults to dry_run.
All tool paths are resolved relative to --workspace.
If an input path escapes the workspace root, the tool returns a structured error with code set to workspace_violation.
Tool failures are returned in tools/call results with:
isError: truestructuredContent.status: errorstructuredContent.error.codestructuredContent.error.messagestructuredContent.error.remediationCommon error codes:
invalid_argumentsworkspace_violationinvalid_workspacemissing_configmissing_apis_configinvalid_configinvalid_apis_configresource_discovery_failedcreate_service_failedadd_resource_failedadd_version_failedschema_update_failedgenerate_faileddependency_sync_failedbuild_project_failedtest_project_failedsmoke_start_failedsmoke_test_failedTypical agent workflow:
inspect_project to collect context.validate_project to detect drift or setup gaps.mode: dry_run first.planned_files and planned_steps.mode: execute.define_resource_schema to declare structured Spec/Status fields.generate_code, sync_dependencies, build_project, and test_project.smoke_test_api with start_server: true.Agents can also call describe_workflow first and follow the returned workflow entries directly.