duckdb-iceberg-mcp
Enables AI assistants to query Apache Iceberg tables on S3 via AWS Glue Data Catalog using DuckDB as the embedded query engine, supporting columnar Arrow reads with no data movement.
README
duckdb-iceberg-mcp
An MCP server that lets AI assistants query Apache Iceberg tables on S3 via AWS Glue Data Catalog. DuckDB is the embedded query engine — Apache Arrow columnar format, vectorized execution, direct S3 reads with no data movement.
Built on the official Python MCP SDK.
This MCP server is complementary to telemetry-iceberg-adaptor, which ingests telemetry data into Apache Iceberg. Use that project to write data and this project to query it through MCP-enabled AI clients.
Architecture
+----------------------+
| MCP Clients |
| - OpenAI Codex |
| - Claude Desktop |
| - OpenCode |
| - LibreChat |
+----------------------+
|
| MCP Protocol (tools/list · tools/call)
v
+--------------------------------------------------------------------------------------------+
| duckdb-iceberg-mcp |
| |
| +----------------------------------------------------------------------------------------+ |
| | MCP Protocol Layer | |
| | stdio · Streamable HTTP · SSE | |
| | JWT auth · write guard · row/char limits | |
| +----------------------------------------------------------------------------------------+ |
| <--> |
| +----------------------------------------------------------------------------------------+ |
| | ⚡ DuckDB | |
| | Apache Arrow columnar engine | |
| | Vectorized execution · Direct S3 reads | |
| | httpfs · iceberg · aws extensions | |
| +----------------------------------------------------------------------------------------+ |
+--------------------------------------------------------------------------------------------+
| |
| httpfs extension | boto3
| columnar Parquet reads | metadata · schema
| | Iceberg manifest resolution
v v
+--------------------------------------------------------------------------------------------+
| AWS |
| +-------------- Amazon S3 --------------+ +------------ AWS Glue Data Catalog ----------+ |
| | Apache Iceberg tables | | Databases · Tables · Schema | |
| | Parquet data files | | Iceberg metadata | |
| +---------------------------------------+ +---------------------------------------------+ |
+--------------------------------------------------------------------------------------------+
Features
- Query Iceberg tables on S3 via AWS Glue Data Catalog
- Three transports:
stdio, Streamable HTTP, SSE - Easy mode — single-tenant, optional static API key, no IdP required
- Full mode — JWT/JWKS token validation (Auth0, Cognito, Keycloak, Okta, …)
- Writes disabled by default; only available in full mode with explicit opt-in
- Configurable row and character limits to prevent runaway responses
Requirements
- Python 3.12+
- AWS credentials with access to Glue Data Catalog and S3
Installation
git clone <repo>
cd duckdb-iceberg-mcp
python -m venv .venv
source .venv/bin/activate
pip install -e .
Quick Start
stdio (local AI client)
Copy the example config and fill in your AWS details:
cp config/easy.env.example .env
# .env
MCP_MODE=easy
MCP_TRANSPORT=stdio
CATALOG_TYPE=glue
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
Run directly:
duckdb-iceberg-mcp
Or configure in your MCP client (Claude Desktop, OpenAI Codex):
{
"mcpServers": {
"duckdb-iceberg-mcp": {
"command": "/path/to/.venv/bin/duckdb-iceberg-mcp",
"env": {
"MCP_MODE": "easy",
"CATALOG_TYPE": "glue",
"AWS_REGION": "us-east-1",
"AWS_ACCESS_KEY_ID": "AKIA...",
"AWS_SECRET_ACCESS_KEY": "..."
}
}
}
}
Streamable HTTP (network clients, e.g. LibreChat in Docker)
MCP_MODE=easy
MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8766
MCP_ALLOWED_HOSTS=host.docker.internal:*,localhost:*
CATALOG_TYPE=glue
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
env $(grep -v '^#' .env | grep -v '^$' | xargs) .venv/bin/duckdb-iceberg-mcp
MCP client URL: http://localhost:8766/mcp
LibreChat (librechat.yaml):
mcpServers:
duckdb-iceberg-mcp:
type: streamable-http
url: 'http://host.docker.internal:8766/mcp'
timeout: 60000
initTimeout: 20000
OpenAI Codex: add via the Codex UI — Streamable HTTP, URL http://localhost:8766/mcp.
AWS Authentication
Configure credentials using one of these methods (key/secret takes priority if both are set):
| Method | Env vars |
|---|---|
| Explicit credentials | AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY |
| Named profile | AWS_PROFILE=my-profile |
| Default chain | Set neither — falls back to env vars, ~/.aws/credentials, instance role |
MCP Tools
list_tables(database?)
Lists Glue catalog tables. Optionally filter by database name.
describe_table(table_name)
Returns column names, types, and partition keys. Use database.table format.
glue_table(table_name)
Registers a Glue Iceberg table as a queryable DuckDB view. Required for tables where data files live outside the Glue-registered table root (a common layout with shared S3 prefixes).
glue_table('mydb.mytable')
→ Registered view 'mydb__mytable'. Query with: SELECT * FROM mydb__mytable
query_lakehouse(sql)
Executes a SQL query against registered views or direct S3 paths (read_parquet(), iceberg_scan()).
Configuration Reference
| Variable | Default | Description |
|---|---|---|
MCP_MODE |
easy |
easy or full |
MCP_TRANSPORT |
stdio |
stdio, http (Streamable HTTP), sse |
MCP_HOST |
127.0.0.1 |
Bind address for HTTP/SSE |
MCP_PORT |
8000 |
Port for HTTP/SSE |
MCP_ALLOWED_HOSTS |
(empty) | Comma-separated allowed Host headers (e.g. host.docker.internal:*,localhost:*). Empty = SDK default |
MCP_API_KEY |
(empty) | Static bearer token for easy mode HTTP. Empty = no auth |
JWKS_URL |
(required in full mode) | JWKS endpoint for JWT validation |
JWT_AUDIENCE |
duckdb-iceberg-mcp |
Expected aud claim in JWTs |
CATALOG_TYPE |
glue |
Only glue supported |
AWS_REGION |
us-east-1 |
AWS region |
AWS_PROFILE |
(empty) | Named AWS profile |
AWS_ACCESS_KEY_ID |
(empty) | AWS access key |
AWS_SECRET_ACCESS_KEY |
(empty) | AWS secret key |
WRITE_MODE |
disabled |
disabled or enabled. Always disabled in easy mode |
MAX_ROWS |
250 |
Maximum rows returned per query |
MAX_CHARS |
40000 |
Maximum characters in a query response |
Full Mode (JWT Auth)
Full mode validates a JWT bearer token on every request. All authenticated users share one DuckDB connection — per-user session isolation is deferred to a future release.
MCP_MODE=full
MCP_TRANSPORT=http
MCP_HOST=0.0.0.0
MCP_PORT=8766
JWKS_URL=https://your-idp.example.com/.well-known/jwks.json
JWT_AUDIENCE=duckdb-iceberg-mcp
AWS_REGION=us-east-1
AWS_ACCESS_KEY_ID=AKIA...
AWS_SECRET_ACCESS_KEY=...
The client passes a JWT as Authorization: Bearer <token>. The server validates it against the JWKS endpoint. Any IdP that issues standard JWTs works (Auth0, AWS Cognito, Keycloak, Okta).
See config/full.env.example for a full template.
Smoke Test
Run a quick end-to-end check against your real Glue catalog:
cp config/easy.env.example .env # fill in AWS credentials
.venv/bin/python scripts/smoke_test.py
Run Tests
pip install -e ".[dev]"
pytest
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。