经 AI Skill Hub 精选评估,flapi 获评「推荐使用」。这款MCP工具在功能完整性、社区活跃度和易用性方面表现出色,AI 评分 7.5 分,适合有一定技术背景的用户使用。
flapi 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
flapi 是一款遵循 MCP(Model Context Protocol)标准协议的 AI 工具扩展。通过 MCP 协议,它可以让 Claude、Cursor 等主流 AI 客户端直接访问和操作外部工具、数据源和服务,实现 AI 能力的无缝扩展。无论是文件操作、数据库查询还是 API 调用,都可以通过自然语言在 AI 对话中直接触发,极大提升生产效率。
# 方式一:通过 Claude Code CLI 一键安装
claude skill install https://github.com/DataZooDE/flapi
# 方式二:手动配置 claude_desktop_config.json
{
"mcpServers": {
"flapi": {
"command": "npx",
"args": ["-y", "flapi"]
}
}
}
# 配置文件位置
# macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
# Windows: %APPDATA%/Claude/claude_desktop_config.json
# 安装后在 Claude 对话中直接使用 # 示例: 用户: 请帮我用 flapi 执行以下任务... Claude: [自动调用 flapi MCP 工具处理请求] # 查看可用工具列表 # 在 Claude 中输入:"列出所有可用的 MCP 工具"
// claude_desktop_config.json 配置示例
{
"mcpServers": {
"flapi": {
"command": "npx",
"args": ["-y", "flapi"],
"env": {
// "API_KEY": "your-api-key-here"
}
}
}
}
// 保存后重启 Claude Desktop 生效
allowed-roles), shadow/dry-run (_dryRun: true), response shaping (max-rows / redact-columns / sample), per-tool rate limit, and a tool-description hygiene scanner for prompt-injection attempts{{ params.X }} references on int/double/boolean/date/time/uuid/enum/email/string fields are bound as DuckDB prepared statements — SQL injection is structurally impossible for those sitesflapii project init demos stay simpleflapi pack. scp flapi-prod user@host becomes the whole deploy. Reproducible (SOURCE_DATE_EPOCH), notarisable on macOS via a reserved Mach-O segment, with a secret deny list (*.env, secrets/*, *.pem, *.key) enforced at pack time.--no-telemetry flag, FLAPI_NO_TELEMETRY env var, or flapi.yamlurl-path (REST), mcp-tool (MCP tool), or mcp-resource (MCP resource)./flapi-prod info
The fastest way to try flAPI — no download, no Docker:
```bash
template: path: "{{env.CONFIG_DIR}}/sqls" ```
The same flapi binary that serves the API can fold an entire config tree into itself, producing one self-contained executable deployable via scp.
```bash
The source code of flAPI is written in C++ and closely resembles the DuckDB build process. A good documentation of the build process is the GitHub action in build.yaml. In essecence a few prerequisites need to be met: In essecence a few prerequisites need to be met:
sudo apt-get install -y build-essential cmake ninja-buildgit clone --recurse-submodules https://github.com/datazoode/flapi.gitmake releaseThe build process will download and build DuckDB v1.1.2 and install the vcpkg package manager. We depend on the following vcpkg ports:
argparse - Command line argument parsercrow - Our REST-Web framework and JSON handlingyaml-cpp - YAML parserjwt-cpp - JSON Web Token libraryopenssl - Crypto librarycatch2 - Testing frameworkNote: MCP support is built-in and doesn't require additional dependencies beyond what's already included.
The easiest way to get started with flAPI is to use the pre-built docker image.
> docker pull ghcr.io/datazoode/flapi:latest
The image is pretty small and mainly contains the flAPI binary which is statically linked against DuckDB v1.5.2. Details about the docker image can be found in the Dockerfile.
#### 2. Run flAPI: Once you have downloaded the binary, you can run flAPI by executing the following command:
> docker run -it --rm -p 8080:8080 -p 8081:8081 -v $(pwd)/examples/:/config ghcr.io/datazoode/flapi -c /config/flapi.yaml
The different arguments in this docker command are: - -it --rm: Run the container in interactive mode and remove it after the process has finished - -p 8080:8080: Exposes port 8080 of the container to the host, this makes the REST API available at http://localhost:8080 - -p 8081:8081: Exposes port 8081 for the MCP server (when enabled) - -v $(pwd)/examples/:/config: This mounts the local examples directory to the /config directory in the container, this is where the flAPI configuration file is expected to be found. - ghcr.io/datazoode/flapi: The docker image to use - -c /config/flapi.yaml: This is an argument to the flAPI application which tells it to use the flapi.yaml file in the /config directory as the configuration file.
#### 2.1 Enable MCP Support: To enable MCP support, you can either:
Option A: Use the command line flag
> docker run -it --rm -p 8080:8080 -p 8081:8081 -v $(pwd)/examples/:/config ghcr.io/datazoode/flapi -c /config/flapi.yaml --enable-mcp
Option B: Configure in flapi.yaml
mcp:
enabled: true
port: 8081
# ... other MCP configuration
#### 3.1 Test the API server: If everything is set up correctly, you should be able to access the API at the URL specified in the configuration file.
> curl 'http://localhost:8080/'
___
___( o)> Welcome to
\ <_. ) flAPI
`---'
Fast and Flexible API Framework
powered by DuckDB
#### 3.2 Get an overview of the available endpoints: The flAPI server creates embedded Swagger UI at which provides an overview of the available endpoints and allows you to test them. It can be found at
You should see the familiar Swagger UI page:

The raw yaml Swagger 2.0 is also available at http://localhost:8080/doc.yaml
#### 3.3 Test the MCP server: If MCP is enabled, you can test the MCP server as well:
```bash
mcp-resource: name: customer_schema description: Customer database schema definition mime-type: application/json
template-source: customer-schema.sql connection: [customers-parquet] ```
Here's a simple example of how to create an API endpoint using flAPI:
1) Configure DuckLake globally (alias is cache by default):
ducklake:
enabled: true
alias: cache
metadata-path: ./examples/data/cache.ducklake
data-path: ./examples/data/cache.ducklake
data-inlining-row-limit: 10 # Enable data inlining for small changes (optional)
retention:
max-snapshot-age: 14d
compaction:
enabled: false
scheduler:
enabled: true
2) Add cache block to your endpoint (no primary-key/cursor → full refresh):
url-path: /publicis
template-source: publicis.sql
connection: [bigquery-lakehouse]
cache:
enabled: true
table: publicis_cache
schema: analytics
schedule: 5m
retention:
max_snapshot_age: 14d
template_file: publicis/publicis_cache.sql
3) Write the cache SQL template (CTAS):
-- publicis/publicis_cache.sql
CREATE OR REPLACE TABLE {{cache.catalog}}.{{cache.schema}}.{{cache.table}} AS
SELECT
p.country,
p.product_category,
p.campaign_type,
p.channel,
sum(p.clicks) AS clicks
FROM bigquery_scan('{{{conn.project_id}}}.landing__publicis.kaercher_union_all') AS p
GROUP BY 1, 2, 3, 4;
4) Query from the cache in your main SQL:
-- publicis.sql
SELECT
p.country,
p.product_category,
p.campaign_type,
p.channel,
p.clicks
FROM {{cache.catalog}}.{{cache.schema}}.{{cache.table}} AS p
WHERE 1=1
Notes: - The cache schema (cache.analytics) is created automatically if missing. - Regular GET requests never refresh the cache. Refreshes happen on warmup, on schedule, or via the manual API. - Data Inlining: When data-inlining-row-limit is configured, small cache changes (≤ specified row limit) are written directly to DuckLake metadata instead of creating separate Parquet files. This improves performance for small incremental updates.
DuckLake supports writing very small inserts directly into the metadata catalog instead of creating a Parquet file for every micro-batch. This is called "Data Inlining" and can significantly speed up small, frequent updates.
ducklake block: ducklake:
enabled: true
alias: cache
metadata_path: ./examples/data/cache.ducklake
data_path: ./examples/data/cache.ducklake
data_inlining_row_limit: 10 # inline inserts up to 10 rows
data-inlining-row-limit are inlined into the catalog metadata.cache: -- Flush all inlined data in the catalog
CALL ducklake_flush_inlined_data('cache');
-- Flush only a specific schema
CALL ducklake_flush_inlined_data('cache', schema_name => 'analytics');
-- Flush only a specific table (default schema "main")
CALL ducklake_flush_inlined_data('cache', table_name => 'events_cache');
-- Flush a specific table in a specific schema
CALL ducklake_flush_inlined_data('cache', schema_name => 'analytics', table_name => 'events_cache');
data_inlining_row_limit, flAPI won’t enable inlining and DuckLake will use regular Parquet writes.Use these variables inside your cache templates and main queries:
{{cache.catalog}} → usually cache{{cache.schema}} → e.g., analytics (auto-created if missing){{cache.table}} → your cache table name{{params.cacheMode}} → full | append | merge{{cache.schedule}} → if set in YAML{{cache.snapshotId}}, {{cache.snapshotTimestamp}}{{cache.previousSnapshotId}}, {{cache.previousSnapshotTimestamp}}{{cache.cursorColumn}}, {{cache.cursorType}}{{cache.primaryKeys}} → comma-separated list, e.g., id,tenant_idAuthoring tips: - Full refresh: use CREATE OR REPLACE TABLE ... AS SELECT .... - Append: INSERT INTO cache.table SELECT ... WHERE event_time > previousSnapshotTimestamp. - Merge: MERGE INTO cache.table USING (SELECT ...) ON pk .... - Do not create schemas in templates; flAPI does that automatically.
MCP is now automatically enabled - no separate configuration needed! Every flAPI instance runs both REST API and MCP servers concurrently.
Configuration files can define multiple entity types:
```yaml
url-path: /customers/ # Makes this a REST endpoint mcp-tool: # Also makes this an MCP tool name: get_customers description: Retrieve customer information by ID result-mime-type: application/json
request: - field-name: id field-in: query description: Customer ID required: false validators: - type: int min: 1 max: 1000000 preventSqlInjection: true
template-source: customers.sql connection: [customers-parquet]
rate-limit: enabled: true max: 100 interval: 60
auth: enabled: true type: basic users: - username: admin password: secret roles: [admin]
#### MCP Resource Only
yaml
curl -X POST http://localhost:8081/mcp/jsonrpc \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list"}'
flAPI uses the popular YAML format to configure the API endpoints. A basic configuration file looks like this:
project_name: example-flapi-project
project_description: An example flAPI project demonstrating various configuration options
template:
path: './sqls' # The path where SQL templates and API endpoint configurations are stored
environment-whitelist: # Optional: List of regular expressions for whitelisting envvars which are available in the templates
- '^FLAPI_.*'
duckdb: # Configuration of the DuckDB embedded into flAPI
db_path: ./flapi_cache.db # Optional: remove or comment out for in-memory database, we use this store also as cache
access_mode: READ_WRITE # See the https://duckdb.org/docs/configuration/overview) for more details
threads: 8
max_memory: 8GB
default_order: DESC
connections: # A YAML map of database connection configurations, a API endpoint needs to reference one of these connections
bigquery-lakehouse:
# SQL commands to initialize the connection (e.g., e.g. installing, loading and configuring the BQ a DuckDB extension)
init: |
INSTALL 'bigquery' FROM 'http://storage.googleapis.com/hafenkran';
LOAD 'bigquery';
properties: # A YAML map of connection-specific properties (accessible in templates via {{ context.conn.property_name }})
project_id: 'my-project-id'
customers-parquet:
properties:
path: './data/customers.parquet'
heartbeat:
enabled: true # The eartbeat worker is a background thread which can can be used to periodically trigger endpionts
worker-interval: 10 # The interval in seconds at which the heartbeat worker will trigger endpoints
enforce-https:
enabled: false # Whether to force HTTPS for the API connections, we strongly recommend to use a reverse proxy to do SSL termination
# ssl-cert-file: './ssl/cert.pem'
# ssl-key-file: './ssl/key.pem'
After that ensure that the template path (./sqls in this example) exists.
After the creation of the YAML endpoint configuration we need to connect the SQL template which connects the enpoint to the data connection. The template files use the Mustache templating language to dynamically generate the SQL query.
SELECT * FROM '{{{conn.path}}}'
WHERE 1=1
{{#params.id}}
AND c_custkey = {{{ params.id }}}
{{/params.id}}
The above template uses the path parameter defined in the connection configuration to directly query a local parquet file. If the id parameter is provided, it will be used to filter the results.
flAPI extends plain YAML with lightweight include and environment-variable features so you can keep configurations modular and environment-aware.
- Write environment variables as {{env.VAR_NAME}} anywhere in your YAML. - Only variables that match the whitelist in your root config are substituted:
template:
path: './sqls'
environment-whitelist:
- '^FLAPI_.*' # allow all variables starting with FLAPI_
- '^PROJECT_.*' # optional additional prefixes
- If the whitelist is empty or omitted, all environment variables are allowed.
Examples: ```yaml
{{include from overrides/dev.yaml if env.FLAPI_ENV}}
{{include from {{env.CONFIG_DIR}}/secrets.yaml}} ```
Resolution rules and behavior: - Paths are resolved relative to the current file first; absolute paths are supported. - Includes inside YAML comments are ignored (e.g., lines starting with #). - Includes are expanded before the YAML is parsed. - Includes do not recurse: include directives within included files are not processed further. - Circular includes are guarded against within a single expansion pass; avoid cycles.
Tips: - Prefer section includes ({{include:...}}) to avoid unintentionally overwriting unrelated keys. - Keep shared blocks in small files (e.g., connections.yaml, auth.yaml) and include them where needed.
flapi pack --in ./examples --out flapi-prod
cd /tmp && ./flapi-prod
**How it works:** a ZIP archive is appended after the executable on
Linux/Windows (or written into a pre-allocated `__FLAPI/__bundle`
Mach-O segment on macOS, then re-`codesign`-ed so the result is
notarisable). At startup, flAPI reverse-scans for the bundle (or
probes the segment on macOS) and registers an
`EmbeddedArchiveFileProvider` plus an `embed://` DuckDB
filesystem so config / SQL templates / `read_csv()` calls all
resolve to the in-memory bundle. If no bundle is present
(unbundled binary, truncated tail), all paths fall back to the
local filesystem unchanged — existing operators see no behaviour
change.
**Secrets stay out of the bundle.** `flapi pack` refuses files
matching `*.env`, `secrets/*`, `*.pem`, `*.key` by default. The
override (`--allow-secrets`) is for testing only. Credentials
come from the environment at runtime (`AWS_*`, `GOOGLE_*`,
`AZURE_*`, `FLAPI_CONFIG_SERVICE_TOKEN`, `{{env.VAR}}` YAML
interpolation).
**Reproducible builds.** Set `SOURCE_DATE_EPOCH` before
`flapi pack` and the output is byte-identical across runs:
bash SOURCE_DATE_EPOCH=1700000000 flapi pack --in examples --out a SOURCE_DATE_EPOCH=1700000000 flapi pack --in examples --out b sha256sum a b # identical ```
12-factor env vars. FLAPI_CONFIG falls back for -c / --config; FLAPI_LOG_LEVEL falls back for --log-level. CLI flag wins over env var wins over built-in default. Invalid log levels exit non-zero with a single-line error.
macOS notes. The reserved-segment size is 16 MiB by default (knob FLAPI_RESERVED_BUNDLE_MIB at CMake configure time); oversized bundles exit non-zero with a corrective error. A --macos-append flag is available for local debugging — it uses the Linux/Windows append-after-EOF layout but the result is intentionally not notarisable.
See docs/CLI_REFERENCE.md §3 and docs/spec/DESIGN_DECISIONS.md §9 for full reference + rationale.
export FLAPI_NO_TELEMETRY=1 ./flapi
telemetry: enabled: false ```
See CLI Reference and Configuration Reference for full details.
flAPI is a powerful service that automatically generates read-only APIs for datasets by utilizing SQL templates. Built on top of DuckDB and leveraging its SQL engine and extension ecosystem, flAPI offers a seamless way to connect to various data sources and expose them as RESTful APIs.

uvx --from flapi-io flapi -c flapi.yaml
uvx --from flapi-io flapii
Or install permanently — one package gives you both commands:
bash pip install flapi-io # installs both "flapi" and "flapii" commands ```
Pre-built binaries and Docker images are also available — see below.
POST /mcp/jsonrpc - Main JSON-RPC endpoint for tool callsGET /mcp/health - Health check endpointEach endpoint is at least defined by a YAML file and a corresponding SQL template in the template path. For our example we will create the file ./sqls/customers.yaml:
url-path: /customers/ # The URL path at which the endpoint will be available
request: # The request configuration for the endpoint, this defines the parameters that can be used in the query
- field-name: id
field-in: query # The location of the parameter, other options are 'path', 'query' and 'body'
description: Customer ID # A description of the parameter, this is used in the auto-generated API documentation
required: false # Whether the parameter is required
validators: # A list of validators that will be applied to the parameter
- type: int
min: 1
max: 1000000
preventSqlInjection: true
template-source: customers.sql # The path to the SQL template that will be used to generate the endpoint
connection:
- customers-parquet # The connection that will be used to execute the query
rate-limit:
enabled: true # Whether rate limiting is enabled for the endpoint
max: 100 # The maximum number of requests per interval
interval: 60 # The interval in seconds
auth:
enabled: true # Whether authentication is enabled for the endpoint
type: basic # The type of authentication, other options are 'basic' and 'bearer'
users: # The users that are allowed to access the endpoint
- username: admin
password: secret
roles: [admin]
- username: user
password: password
roles: [read]
heartbeat:
enabled: true # Whether the heartbeat worker if enabled will trigger the endpoint periodically
params: # A YAML map of parameters that will be passed by the heartbeat worker to the endpoint
id: 123
There are many more configuration options available, see the full documentation for more details.
flAPI maintains an audit table inside DuckLake at cache.audit.sync_events and provides control endpoints:
- Manual refresh:
curl -X POST "http://localhost:8080/api/v1/_config/endpoints/publicis/cache/refresh"
- Audit logs (endpoint-specific and global):
curl "http://localhost:8080/api/v1/_config/endpoints/publicis/cache/audit"
curl "http://localhost:8080/api/v1/_config/cache/audit"
- Garbage collection (retention): Retention can be configured per endpoint under cache.retention:
cache:
retention:
max-snapshot-age: 7d # time-based retention
# keep-last-snapshots: 3 # version-based retention (subject to DuckLake support) The system applies retention after each refresh and you can also trigger GC manually: curl -X POST "http://localhost:8080/api/v1/_config/endpoints/publicis/cache/gc"
- Compaction: If enabled in global ducklake.scheduler, periodic file merging is performed via DuckLake ducklake_merge_adjacent_files.
./flapi --no-telemetry
cache.schema is set; flAPI will auto-create it.max-snapshot-age first. Version-based retention depends on DuckLake support.高性能API框架,依赖DuckDB
该工具使用 NOASSERTION 协议,商用场景请仔细阅读协议条款,必要时咨询法律意见。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
📄 NOASSERTION — 请查阅原始协议条款了解具体使用限制。
AI Skill Hub 点评:flapi 的核心功能完整,质量良好。对于Claude Desktop / Claude Code 用户来说,这是一个值得纳入个人工具库的选择。建议先在非生产环境试用,再逐步推广。
| 原始名称 | flapi |
| 原始描述 | 开源MCP工具:API Framework heavily relying on the power of DuckDB and DuckDB extensions. Read。⭐70 · C++ |
| Topics | apicppduckdbmcp |
| GitHub | https://github.com/DataZooDE/flapi |
| License | NOASSERTION |
| 语言 | C++ |
收录时间:2026-05-25 · 更新时间:2026-05-26 · License:NOASSERTION · AI Skill Hub 不对第三方内容的准确性作法律背书。
选择 Agent 类型,复制安装指令后粘贴到对应客户端