bonnard
Open-source agentic schema layer. Define metrics once in YAML, query governed data from any warehouse (Snowflake, BigQuery, Databricks, PostgreSQL, DuckDB) via MCP.
README
<p align="center"> <a href="https://www.bonnard.dev"> <picture> <source media="(prefers-color-scheme: dark)" srcset="./assets/banner-dark.png" /> <source media="(prefers-color-scheme: light)" srcset="./assets/banner-light.png" /> <img alt="Bonnard: agent-native analytics. One schema, many surfaces." src="./assets/banner-light.png" width="100%" /> </picture> </a> </p>
<p align="center"> <strong>Self-hosted semantic layer for AI agents.</strong> </p>
<p align="center"> <a href="https://github.com/bonnard-data/bonnard/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-Apache%202.0-blue?style=flat-square" alt="Apache 2.0 License" /></a> <a href="https://ghcr.io/bonnard-data/bonnard"><img src="https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white" alt="Docker" /></a> <a href="https://discord.com/invite/RQuvjGRz"><img src="https://img.shields.io/badge/Discord-Join%20us-5865F2?style=flat-square&logo=discord&logoColor=white" alt="Discord" /></a> </p>
<p align="center"> <a href="https://docs.bonnard.dev/docs/">Docs</a> · <a href="https://www.npmjs.com/package/@bonnard/cli">CLI</a> · <a href="https://discord.com/invite/RQuvjGRz">Discord</a> · <a href="https://www.bonnard.dev">Website</a> </p>
Bonnard is an agent-native semantic layer — one set of metric definitions, every consumer (AI agents, apps, dashboards) gets the same governed answer. This repo is the self-hosted Docker deployment: run Bonnard on your own infrastructure with no cloud account needed.
Quick Start
# 1. Scaffold project
npx @bonnard/cli init --self-hosted
# 2. Configure your data source
# Edit .env with your database credentials
# 3. Start the server
docker compose up -d
# 4. Define your semantic layer
# Add cube/view YAML files to bonnard/cubes/ and bonnard/views/
# 5. Deploy models to the server
bon deploy
# 6. Verify your semantic layer
bon schema
# 7. Connect AI agents
bon mcp
Requires Node.js 20+ and Docker.
What's Included
- MCP server — AI agents query your semantic layer over the Model Context Protocol
- Cube semantic layer — SQL-based metric definitions with caching, access control, and multi-database support
- Cube Store — pre-aggregation cache for fast analytical queries
- Admin UI — browse deployed models, views, and measures at
http://localhost:3000 - Deploy API — push model updates via
bon deploywithout restarting containers - Health endpoint —
GET /healthfor uptime monitoring
Connecting AI Agents
Run bon mcp to see connection config for your setup. Examples below.
Claude Desktop / Cursor
{
"mcpServers": {
"bonnard": {
"url": "https://bonnard.example.com/mcp",
"headers": {
"Authorization": "Bearer your-secret-token-here"
}
}
}
}
Claude Code
{
"mcpServers": {
"bonnard": {
"type": "url",
"url": "https://bonnard.example.com/mcp",
"headers": {
"Authorization": "Bearer your-secret-token-here"
}
}
}
}
CrewAI (Python)
from crewai import MCPServerAdapter
mcp = MCPServerAdapter(
url="https://bonnard.example.com/mcp",
transport="streamable-http",
headers={"Authorization": "Bearer your-secret-token-here"}
)
Production Deployment
Authentication
Protect your endpoints by setting ADMIN_TOKEN in .env:
ADMIN_TOKEN=your-secret-token-here
All API and MCP endpoints will require Authorization: Bearer <token>. The /health endpoint remains open for monitoring.
Restart after changing .env:
docker compose up -d
TLS with Caddy
Caddy provides automatic HTTPS via Let's Encrypt.
Create a Caddyfile next to your docker-compose.yml:
bonnard.example.com {
reverse_proxy localhost:3000
}
Add Caddy to your docker-compose.yml:
caddy:
image: caddy:2
ports:
- "80:80"
- "443:443"
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro
- caddy_data:/data
restart: unless-stopped
Add the volume at the top level:
volumes:
models: {}
caddy_data: {}
Then remove the Bonnard port mapping (ports: - "3000:3000") since Caddy handles external traffic.
Deploy to a VM
# Copy project files to your server
scp -r . user@your-server:~/bonnard/
# SSH in and start
ssh user@your-server
cd ~/bonnard
docker compose up -d
Configuration
| Variable | Description | Default |
|---|---|---|
CUBEJS_DB_TYPE |
Database driver (postgres, duckdb, snowflake, bigquery, databricks, redshift, clickhouse) |
duckdb |
CUBEJS_DB_* |
Database connection settings (host, port, name, user, pass) | — |
CUBEJS_DATASOURCES |
Comma-separated list for multi-datasource setups | default |
CUBEJS_API_SECRET |
HS256 secret for Cube JWT auth (auto-generated by bon init) |
— |
ADMIN_TOKEN |
Bearer token for API/MCP authentication | — (open) |
CUBE_PORT |
Cube API port | 4000 |
BONNARD_PORT |
Bonnard server port | 3000 |
CORS_ORIGIN |
Allowed CORS origins | * |
CUBE_VERSION |
Cube Docker image tag | v1.6 |
BONNARD_VERSION |
Bonnard Docker image tag | latest |
See .env.example for a full annotated configuration file.
Architecture
| Service | Image | Role |
|---|---|---|
cube |
cubejs/cube |
Semantic layer engine — executes queries against your warehouse |
cubestore |
cubejs/cubestore |
Pre-aggregation cache — stores materialized results for fast reads |
bonnard |
ghcr.io/bonnard-data/bonnard |
MCP server, admin UI, deploy API — the interface layer for agents and tools |
All three services communicate over an internal Docker network. Only bonnard (port 3000) and optionally cube (port 4000) are exposed externally.
Monitoring
# Health check
curl http://localhost:3000/health
# View logs
docker compose logs -f
# View active MCP sessions
curl -H "Authorization: Bearer <token>" http://localhost:3000/api/mcp/sessions
Deploying Schema Updates
From your development machine:
bon deploy
This pushes your cube/view YAML files to the running server. No restart needed — Cube picks up changes automatically.
Pinning Versions
Control image versions via .env:
CUBE_VERSION=v1.6
BONNARD_VERSION=latest
Supported Data Sources
Warehouses: Snowflake, Google BigQuery, Databricks, PostgreSQL (including Supabase, Neon, RDS), Amazon Redshift, DuckDB (including MotherDuck), ClickHouse
See the full documentation for connection guides.
Ecosystem
- @bonnard/cli — scaffold projects, deploy models, connect agents
- @bonnard/sdk — query the semantic layer from JavaScript/TypeScript
- @bonnard/react — React chart components and dashboard viewer
Community
- Discord: ask questions, share feedback, connect with the team
- GitHub Issues: bug reports and feature requests
- LinkedIn: follow for updates
- Website: learn more about Bonnard
License
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。