@bonnard/cli 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/bon.mjs +81 -0
- package/dist/docs/README.md +0 -4
- package/dist/docs/_index.md +1 -0
- package/dist/docs/topics/cubes.data-source.md +0 -4
- package/dist/docs/topics/cubes.dimensions.format.md +0 -4
- package/dist/docs/topics/cubes.dimensions.md +0 -4
- package/dist/docs/topics/cubes.dimensions.primary-key.md +0 -4
- package/dist/docs/topics/cubes.dimensions.sub-query.md +0 -4
- package/dist/docs/topics/cubes.dimensions.time.md +0 -4
- package/dist/docs/topics/cubes.dimensions.types.md +0 -4
- package/dist/docs/topics/cubes.extends.md +0 -4
- package/dist/docs/topics/cubes.hierarchies.md +0 -4
- package/dist/docs/topics/cubes.joins.md +0 -4
- package/dist/docs/topics/cubes.md +0 -4
- package/dist/docs/topics/cubes.measures.calculated.md +0 -4
- package/dist/docs/topics/cubes.measures.drill-members.md +0 -4
- package/dist/docs/topics/cubes.measures.filters.md +0 -4
- package/dist/docs/topics/cubes.measures.format.md +0 -4
- package/dist/docs/topics/cubes.measures.md +0 -4
- package/dist/docs/topics/cubes.measures.rolling.md +0 -4
- package/dist/docs/topics/cubes.measures.types.md +0 -4
- package/dist/docs/topics/cubes.public.md +0 -4
- package/dist/docs/topics/cubes.refresh-key.md +0 -4
- package/dist/docs/topics/cubes.segments.md +0 -4
- package/dist/docs/topics/cubes.sql.md +0 -4
- package/dist/docs/topics/pre-aggregations.md +0 -4
- package/dist/docs/topics/pre-aggregations.rollup.md +0 -4
- package/dist/docs/topics/syntax.context-variables.md +0 -4
- package/dist/docs/topics/syntax.md +0 -4
- package/dist/docs/topics/syntax.references.md +0 -4
- package/dist/docs/topics/views.cubes.md +0 -4
- package/dist/docs/topics/views.folders.md +0 -4
- package/dist/docs/topics/views.includes.md +0 -4
- package/dist/docs/topics/views.md +0 -4
- package/dist/docs/topics/workflow.deploy.md +0 -4
- package/dist/docs/topics/workflow.mcp.md +100 -0
- package/dist/docs/topics/workflow.md +0 -4
- package/dist/docs/topics/workflow.query.md +0 -5
- package/dist/docs/topics/workflow.validate.md +0 -4
- package/package.json +1 -1
package/dist/bin/bon.mjs
CHANGED
|
@@ -1979,6 +1979,10 @@ async function deployCommand(options = {}) {
|
|
|
1979
1979
|
console.log(pc.green("Deploy successful!"));
|
|
1980
1980
|
console.log(`Deployment ID: ${pc.cyan(response.deployment.id)}`);
|
|
1981
1981
|
console.log(`Cube API: ${pc.cyan(`${response.deployment.cubeApiUrl}/cubejs-api/v1`)}`);
|
|
1982
|
+
console.log();
|
|
1983
|
+
console.log(pc.bold("Connect AI agents via MCP:"));
|
|
1984
|
+
console.log(` MCP URL: ${pc.cyan("https://mcp.bonnard.dev/mcp")}`);
|
|
1985
|
+
console.log(pc.dim(` Run \`bon mcp\` for setup instructions`));
|
|
1982
1986
|
} catch (err) {
|
|
1983
1987
|
console.log(pc.red(`Deploy failed: ${err instanceof Error ? err.message : err}`));
|
|
1984
1988
|
process.exit(1);
|
|
@@ -2091,6 +2095,82 @@ async function testAndSyncDatasources(cwd, options = {}) {
|
|
|
2091
2095
|
return false;
|
|
2092
2096
|
}
|
|
2093
2097
|
|
|
2098
|
+
//#endregion
|
|
2099
|
+
//#region src/commands/mcp.ts
|
|
2100
|
+
const MCP_URL = "https://mcp.bonnard.dev/mcp";
|
|
2101
|
+
function mcpCommand() {
|
|
2102
|
+
console.log(pc.bold("MCP Connection Info"));
|
|
2103
|
+
console.log();
|
|
2104
|
+
console.log(`MCP URL: ${pc.cyan(MCP_URL)}`);
|
|
2105
|
+
console.log();
|
|
2106
|
+
console.log(pc.bold("Setup Instructions"));
|
|
2107
|
+
console.log();
|
|
2108
|
+
console.log(pc.underline("Claude Desktop"));
|
|
2109
|
+
console.log(`Add to ${pc.dim("~/Library/Application Support/Claude/claude_desktop_config.json")}:`);
|
|
2110
|
+
console.log();
|
|
2111
|
+
console.log(pc.dim(` {`));
|
|
2112
|
+
console.log(pc.dim(` "mcpServers": {`));
|
|
2113
|
+
console.log(pc.dim(` "bonnard": {`));
|
|
2114
|
+
console.log(pc.dim(` "url": "${MCP_URL}"`));
|
|
2115
|
+
console.log(pc.dim(` }`));
|
|
2116
|
+
console.log(pc.dim(` }`));
|
|
2117
|
+
console.log(pc.dim(` }`));
|
|
2118
|
+
console.log();
|
|
2119
|
+
console.log(pc.underline("Cursor"));
|
|
2120
|
+
console.log(`Add to ${pc.dim(".cursor/mcp.json")} in your project:`);
|
|
2121
|
+
console.log();
|
|
2122
|
+
console.log(pc.dim(` {`));
|
|
2123
|
+
console.log(pc.dim(` "mcpServers": {`));
|
|
2124
|
+
console.log(pc.dim(` "bonnard": {`));
|
|
2125
|
+
console.log(pc.dim(` "url": "${MCP_URL}"`));
|
|
2126
|
+
console.log(pc.dim(` }`));
|
|
2127
|
+
console.log(pc.dim(` }`));
|
|
2128
|
+
console.log(pc.dim(` }`));
|
|
2129
|
+
console.log();
|
|
2130
|
+
console.log(pc.underline("Claude Code"));
|
|
2131
|
+
console.log(`Add to ${pc.dim(".mcp.json")} in your project:`);
|
|
2132
|
+
console.log();
|
|
2133
|
+
console.log(pc.dim(` {`));
|
|
2134
|
+
console.log(pc.dim(` "mcpServers": {`));
|
|
2135
|
+
console.log(pc.dim(` "bonnard": {`));
|
|
2136
|
+
console.log(pc.dim(` "type": "url",`));
|
|
2137
|
+
console.log(pc.dim(` "url": "${MCP_URL}"`));
|
|
2138
|
+
console.log(pc.dim(` }`));
|
|
2139
|
+
console.log(pc.dim(` }`));
|
|
2140
|
+
console.log(pc.dim(` }`));
|
|
2141
|
+
console.log();
|
|
2142
|
+
console.log(pc.dim("OAuth authentication happens automatically when you first connect."));
|
|
2143
|
+
console.log(pc.dim("Run `bon mcp test` to verify the MCP server is reachable."));
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
//#endregion
|
|
2147
|
+
//#region src/commands/mcp-test.ts
|
|
2148
|
+
const MCP_SERVER_BASE = "https://mcp.bonnard.dev";
|
|
2149
|
+
async function mcpTestCommand() {
|
|
2150
|
+
console.log(pc.dim("Testing MCP server connection..."));
|
|
2151
|
+
console.log();
|
|
2152
|
+
const url = `${MCP_SERVER_BASE}/.well-known/oauth-authorization-server`;
|
|
2153
|
+
try {
|
|
2154
|
+
const res = await fetch(url);
|
|
2155
|
+
if (!res.ok) {
|
|
2156
|
+
console.log(pc.red(`✗ MCP server returned ${res.status}`));
|
|
2157
|
+
process.exit(1);
|
|
2158
|
+
}
|
|
2159
|
+
const metadata = await res.json();
|
|
2160
|
+
console.log(pc.green("✓ MCP server is reachable"));
|
|
2161
|
+
console.log();
|
|
2162
|
+
console.log(` Issuer: ${pc.dim(metadata.issuer || "unknown")}`);
|
|
2163
|
+
console.log(` Authorization: ${pc.dim(metadata.authorization_endpoint || "unknown")}`);
|
|
2164
|
+
console.log(` Token: ${pc.dim(metadata.token_endpoint || "unknown")}`);
|
|
2165
|
+
console.log(` Registration: ${pc.dim(metadata.registration_endpoint || "unknown")}`);
|
|
2166
|
+
console.log();
|
|
2167
|
+
console.log(pc.dim("OAuth endpoints are healthy. Agents can connect."));
|
|
2168
|
+
} catch (err) {
|
|
2169
|
+
console.log(pc.red(`✗ Failed to reach MCP server: ${err instanceof Error ? err.message : err}`));
|
|
2170
|
+
process.exit(1);
|
|
2171
|
+
}
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2094
2174
|
//#endregion
|
|
2095
2175
|
//#region src/commands/docs.ts
|
|
2096
2176
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -2332,6 +2412,7 @@ datasource.command("push").description("Push a local data source to Bonnard serv
|
|
|
2332
2412
|
program.command("preview").description("Preview data from a local warehouse using raw SQL (for development/exploration)").argument("<datasource>", "Data source name from .bon/datasources.yaml").argument("<sql>", "SQL query to execute").option("--schema <schema>", "Override schema").option("--database <database>", "Override database").option("--limit <limit>", "Max rows to return", "1000").option("--format <format>", "Output format: toon or json", "toon").action(previewCommand);
|
|
2333
2413
|
program.command("validate").description("Validate YAML syntax in models/ and views/").option("--test-connection", "Also test datasource connections (warns on failure, doesn't block)").action(validateCommand);
|
|
2334
2414
|
program.command("deploy").description("Deploy models to Bonnard. Requires login, validates models, tests connections (fails on error)").option("--ci", "Non-interactive mode (fail if missing datasources)").option("--push-datasources", "Auto-push missing datasources without prompting").action(deployCommand);
|
|
2415
|
+
program.command("mcp").description("MCP connection info and setup instructions").action(mcpCommand).command("test").description("Test MCP server connectivity").action(mcpTestCommand);
|
|
2335
2416
|
program.command("cube").description("Query the deployed Cube semantic layer").command("query").description("Execute a query against the deployed semantic layer").argument("<query>", "JSON query or SQL (with --sql flag)").option("--sql", "Use Cube SQL API instead of JSON format").option("--limit <limit>", "Max rows to return").option("--format <format>", "Output format: toon or json", "toon").action(cubeQueryCommand);
|
|
2336
2417
|
program.command("docs").description("Browse Cube documentation for building models and views").argument("[topic]", "Topic to display (e.g., cubes, cubes.measures)").option("-r, --recursive", "Show topic and all child topics").option("-s, --search <query>", "Search topics for a keyword").option("-f, --format <format>", "Output format: markdown or json", "markdown").action(docsCommand).command("schema").description("Show JSON schema for a type (cube, view, measure, etc.)").argument("<type>", "Schema type to display").action(docsSchemaCommand);
|
|
2337
2418
|
program.parse();
|
package/dist/docs/README.md
CHANGED
|
@@ -58,9 +58,6 @@ Short explanation (2-3 sentences).
|
|
|
58
58
|
- related.topic
|
|
59
59
|
- another.topic
|
|
60
60
|
|
|
61
|
-
## More Information
|
|
62
|
-
|
|
63
|
-
https://cube.dev/docs/...
|
|
64
61
|
```
|
|
65
62
|
|
|
66
63
|
## Guidelines
|
|
@@ -68,7 +65,6 @@ https://cube.dev/docs/...
|
|
|
68
65
|
- Keep topics concise (~20-40 lines)
|
|
69
66
|
- Lead with examples, not theory
|
|
70
67
|
- Use tables for property references
|
|
71
|
-
- Link to cube.dev for exhaustive details
|
|
72
68
|
- Include "See Also" for discoverability
|
|
73
69
|
|
|
74
70
|
## Commands
|
package/dist/docs/_index.md
CHANGED
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
- [workflow.validate](workflow.validate) - Validate models locally
|
|
59
59
|
- [workflow.deploy](workflow.deploy) - Deploy to Bonnard
|
|
60
60
|
- [workflow.query](workflow.query) - Query the deployed semantic layer
|
|
61
|
+
- [workflow.mcp](workflow.mcp) - Connect AI agents via MCP
|
|
61
62
|
|
|
62
63
|
## Quick Reference
|
|
63
64
|
|
|
@@ -193,7 +193,3 @@ Format support varies by visualization tool. Most tools recognize common formats
|
|
|
193
193
|
- cubes.dimensions
|
|
194
194
|
- cubes.dimensions.types
|
|
195
195
|
- cubes.measures.format
|
|
196
|
-
|
|
197
|
-
## More Information
|
|
198
|
-
|
|
199
|
-
https://cube.dev/docs/reference/data-model/types-and-formats#format
|
|
@@ -151,7 +151,3 @@ Format support varies by visualization tool. Most tools recognize `percent` and
|
|
|
151
151
|
- cubes.measures
|
|
152
152
|
- cubes.measures.types
|
|
153
153
|
- cubes.dimensions.format
|
|
154
|
-
|
|
155
|
-
## More Information
|
|
156
|
-
|
|
157
|
-
https://cube.dev/docs/reference/data-model/types-and-formats#format
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# workflow.mcp
|
|
2
|
+
|
|
3
|
+
> Connect AI agents to your semantic layer via MCP.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
After deploying models with `bon deploy`, AI agents (Claude, Cursor, etc.) can query your semantic layer through the Model Context Protocol (MCP). Bonnard's MCP server provides tools for querying cubes and views using natural language.
|
|
8
|
+
|
|
9
|
+
## MCP URL
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
https://mcp.bonnard.dev/mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
### Claude Desktop
|
|
18
|
+
|
|
19
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
{
|
|
23
|
+
"mcpServers": {
|
|
24
|
+
"bonnard": {
|
|
25
|
+
"url": "https://mcp.bonnard.dev/mcp"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Cursor
|
|
32
|
+
|
|
33
|
+
Add to `.cursor/mcp.json` in your project:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"bonnard": {
|
|
39
|
+
"url": "https://mcp.bonnard.dev/mcp"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Claude Code
|
|
46
|
+
|
|
47
|
+
Add to `.mcp.json` in your project:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"bonnard": {
|
|
53
|
+
"type": "url",
|
|
54
|
+
"url": "https://mcp.bonnard.dev/mcp"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Authentication
|
|
61
|
+
|
|
62
|
+
MCP uses OAuth 2.0 with PKCE. When an agent first connects:
|
|
63
|
+
|
|
64
|
+
1. Agent discovers OAuth endpoints via `/.well-known/oauth-authorization-server`
|
|
65
|
+
2. Agent registers as an OAuth client
|
|
66
|
+
3. User is redirected to Bonnard to sign in and authorize
|
|
67
|
+
4. Agent receives an access token (valid for 7 days)
|
|
68
|
+
5. Token persists across server restarts
|
|
69
|
+
|
|
70
|
+
No API keys or manual token management needed.
|
|
71
|
+
|
|
72
|
+
## Testing
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Verify the MCP server is reachable
|
|
76
|
+
bon mcp test
|
|
77
|
+
|
|
78
|
+
# View connection info and config snippets
|
|
79
|
+
bon mcp
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Available Tools
|
|
83
|
+
|
|
84
|
+
Once connected, AI agents can use these MCP tools:
|
|
85
|
+
|
|
86
|
+
| Tool | Description |
|
|
87
|
+
|------|-------------|
|
|
88
|
+
| `query` | Execute a Cube query (measures, dimensions, filters) |
|
|
89
|
+
| `sql_query` | Execute a SQL query via Cube SQL API |
|
|
90
|
+
| `list_cubes` | List available cubes and their members |
|
|
91
|
+
| `list_views` | List available views and their members |
|
|
92
|
+
|
|
93
|
+
## Managing Connections
|
|
94
|
+
|
|
95
|
+
Active MCP connections can be viewed and revoked in the Bonnard dashboard at **Settings > Connections**.
|
|
96
|
+
|
|
97
|
+
## See Also
|
|
98
|
+
|
|
99
|
+
- workflow.deploy
|
|
100
|
+
- workflow.query
|
|
@@ -196,8 +196,3 @@ bon cube query '{
|
|
|
196
196
|
- [cubes.measures](cubes.measures) - Define measures
|
|
197
197
|
- [cubes.dimensions](cubes.dimensions) - Define dimensions
|
|
198
198
|
- [views](views) - Create focused query interfaces
|
|
199
|
-
|
|
200
|
-
## More Information
|
|
201
|
-
|
|
202
|
-
- [Cube REST API Query Format](https://cube.dev/docs/product/apis-integrations/rest-api/query-format)
|
|
203
|
-
- [Cube SQL API Query Format](https://cube.dev/docs/product/apis-integrations/sql-api/query-format)
|