Claude Code Plugin
flAPI ships a Claude Code plugin from its own repository. With it installed, Claude knows how to set up a flAPI project, write REST endpoints and MCP tools, design and tune DuckLake caches, and secure, test, deploy and operate a server. It checks its own edits against your config, and it can manage a running server through flAPI's MCP config tools.
Install
In Claude Code:
/plugin marketplace add DataZooDE/flapi
/plugin install flapi@flapi
The plugin needs the flapi server binary for validation and the flapii CLI for a running server. pip install flapi-io installs both.
To update it, run /plugin marketplace update flapi. The plugin version follows flAPI's release version (v26.11.25 at the time of writing), so use the plugin release that matches your server.
Skills
Claude loads a skill when your request matches it. You do not have to invoke one.
| Phase | Skill | Covers |
|---|---|---|
| Setup | flapi-setup | Installing, flapii project init, flapi.yaml, connections, the environment-variable whitelist, DuckDB extensions, validation |
| Develop | flapi-rest | Endpoint YAML, parameters and validators, Mustache SQL templates, pagination, write endpoints, YAML includes, rate limits |
| Develop | flapi-mcp | MCP tools, resources and prompts, descriptions an agent can act on, async tasks, one endpoint for REST and MCP, connecting clients |
| Develop | flapi-auth | Basic, bearer JWT, OIDC with provider presets, roles, MCP OAuth, the config-service token, CORS |
| Develop | flapi-cache-design | Full, append and merge caches, writing the populate SQL, cursors and watermarks, deletes, warm-up, write-through, replicas, prebuilt caches, time travel |
| Develop | flapi-cache-tuning | Measuring refresh time and cutting it down: predicate pushdown, incremental loads, schedules, inlining, compaction, retention |
| Develop | flapi-testing | Template expansion, --validate-config, Tavern REST tests, MCP tests, CI |
| Develop | flapi-live-config | The config service, flapii, the flapi_* MCP config tools, hot reload |
| Deploy | flapi-deploy | flapi pack single binaries, Docker, Cloud Run / serverless, secrets, offline extensions |
| Operate | flapi-operate | Health and readiness, runtime metrics, logs, tracing, cache operations, troubleshooting |
Slash commands
| Command | Does |
|---|---|
/flapi:init | Scaffolds a project from a description of your data, then validates and starts it |
/flapi:new-endpoint | Creates the YAML, SQL, validators, an optional MCP tool and a test, then tries them |
/flapi:add-cache | Picks a cache mode, writes the populate SQL, refreshes, measures and tunes |
/flapi:auth-setup | Configures authentication and roles, and proves the 401/403/200 paths with curl |
/flapi:deploy-check | Runs a pre-deployment checklist and builds the artifact |
/flapi:diagnose | Goes from an error to a root cause and a verified fix |
/flapi:metrics | Summarizes slow or failing endpoints, rejections and slow or stale caches |
MCP server entry
The plugin registers a flapi MCP server at $FLAPI_URL/mcp/jsonrpc (default http://localhost:8080), using Claude Code's HTTP transport. It sends two headers:
X-Config-Token: $FLAPI_CONFIG_SERVICE_TOKEN, for theflapi_*config tools;Authorization: Bearer $FLAPI_MCP_TOKEN, for a server withmcp.authon. WithFLAPI_MCP_TOKENunset the header is an emptyBearer, which a server withoutmcp.authignores.
Both variables default to empty, so the server entry registers even when neither is set. Claude then sees your endpoints as MCP tools. If the server runs with --config-service, Claude also sees the flapi_* config tools: it can list and edit endpoints, expand templates, refresh caches and read flapi_get_metrics. Every flapi_* call needs the config-service token. Endpoint changes show up in tools/list at once, without a restart.
export FLAPI_CONFIG_SERVICE_TOKEN=$(openssl rand -hex 32)
export FLAPI_MCP_TOKEN=... # only when mcp.auth is enabled
flapi -c flapi.yaml --config-service --config-service-token "$FLAPI_CONFIG_SERVICE_TOKEN"
# then start Claude Code in the same shell
For mcp.auth.type: bearer, FLAPI_MCP_TOKEN is an HS256 JWT signed with jwt-secret, with sub, an iss equal to jwt-issuer and a roles claim that matches the tools' allowed-roles; for type: oidc it is an access token from your identity provider. A server with type: basic needs an Authorization: Basic ... header, which the plugin entry cannot send: register that server yourself with claude mcp add --transport http ... --header "Authorization: Basic <base64 user:pass>" --header "X-Config-Token: $FLAPI_CONFIG_SERVICE_TOKEN".
Hook: validate, hot-reload, check
After Claude edits a .yaml, .yml or .sql file inside a flAPI project (a directory with a flapi.yaml in it or above it, or inside the template.path of the config FLAPI_CONFIG names), the plugin's hook:
- Validates: runs
flapi -c <flapi.yaml> --validate-config, ifflapiis onPATHorFLAPI_BINis set. Errors go back to Claude, which fixes them. - Reloads: if validation passed and
FLAPI_CONFIG_SERVICE_TOKENis set, reloads the edited endpoint file on the running server (POST /api/v1/_config/endpoints/reload-file). For a.sqlfile, every endpoint YAML that uses it is reloaded. A file that no longer loads is rejected with its reason, and the endpoint keeps its previous configuration. - Checks the templates without running them (
template/expand?validate_only=1): the serving template with no parameters and with a sample value for every typed field, and a cachetemplate-filewith the live watermark. Parse and bind errors (an unknown column, a typo inMERGE) go back to Claude.
Before it sends the token, the hook checks that the server at FLAPI_URL serves this project (its project-name and template.path); otherwise it sends nothing there. It does not reload into a packed binary, or into a server started before flapi.yaml changed its ducklake, auth or mcp settings. When a shell command deletes an endpoint YAML, the hook unloads the endpoints it declared. If something is missing (no binary, no project, no token, no server), the hook does nothing. It never blocks an edit.
| Variable | Default | Used by |
|---|---|---|
FLAPI_URL | http://localhost:8080 | MCP server, hook, flapii (when FLAPI_BASE_URL is unset) |
FLAPI_CONFIG_SERVICE_TOKEN | — | MCP server (X-Config-Token), hook, flapii |
FLAPI_MCP_TOKEN | — | MCP server (Authorization: Bearer, for mcp.auth) |
FLAPI_BIN | flapi on PATH | hook |
FLAPI_CONFIG | nearest flapi.yaml | hook |
Working on the plugin
The plugin lives in the flAPI repository under plugins/flapi/. To try local changes without installing:
claude --plugin-dir ./plugins/flapi
make check-skills checks every skill against the real code and binaries (config keys against the parser, flapi/flapii options against --help, cache template variables, the version stamp) and runs every tagged example through flapi --validate-config and a live server. CI runs the same check.
Related
- Claude Integration: Claude Desktop, Claude Code without the plugin, and the Anthropic SDK
- MCP Config Tools: the
flapi_*tool catalog docs/guides/claude-code.md: the upstream guide