@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.
Files changed (40) hide show
  1. package/dist/bin/bon.mjs +81 -0
  2. package/dist/docs/README.md +0 -4
  3. package/dist/docs/_index.md +1 -0
  4. package/dist/docs/topics/cubes.data-source.md +0 -4
  5. package/dist/docs/topics/cubes.dimensions.format.md +0 -4
  6. package/dist/docs/topics/cubes.dimensions.md +0 -4
  7. package/dist/docs/topics/cubes.dimensions.primary-key.md +0 -4
  8. package/dist/docs/topics/cubes.dimensions.sub-query.md +0 -4
  9. package/dist/docs/topics/cubes.dimensions.time.md +0 -4
  10. package/dist/docs/topics/cubes.dimensions.types.md +0 -4
  11. package/dist/docs/topics/cubes.extends.md +0 -4
  12. package/dist/docs/topics/cubes.hierarchies.md +0 -4
  13. package/dist/docs/topics/cubes.joins.md +0 -4
  14. package/dist/docs/topics/cubes.md +0 -4
  15. package/dist/docs/topics/cubes.measures.calculated.md +0 -4
  16. package/dist/docs/topics/cubes.measures.drill-members.md +0 -4
  17. package/dist/docs/topics/cubes.measures.filters.md +0 -4
  18. package/dist/docs/topics/cubes.measures.format.md +0 -4
  19. package/dist/docs/topics/cubes.measures.md +0 -4
  20. package/dist/docs/topics/cubes.measures.rolling.md +0 -4
  21. package/dist/docs/topics/cubes.measures.types.md +0 -4
  22. package/dist/docs/topics/cubes.public.md +0 -4
  23. package/dist/docs/topics/cubes.refresh-key.md +0 -4
  24. package/dist/docs/topics/cubes.segments.md +0 -4
  25. package/dist/docs/topics/cubes.sql.md +0 -4
  26. package/dist/docs/topics/pre-aggregations.md +0 -4
  27. package/dist/docs/topics/pre-aggregations.rollup.md +0 -4
  28. package/dist/docs/topics/syntax.context-variables.md +0 -4
  29. package/dist/docs/topics/syntax.md +0 -4
  30. package/dist/docs/topics/syntax.references.md +0 -4
  31. package/dist/docs/topics/views.cubes.md +0 -4
  32. package/dist/docs/topics/views.folders.md +0 -4
  33. package/dist/docs/topics/views.includes.md +0 -4
  34. package/dist/docs/topics/views.md +0 -4
  35. package/dist/docs/topics/workflow.deploy.md +0 -4
  36. package/dist/docs/topics/workflow.mcp.md +100 -0
  37. package/dist/docs/topics/workflow.md +0 -4
  38. package/dist/docs/topics/workflow.query.md +0 -5
  39. package/dist/docs/topics/workflow.validate.md +0 -4
  40. 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();
@@ -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
@@ -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
 
@@ -90,7 +90,3 @@ Cubes from different data sources cannot be directly joined. Use views or pre-ag
90
90
  - cubes
91
91
  - cubes.sql
92
92
  - workflow.deploy
93
-
94
- ## More Information
95
-
96
- https://cube.dev/docs/reference/data-model/cube#data-source
@@ -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
@@ -182,7 +182,3 @@ Create derived attributes:
182
182
  - cubes.dimensions.primary-key
183
183
  - cubes.dimensions.time
184
184
  - cubes.joins
185
-
186
- ## More Information
187
-
188
- https://cube.dev/docs/reference/data-model/dimensions
@@ -104,7 +104,3 @@ Primary keys determine how pre-aggregations handle duplicates.
104
104
  - cubes.dimensions
105
105
  - cubes.dimensions.types
106
106
  - cubes.joins
107
-
108
- ## More Information
109
-
110
- https://cube.dev/docs/reference/data-model/dimensions#primary-key
@@ -172,7 +172,3 @@ dimensions:
172
172
  - cubes.dimensions
173
173
  - cubes.joins
174
174
  - cubes.measures
175
-
176
- ## More Information
177
-
178
- https://cube.dev/docs/product/data-modeling/concepts/calculated-members#subquery-dimensions
@@ -109,7 +109,3 @@ For consistent timezone handling, convert in SQL:
109
109
  - cubes.dimensions
110
110
  - cubes.dimensions.types
111
111
  - cubes.measures.rolling
112
-
113
- ## More Information
114
-
115
- https://cube.dev/docs/reference/data-model/dimensions#time-dimensions
@@ -105,7 +105,3 @@ Dimension with predefined set of values.
105
105
  - cubes.dimensions
106
106
  - cubes.dimensions.primary-key
107
107
  - cubes.dimensions.time
108
-
109
- ## More Information
110
-
111
- https://cube.dev/docs/reference/data-model/types-and-formats#dimension-types
@@ -147,7 +147,3 @@ cubes:
147
147
  - cubes
148
148
  - syntax.references
149
149
  - syntax.context-variables
150
-
151
- ## More Information
152
-
153
- https://cube.dev/docs/product/data-modeling/concepts/code-reusability-extending-cubes
@@ -172,7 +172,3 @@ Hierarchy support varies by visualization tool. Check your specific tool's docum
172
172
  - cubes.dimensions
173
173
  - cubes.joins
174
174
  - views.folders
175
-
176
- ## More Information
177
-
178
- https://cube.dev/docs/reference/data-model/hierarchies
@@ -113,7 +113,3 @@ cubes:
113
113
  - cubes
114
114
  - cubes.dimensions.primary-key
115
115
  - views
116
-
117
- ## More Information
118
-
119
- https://cube.dev/docs/reference/data-model/joins
@@ -115,7 +115,3 @@ models/
115
115
  - cubes.dimensions
116
116
  - cubes.joins
117
117
  - cubes.segments
118
-
119
- ## More Information
120
-
121
- https://cube.dev/docs/reference/data-model/cube
@@ -97,7 +97,3 @@ Always use `NULLIF` to prevent division by zero:
97
97
  - cubes.measures
98
98
  - cubes.measures.types
99
99
  - cubes.measures.rolling
100
-
101
- ## More Information
102
-
103
- https://cube.dev/docs/reference/data-model/measures#calculated-measures
@@ -156,7 +156,3 @@ Drill-down support varies by visualization tool. Check your specific tool's docu
156
156
  - cubes.measures
157
157
  - cubes.dimensions
158
158
  - cubes.joins
159
-
160
- ## More Information
161
-
162
- https://cube.dev/docs/reference/data-model/measures#drill-members
@@ -84,7 +84,3 @@ measures:
84
84
  - cubes.measures
85
85
  - cubes.measures.calculated
86
86
  - cubes.segments
87
-
88
- ## More Information
89
-
90
- https://cube.dev/docs/reference/data-model/measures#filters
@@ -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
@@ -160,7 +160,3 @@ Calculate metrics over time windows:
160
160
  - cubes.measures.filters
161
161
  - cubes.measures.calculated
162
162
  - cubes.measures.rolling
163
-
164
- ## More Information
165
-
166
- https://cube.dev/docs/reference/data-model/measures
@@ -117,7 +117,3 @@ rolling_window:
117
117
  - cubes.measures.calculated
118
118
  - cubes.dimensions.time
119
119
  - pre-aggregations
120
-
121
- ## More Information
122
-
123
- https://cube.dev/docs/reference/data-model/measures#rolling-window
@@ -120,7 +120,3 @@ Custom aggregate function (advanced).
120
120
  - cubes.measures
121
121
  - cubes.measures.calculated
122
122
  - cubes.measures.filters
123
-
124
- ## More Information
125
-
126
- https://cube.dev/docs/reference/data-model/types-and-formats#measure-types
@@ -170,7 +170,3 @@ cubes:
170
170
  - cubes.measures
171
171
  - cubes.dimensions
172
172
  - views
173
-
174
- ## More Information
175
-
176
- https://cube.dev/docs/reference/data-model/cube#public
@@ -151,7 +151,3 @@ pre_aggregations:
151
151
  - cubes
152
152
  - pre-aggregations
153
153
  - pre-aggregations.rollup
154
-
155
- ## More Information
156
-
157
- https://cube.dev/docs/reference/data-model/cube#refresh-key
@@ -119,7 +119,3 @@ segments:
119
119
  - cubes
120
120
  - cubes.measures.filters
121
121
  - views
122
-
123
- ## More Information
124
-
125
- https://cube.dev/docs/reference/data-model/segments
@@ -59,7 +59,3 @@ cubes:
59
59
  - cubes
60
60
  - cubes.data-source
61
61
  - syntax.references
62
-
63
- ## More Information
64
-
65
- https://cube.dev/docs/reference/data-model/cube#sql
@@ -124,7 +124,3 @@ measures:
124
124
  - pre-aggregations.rollup
125
125
  - cubes.measures
126
126
  - cubes.dimensions.time
127
-
128
- ## More Information
129
-
130
- https://cube.dev/docs/reference/data-model/pre-aggregations
@@ -160,7 +160,3 @@ A query uses a rollup if:
160
160
  - pre-aggregations
161
161
  - cubes.dimensions.time
162
162
  - cubes.measures
163
-
164
- ## More Information
165
-
166
- https://cube.dev/docs/reference/data-model/pre-aggregations#rollup
@@ -151,7 +151,3 @@ dimensions:
151
151
  - syntax
152
152
  - syntax.references
153
153
  - cubes.extends
154
-
155
- ## More Information
156
-
157
- https://cube.dev/docs/reference/data-model/context-variables
@@ -131,7 +131,3 @@ public: false
131
131
  - syntax.references
132
132
  - cubes
133
133
  - views
134
-
135
- ## More Information
136
-
137
- https://cube.dev/docs/product/data-modeling/syntax
@@ -172,7 +172,3 @@ sql: "metadata->>'\{key\}'"
172
172
  - syntax
173
173
  - cubes.measures.calculated
174
174
  - cubes.joins
175
-
176
- ## More Information
177
-
178
- https://cube.dev/docs/product/data-modeling/syntax#references
@@ -160,7 +160,3 @@ views:
160
160
  - views
161
161
  - views.includes
162
162
  - cubes.joins
163
-
164
- ## More Information
165
-
166
- https://cube.dev/docs/reference/data-model/view#cubes
@@ -152,7 +152,3 @@ folders:
152
152
  - views
153
153
  - views.cubes
154
154
  - views.includes
155
-
156
- ## More Information
157
-
158
- https://cube.dev/docs/reference/data-model/view#folders
@@ -137,7 +137,3 @@ Use `"*"` to include all, then exclude what you don't need:
137
137
  - views
138
138
  - views.cubes
139
139
  - views.folders
140
-
141
- ## More Information
142
-
143
- https://cube.dev/docs/reference/data-model/view#includes
@@ -136,7 +136,3 @@ views/
136
136
  - views.includes
137
137
  - views.folders
138
138
  - cubes.joins
139
-
140
- ## More Information
141
-
142
- https://cube.dev/docs/reference/data-model/view
@@ -126,7 +126,3 @@ Run: bon login
126
126
  - workflow.validate
127
127
  - cubes
128
128
  - views
129
-
130
- ## More Information
131
-
132
- https://docs.bonnard.dev/cli/deploy
@@ -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
@@ -145,7 +145,3 @@ models/
145
145
  - workflow.deploy
146
146
  - cubes
147
147
  - views
148
-
149
- ## More Information
150
-
151
- https://docs.bonnard.dev/workflow
@@ -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)
@@ -150,7 +150,3 @@ measures:
150
150
  - workflow
151
151
  - workflow.deploy
152
152
  - syntax
153
-
154
- ## More Information
155
-
156
- https://docs.bonnard.dev/cli/validate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonnard/cli",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "bon": "./dist/bin/bon.mjs"