@@ -87,18 +87,18 @@ Reruns on file changes. Useful during development.
8787
8888## What the Tests Cover
8989
90- | Test | What it verifies |
91- | ---| ---|
92- | Initialize handshake | Server starts, SDK handshake succeeds, capabilities reported |
93- | Server version | Name is ` "influxdb-mcp-server" ` , version is defined |
94- | Tool count | ` tools/list ` returns exactly ` EXPECTED_TOOL_COUNT ` tools |
95- | Tool structure | Each tool has ` name ` , ` description ` , ` inputSchema ` with ` type: "object" ` |
96- | Core tool names | Spot-checks ` health_check ` , ` execute_query ` , ` write_line_protocol ` , ` list_databases ` , ` create_admin_token ` |
97- | Resource URIs | 4 resources with correct ` influx:// ` URIs |
98- | Resource structure | Each resource has ` name ` , ` uri ` , ` description ` |
99- | Prompt names | 3 prompts: ` list-databases ` , ` check-health ` , ` load-context ` |
100- | Ping | Server responds to ping |
101- | Unknown tool error | Calling nonexistent tool throws ` McpError ` |
90+ | Test | What it verifies |
91+ | -------------------- | ---------------------------------------------------------------------------------------------------------- |
92+ | Initialize handshake | Server starts, SDK handshake succeeds, capabilities reported |
93+ | Server version | Name is ` "influxdb-mcp-server" ` , version is defined |
94+ | Tool count | ` tools/list ` returns exactly ` EXPECTED_TOOL_COUNT ` tools |
95+ | Tool structure | Each tool has ` name ` , ` description ` , ` inputSchema ` with ` type: "object" ` |
96+ | Core tool names | Spot-checks ` health_check ` , ` execute_query ` , ` write_line_protocol ` , ` list_databases ` , ` create_admin_token ` |
97+ | Resource URIs | 4 resources with correct ` influx:// ` URIs |
98+ | Resource structure | Each resource has ` name ` , ` uri ` , ` description ` |
99+ | Prompt names | 3 prompts: ` list-databases ` , ` check-health ` , ` load-context ` |
100+ | Ping | Server responds to ping |
101+ | Unknown tool error | Calling nonexistent tool throws ` McpError ` |
102102
103103## Analyzing Failures
104104
@@ -112,6 +112,7 @@ The most common failure after code changes. The constant in
112112below for documentation.
113113
114114To find the current count, start the server briefly and check stderr:
115+
115116``` bash
116117npm run build && INFLUX_DB_INSTANCE_URL=http://localhost:19999/ \
117118INFLUX_DB_TOKEN=fake INFLUX_DB_PRODUCT_TYPE=core \
@@ -122,6 +123,7 @@ sleep 1 && kill $!
122123Look for: ` [MCP] Server initialized with N tools, N resources, N prompts `
123124
124125The tool count breakdown by category file:
126+
125127- ` help.tools.ts ` (2) + ` write.tools.ts ` (1) + ` database.tools.ts ` (4)
126128- ` query.tools.ts ` (3) + ` token.tools.ts ` (6) + ` cloud-token.tools.ts ` (5)
127129- ` health.tools.ts ` (1) = ** 22 total**
@@ -136,13 +138,15 @@ message if the build artifact is missing.
136138### Initialize handshake timeout
137139
138140The server process failed to start. Common causes:
141+
139142- Build is stale after source changes — rebuild with ` npm run build `
140143- Missing or invalid env vars — protocol tests use a fake config internally,
141144 so this usually means ` createTestClient ` was called with bad overrides
142145
143146### Integration test: "HEALTHY" not found
144147
145148InfluxDB instance is unreachable or unhealthy. Verify:
149+
1461501 . Instance is running: ` curl http://localhost:8181/ping `
1471512 . Token is valid
1481523 . ` INFLUX_DB_PRODUCT_TYPE ` matches the actual instance type
@@ -181,6 +185,59 @@ The `createTestClient(env?)` factory in `tests/helpers/mcp-client.ts` spawns
181185a real server process and returns a connected MCP ` Client ` . Override env vars
182186by passing a partial record. Always call ` close() ` in ` afterAll ` .
183187
188+ ## Reviewing data-plane and admin changes
189+
190+ When a change adds or modifies a tool that talks to an InfluxDB endpoint
191+ (writes, queries, database/token management), verify the actual API contract
192+ and exercise it against a real instance. Tool descriptions, CHANGELOG entries,
193+ and code comments are not authoritative on their own — confirm them.
194+
195+ ### Verify the API contract first
196+
197+ Confirm the HTTP method, path, and request/response shape against both the
198+ InfluxData docs knowledge source and the ` influxdata/influxdb ` source
199+ (` influxdb3_server/src/http.rs ` routing, ` influxdb3_types/src/http.rs ` structs).
200+
201+ Gotchas that have already bitten this repo:
202+
203+ - Core/Enterprise ` update_database ` retention is ` PUT /api/v3/configure/database `
204+ with ` retention_period ` as a duration string (` "60d" ` ) — not ` PATCH ` , not
205+ ` retention_period_ns ` .
206+ - Core can update retention since v3.2.0 (static docs wrongly say it's immutable).
207+ - ` /ping ` and ` /health ` use ` Token ` auth even for core/enterprise (v1/v2 compat);
208+ the admin client uses ` Bearer ` . Both are intentional.
209+
210+ ### Exercise it against a real instance
211+
212+ Admin endpoints (` /api/v3/configure/* ` ) need an admin token; ` health_check `
213+ does not, so a passing ` health_check ` does not prove the token works. Run a
214+ self-contained Core for an admin-path test on a free port:
215+
216+ ``` bash
217+ docker run -d --name mcp-it-core -p 8383:8181 \
218+ -v " $PWD /tests/fixtures/admin-token.json" :/admin-token.json:ro \
219+ influxdb:3-core influxdb3 serve \
220+ --node-id local-test --object-store memory \
221+ --admin-token-file /admin-token.json
222+
223+ INFLUX_TEST_ENABLED=true INFLUX_DB_INSTANCE_URL=http://localhost:8383/ \
224+ INFLUX_DB_TOKEN=apiv3_test INFLUX_DB_PRODUCT_TYPE=core \
225+ npx vitest run tests/integration.test.ts
226+
227+ docker rm -f mcp-it-core
228+ ```
229+
230+ This uses the offline preconfigured admin token in ` tests/fixtures/admin-token.json `
231+ (token ` apiv3_test ` ) — the ` docker-compose.test.yml ` pattern, but on a port you
232+ choose so it does not collide with other local instances.
233+
234+ ### Token gotcha
235+
236+ v3 tokens are base64 and can contain ` + ` , ` / ` , and ` = ` . Do not extract one with
237+ ` grep -oE 'apiv3_[A-Za-z0-9_-]+' ` — it truncates at the first base64 character
238+ and yields an invalid token (the server returns `401 "the request was not
239+ authenticated"`).
240+
184241## Additional Resources
185242
186243### Reference Files
0 commit comments