Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit adca529

Browse files
goldmedalclaude
andcommitted
fix(skills,docs): reorder flow — register MCP before generate-mdl
The previous ordering had generate-mdl (Phase 2) before MCP registration (Phase 3). This meant agents had no MCP tools available and fell back to calling ibis-server API directly, bypassing connection info and hitting confusing errors. New order across all docs and skills: 1. Start Docker container 2. Configure connection (Web UI) + Register MCP + New session 3. Generate MDL (via MCP tools) 4. Verify and query Affected files: - wren-quickstart skill (1.2 → 1.3) - docs/quickstart.md Option B - docs/getting_started_with_claude_code.md manual setup Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 34958c3 commit adca529

5 files changed

Lines changed: 106 additions & 101 deletions

File tree

docs/getting_started_with_claude_code.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -156,23 +156,43 @@ docker logs wren-mcp
156156

157157
> **Database on localhost?** If your database runs on your host machine, replace `localhost` / `127.0.0.1` with `host.docker.internal` in your connection settings — the container cannot reach the host's `localhost` directly.
158158
159-
### Phase 3 — Generate the MDL
159+
### Phase 3 — Configure connection and register MCP server
160160

161-
In Claude Code, run:
161+
Configure connection info in the Web UI at `http://localhost:9001` — select the data source type and enter credentials. Use `/wren-connection-info` in Claude Code for field reference per data source.
162+
163+
> **Connection info can only be configured through the Web UI.** Do not attempt to set it programmatically.
164+
165+
Then register the MCP server with Claude Code:
166+
167+
```bash
168+
claude mcp add --transport http wren http://localhost:9000/mcp
169+
```
170+
171+
Verify it was added:
172+
173+
```bash
174+
claude mcp list
175+
```
176+
177+
**Start a new Claude Code session** — MCP servers are only loaded at session start.
178+
179+
### Phase 4 — Generate the MDL
180+
181+
In the new session, run:
162182

163183
```
164184
/generate-mdl
165185
```
166186

167187
The skill will:
168188

169-
1. Run `health_check()` to verify the connection is configured
189+
1. Run `health_check()` to verify the connection is working
170190
2. Ask for your data source type (PostgreSQL, BigQuery, Snowflake, etc.) and optional schema filter
171-
3. Call `list_remote_tables()` and `list_remote_constraints()` via the MCP server to introspect your database schema
191+
3. Call `list_remote_tables()` and `list_remote_constraints()` via MCP tools to introspect your database schema
172192
4. Build the MDL JSON (models, columns, relationships)
173193
5. Validate the manifest with `deploy_manifest()` + `dry_run()`
174194

175-
> **Connection info** must be configured in the Web UI (`http://localhost:9001`) before running `/generate-mdl`. Use `/wren-connection-info` in Claude Code for field reference per data source.
195+
> **Prerequisite:** The MCP server must be registered and a new session started (Phase 3). The `/generate-mdl` skill uses MCP tools — do not call ibis-server API directly.
176196
177197
Then save the MDL as a versioned YAML project:
178198

@@ -182,22 +202,6 @@ Then save the MDL as a versioned YAML project:
182202

183203
This writes human-readable YAML files to your workspace and compiles `target/mdl.json`.
184204

185-
### Phase 4 — Register the MCP server
186-
187-
Add Wren to Claude Code's MCP configuration:
188-
189-
```bash
190-
claude mcp add --transport http wren http://localhost:9000/mcp
191-
```
192-
193-
Verify it was added:
194-
195-
```bash
196-
claude mcp list
197-
```
198-
199-
**Start a new Claude Code session** — MCP servers are only loaded at session start.
200-
201205
---
202206

203207
## Verify and start querying

docs/quickstart.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ docker ps --filter name=wren-mcp
141141
curl http://localhost:8000/health
142142
```
143143

144-
#### Phase 2 — Configure the connection and generate the MDL
144+
#### Phase 2 — Configure connection and register MCP server
145145

146-
Before generating the MDL, configure the DuckDB connection via the Web UI at `http://localhost:9001`:
146+
Configure the DuckDB connection via the Web UI at `http://localhost:9001`:
147147

148148
1. Open `http://localhost:9001` in your browser
149149
2. Select data source type: **DUCKDB**
@@ -161,33 +161,37 @@ The JSON looks like:
161161

162162
> **Common mistake:** Do not point `url` to the `.duckdb` file directly (e.g. `/data/jaffle_shop.duckdb`). The ibis-server expects a **directory** — it scans for all `.duckdb` files in that directory and attaches them automatically. Pointing to the binary file causes a UTF-8 decode error.
163163
164-
After saving the connection, run the skills in sequence in Claude Code:
164+
Then register the MCP server with Claude Code:
165165

166-
```text
167-
/generate-mdl
166+
```bash
167+
claude mcp add --transport http wren http://localhost:9000/mcp
168168
```
169169

170-
Then save the MDL as a versioned YAML project:
170+
Verify it was added:
171171

172-
```text
173-
/wren-project
172+
```bash
173+
claude mcp list
174174
```
175175

176-
This writes human-readable YAML files to `~/wren-workspace/` and compiles `target/mdl.json`.
176+
**Start a new Claude Code session** — MCP servers are only loaded at session start.
177177

178-
#### Phase 3 — Register the MCP server
178+
#### Phase 3 — Generate the MDL
179179

180-
```bash
181-
claude mcp add --transport http wren http://localhost:9000/mcp
180+
In the new session, run the skills in sequence:
181+
182+
```text
183+
/generate-mdl
182184
```
183185

184-
Verify it was added:
186+
The skill uses MCP tools (`health_check()`, `list_remote_tables()`, etc.) to introspect the database — these tools are only available after the MCP server is registered and a new session is started.
185187

186-
```bash
187-
claude mcp list
188+
Then save the MDL as a versioned YAML project:
189+
190+
```text
191+
/wren-project
188192
```
189193

190-
**Start a new Claude Code session** — MCP servers are only loaded at session start.
194+
This writes human-readable YAML files to `~/wren-workspace/` and compiles `target/mdl.json`.
191195

192196
</details>
193197

skills/index.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
},
8383
{
8484
"name": "wren-quickstart",
85-
"version": "1.2",
85+
"version": "1.3",
8686
"description": "End-to-end quickstart for Wren Engine — from zero to querying.",
8787
"tags": [
8888
"wren",

skills/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"wren-project": "1.5",
55
"wren-sql": "1.0",
66
"wren-mcp-setup": "1.3",
7-
"wren-quickstart": "1.2",
7+
"wren-quickstart": "1.3",
88
"wren-usage": "1.1"
99
}

skills/wren-quickstart/SKILL.md

Lines changed: 59 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ compatibility: Requires Docker Desktop (or Docker Engine). No local database dri
55
license: Apache-2.0
66
metadata:
77
author: wren-engine
8-
version: "1.2"
8+
version: "1.3"
99
---
1010

1111
# Wren Quickstart
1212

1313
## Version check
1414

1515
Silently fetch `https://raw.githubusercontent.com/Canner/wren-engine/main/skills/versions.json`.
16-
Compare the `wren-quickstart` key with this skill's version (`1.2`).
16+
Compare the `wren-quickstart` key with this skill's version (`1.3`).
1717
If the remote version is newer, notify the user before proceeding:
1818

19-
> A newer version of the **wren-quickstart** skill is available (remote: X.Y, installed: 1.2).
19+
> A newer version of the **wren-quickstart** skill is available (remote: X.Y, installed: 1.3).
2020
> Update with:
2121
> ```bash
2222
> curl -fsSL https://raw.githubusercontent.com/Canner/wren-engine/main/skills/install.sh | bash -s -- --force wren-quickstart
@@ -74,86 +74,85 @@ Recommended workspace layout after the quickstart completes:
7474
7575
---
7676
77-
## Phase 2 — Generate MDL and save project
77+
## Phase 2 — Start Docker container and register MCP server
7878
79-
### 2a — Generate MDL
80-
81-
Invoke the **generate-mdl** skill to introspect the user's database and build the MDL manifest:
79+
Invoke the **wren-mcp-setup** skill to start the Docker container and register the MCP server with the AI client:
8280
8381
```
84-
@generate-mdl
82+
@wren-mcp-setup
8583
```
8684
87-
The generate-mdl skill will:
88-
1. Ask for data source type and connection credentials
89-
2. Call ibis-server to fetch table schema and foreign key constraints
90-
3. Build the MDL JSON (models, columns, relationships)
91-
4. Validate the manifest with a dry-plan
85+
Pass `<WORKSPACE_PATH>` as the workspace mount path when the skill asks.
9286
93-
> **Important:** At this stage ibis-server may not be running yet. If the user has not started a container, proceed to Phase 3 first (start the container), then come back to generate the MDL using the running ibis-server on port 8000.
94-
>
95-
> Alternatively, if the user already has a running ibis-server, run Phase 2 before Phase 3.
87+
The wren-mcp-setup skill will:
88+
1. Start the container with `-v <WORKSPACE_PATH>:/workspace`
89+
2. Set `MDL_PATH=/workspace/target/mdl.json`
90+
3. Register the MCP server with the AI client (`claude mcp add`)
91+
4. Verify the container is running
9692
97-
### 2b — Save as YAML project
93+
### 2b — Configure connection info via Web UI
9894
99-
After the MDL is generated, invoke the **wren-project** skill to save it as a versioned YAML project inside the workspace:
95+
Once the container is running, open the MCP server Web UI to configure connection info:
10096
101-
```
102-
@wren-project
97+
```text
98+
http://localhost:9001
10399
```
104100
105-
Direct the skill to write the project files into `<WORKSPACE_PATH>`:
101+
Enter the data source credentials (host, port, database, user, password, etc.) in the UI form and save. The MCP server stores and applies the connection info without exposing credentials to this conversation.
106102
107-
- `<WORKSPACE_PATH>/wren_project.yml`
108-
- `<WORKSPACE_PATH>/models/*.yml`
109-
- `<WORKSPACE_PATH>/relationships.yml`
110-
- `<WORKSPACE_PATH>/views.yml`
103+
> **Tip:** If your database is running locally, use `host.docker.internal` instead of `localhost` as the host address.
111104
112-
Then build the compiled target:
105+
### 2c — Start a new session
113106
114-
- `<WORKSPACE_PATH>/target/mdl.json`
107+
The user must **start a new Claude Code session** for the Wren MCP tools to be loaded. Instruct the user to do this now and come back to continue with Phase 3.
115108
116-
The Docker container will auto-load this file at startup.
109+
> **Important:** Do not proceed to Phase 3 until the new session is started. The `generate-mdl` skill requires MCP tools (`health_check()`, `list_remote_tables()`, etc.) which are only available after the MCP server is registered and a new session is started.
117110
118111
---
119112
120-
## Phase 3 — Start and register the MCP server
113+
## Phase 3 — Generate MDL and save project
121114
122-
Invoke the **wren-mcp-setup** skill to start the Docker container and register the MCP server with the AI client:
115+
> **Prerequisite:** The MCP server must be registered and a new session started (Phase 2c). The `generate-mdl` skill uses MCP tools — do not call ibis-server API directly.
116+
117+
### 3a — Generate MDL
118+
119+
Invoke the **generate-mdl** skill to introspect the user's database and build the MDL manifest:
123120
124121
```
125-
@wren-mcp-setup
122+
@generate-mdl
126123
```
127124
128-
Pass `<WORKSPACE_PATH>` as the workspace mount path when the skill asks.
125+
The generate-mdl skill will:
126+
1. Run `health_check()` to verify the connection is working
127+
2. Ask for data source type and optional schema filter
128+
3. Call `list_remote_tables()` and `list_remote_constraints()` via MCP to fetch schema
129+
4. Build the MDL JSON (models, columns, relationships)
130+
5. Validate the manifest with `deploy_manifest()` + `dry_run()`
129131
130-
The wren-mcp-setup skill will:
131-
1. Start the container with `-v <WORKSPACE_PATH>:/workspace`
132-
2. Set `MDL_PATH=/workspace/target/mdl.json`
133-
3. Register the MCP server with the AI client (`claude mcp add`)
134-
4. Verify the container is running
132+
### 3b — Save as YAML project
135133
136-
> If `<WORKSPACE_PATH>/target/mdl.json` already exists before the container starts, it is loaded automatically at boot. No separate `deploy` call is needed.
134+
After the MDL is generated, invoke the **wren-project** skill to save it as a versioned YAML project inside the workspace:
137135
138-
### 3b — Configure connection info via Web UI
136+
```
137+
@wren-project
138+
```
139139
140-
Once the container is running, open the MCP server Web UI to configure connection info:
140+
Direct the skill to write the project files into `<WORKSPACE_PATH>`:
141141
142-
```text
143-
http://localhost:9001
144-
```
142+
- `<WORKSPACE_PATH>/wren_project.yml`
143+
- `<WORKSPACE_PATH>/models/*.yml`
144+
- `<WORKSPACE_PATH>/relationships.yml`
145+
- `<WORKSPACE_PATH>/views.yml`
145146
146-
Enter the data source credentials (host, port, database, user, password, etc.) in the UI form and save. The MCP server stores and applies the connection info without exposing credentials to this conversation.
147+
Then build the compiled target:
147148
148-
> **Tip:** If your database is running locally, use `host.docker.internal` instead of `localhost` as the host address.
149+
- `<WORKSPACE_PATH>/target/mdl.json`
149150
150151
---
151152
152-
## Phase 4 — Verify and confirm
153-
154-
Once the MCP server is registered, the user must **start a new session** for the Wren MCP tools to be loaded. Instruct the user to do this now.
153+
## Phase 4 — Verify and start querying
155154
156-
In the new session, ask the AI agent to run a health check:
155+
Run a health check to confirm everything is working:
157156
158157
```
159158
Use health_check() to verify Wren Engine is reachable.
@@ -164,7 +163,7 @@ Expected response: `SELECT 1` returns successfully.
164163
If the health check passes:
165164
166165
- Tell the user setup is complete.
167-
- In this session, they can start querying immediately:
166+
- They can start querying immediately:
168167
169168
```
170169
Query: How many orders are in the orders table?
@@ -178,24 +177,22 @@ If the health check fails, follow the troubleshooting steps in the **wren-mcp-se
178177
179178
| Phase | Skill | Purpose |
180179
|-------|-------|---------|
181-
| 2a | `@generate-mdl` | Introspect database and build MDL JSON |
182-
| 2b | `@wren-project` | Save MDL as YAML project + compile to `target/` |
183-
| 3 | `@wren-mcp-setup` | Start Docker container and register MCP server |
180+
| 2 | `@wren-mcp-setup` | Start Docker container and register MCP server |
181+
| 3a | `@generate-mdl` | Introspect database and build MDL JSON |
182+
| 3b | `@wren-project` | Save MDL as YAML project + compile to `target/` |
184183
185184
---
186185
187186
## Troubleshooting
188187
189-
**Container not finding MDL at startup:**
190-
- Confirm `<WORKSPACE_PATH>/target/mdl.json` exists before starting the container.
191-
- Check container logs: `docker logs wren-mcp`
192-
193-
**generate-mdl fails because ibis-server is not yet running:**
194-
- Start the container first (Phase 3), then return to Phase 2.
195-
- ibis-server is available at `http://localhost:8000` once the container is up.
196-
197-
**MCP tools not available after registration:**
188+
**MCP tools not available:**
198189
- The MCP server is only loaded at session start. Start a new Claude Code session after registering.
190+
- Do not attempt to call ibis-server API directly — always use MCP tools.
191+
192+
**generate-mdl fails:**
193+
- Ensure the container is running: `docker ps --filter name=wren-mcp`
194+
- Ensure connection info is configured in the Web UI (`http://localhost:9001`)
195+
- Ensure a new session was started after `claude mcp add`
199196
200197
**Database connection refused inside Docker:**
201198
- Change `localhost` / `127.0.0.1` to `host.docker.internal` in connection credentials.

0 commit comments

Comments
 (0)