@cyanheads/brapi-mcp-server 0.5.1 → 0.5.3
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/CLAUDE.md +7 -5
- package/Dockerfile +1 -1
- package/README.md +46 -17
- package/changelog/0.5.x/0.5.2.md +25 -0
- package/changelog/0.5.x/0.5.3.md +25 -0
- package/dist/config/server-config.d.ts +5 -2
- package/dist/config/server-config.d.ts.map +1 -1
- package/dist/config/server-config.js +7 -1
- package/dist/config/server-config.js.map +1 -1
- package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts +7 -1
- package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.js +18 -1
- package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts.map +1 -1
- package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.js +24 -11
- package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.js.map +1 -1
- package/dist/mcp-server/tools/definitions/index.d.ts +6 -1
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
- package/dist/services/canvas-bridge/canvas-bridge.d.ts +46 -11
- package/dist/services/canvas-bridge/canvas-bridge.d.ts.map +1 -1
- package/dist/services/canvas-bridge/canvas-bridge.js +118 -17
- package/dist/services/canvas-bridge/canvas-bridge.js.map +1 -1
- package/dist/services/canvas-bridge/index.d.ts +1 -1
- package/dist/services/canvas-bridge/index.d.ts.map +1 -1
- package/dist/services/canvas-bridge/index.js +1 -1
- package/dist/services/canvas-bridge/index.js.map +1 -1
- package/dist/services/server-registry/server-registry.d.ts +11 -0
- package/dist/services/server-registry/server-registry.d.ts.map +1 -1
- package/dist/services/server-registry/server-registry.js +25 -8
- package/dist/services/server-registry/server-registry.js.map +1 -1
- package/package.json +3 -3
- package/server.json +4 -4
package/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Agent Protocol
|
|
2
2
|
|
|
3
3
|
**Server:** brapi-mcp-server
|
|
4
|
-
**Version:** 0.5.
|
|
4
|
+
**Version:** 0.5.3
|
|
5
5
|
**Framework:** [@cyanheads/mcp-ts-core](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
6
6
|
|
|
7
7
|
> **Read the framework docs first:** `node_modules/@cyanheads/mcp-ts-core/CLAUDE.md` contains the full API reference — builders, Context, error codes, exports, patterns. This file covers server-specific conventions only.
|
|
@@ -130,6 +130,7 @@ const ServerConfigSchema = z.object({
|
|
|
130
130
|
retryMaxAttempts: z.coerce.number().int().min(0).default(3),
|
|
131
131
|
datasetTtlSeconds: z.coerce.number().int().positive().default(86_400),
|
|
132
132
|
referenceCacheTtlSeconds: z.coerce.number().int().positive().default(3_600),
|
|
133
|
+
sessionIsolation: z.enum(['true', 'false']).default('true').transform((v) => v === 'true'),
|
|
133
134
|
// …see src/config/server-config.ts for the full schema
|
|
134
135
|
});
|
|
135
136
|
|
|
@@ -160,10 +161,11 @@ Handlers receive a unified `ctx` object. Currently used surface:
|
|
|
160
161
|
| Property | Description |
|
|
161
162
|
|:---------|:------------|
|
|
162
163
|
| `ctx.log` | Request-scoped logger — `.debug()`, `.info()`, `.notice()`, `.warning()`, `.error()`. Auto-correlates requestId, traceId, tenantId. |
|
|
163
|
-
| `ctx.state` | Tenant-scoped KV — used by `ServerRegistry` (connection aliases), `CanvasBridge` (
|
|
164
|
+
| `ctx.state` | Tenant-scoped KV — used by `ServerRegistry` (connection aliases), `CanvasBridge` (default canvas pointer + per-table provenance), and `CapabilityRegistry` (cached profiles). Spilled `find_*` rows live on the canvas (DuckDB), not in `ctx.state`. |
|
|
165
|
+
| `ctx.sessionId` | Mcp-Session-Id (HTTP stateful/auto); `undefined` for stdio and stateless HTTP unless `exposeStatelessSessionId` is opted in. Composed into `ServerRegistry.connKey` and `CanvasBridge.defaultCanvasKey` when `BRAPI_SESSION_ISOLATION=true` (default), so concurrent HTTP sessions in the same tenant don't share connection state or canvas. Discovery / scoping key on top of tenant-keyed state — not an authorization principal. |
|
|
164
166
|
| `ctx.signal` | `AbortSignal` — threaded into every BrAPI HTTP call so client-side cancellation aborts the upstream request. |
|
|
165
167
|
| `ctx.requestId` | Unique request ID — auto-attached to every `ctx.log` entry. |
|
|
166
|
-
| `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio —
|
|
168
|
+
| `ctx.tenantId` | Tenant ID from JWT or `'default'` for stdio / HTTP+`auth=none` — outer scope on all `ctx.state` reads/writes. |
|
|
167
169
|
|
|
168
170
|
`ctx.elicit` is used by `brapi_submit_observations` to gate apply-mode writes behind user confirmation (with explicit `force: true` as the bypass). `ctx.sample` and `ctx.progress` are not used yet — they'll show up when long-running workflows (pedigree traversal, genotype-call pulls) need progress reporting or LLM sampling. `ctx.fail(reason, …)` is the typed thrower keyed off declared `errors[]` contracts — used by 8 tools and 3 resources today. `ctx.recoveryFor(reason)` resolves the matching contract entry's recovery hint into `data.recovery.hint` so it surfaces on the wire.
|
|
169
171
|
|
|
@@ -224,11 +226,11 @@ src/
|
|
|
224
226
|
brapi-client/ # HTTP client — retry, concurrency cap, async-search poll, private-IP guard, binary fetch, POST/PUT
|
|
225
227
|
brapi-dialect/ # Per-server filter / payload adapters (spec, cassavabase) — translates plural→singular, drops searchText, declares known-dead POST /search routes; envelope surfaces id + source + disabled-search nouns
|
|
226
228
|
brapi-filters/ # Static v2.1 filter catalog
|
|
227
|
-
canvas-bridge/ #
|
|
229
|
+
canvas-bridge/ # Default-canvas resolver (per-session when BRAPI_SESSION_ISOLATION=true; per-tenant otherwise), df_<uuid> table generator, provenance store
|
|
228
230
|
capability-registry/ # Per-connection /serverinfo cache + call guard
|
|
229
231
|
ontology-resolver/ # Free-text → ontology-term matcher for variables
|
|
230
232
|
reference-data-cache/ # Programs / trials / locations / crops lookup cache
|
|
231
|
-
server-registry/ # Alias → live connection map with auth resolution
|
|
233
|
+
server-registry/ # Alias → live connection map with auth resolution; session-scoped under BRAPI_SESSION_ISOLATION=true
|
|
232
234
|
mcp-server/
|
|
233
235
|
tools/
|
|
234
236
|
definitions/
|
package/Dockerfile
CHANGED
|
@@ -96,7 +96,7 @@ ARG PORT
|
|
|
96
96
|
ENV MCP_HTTP_PORT=${PORT:-3010}
|
|
97
97
|
ENV MCP_HTTP_HOST="0.0.0.0"
|
|
98
98
|
ENV MCP_TRANSPORT_TYPE="http"
|
|
99
|
-
ENV MCP_SESSION_MODE="
|
|
99
|
+
ENV MCP_SESSION_MODE="stateful"
|
|
100
100
|
ENV MCP_LOG_LEVEL="info"
|
|
101
101
|
ENV LOGS_DIR="/var/log/brapi-mcp-server"
|
|
102
102
|
ENV MCP_FORCE_CONSOLE_LOGGING="true"
|
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<h1>@cyanheads/brapi-mcp-server</h1>
|
|
3
|
-
<p><b>BrAPI v2.1 MCP
|
|
4
|
-
<div>22 Tools • 5 Resources • 2 Prompts</div>
|
|
3
|
+
<p><b>A collaborative BrAPI v2.1 workspace for multi-agent research via MCP. Search studies, germplasm, genotypes, & more - across Breedbase, T3, Sweetpotatobase, & any BrAPI v2-compliant server.</b>
|
|
4
|
+
<div>22 Tools • 5 Resources • 2 Prompts • Multi-agent collaboration</div>
|
|
5
5
|
</p>
|
|
6
6
|
</div>
|
|
7
7
|
|
|
8
8
|
<div align="center">
|
|
9
9
|
|
|
10
|
-
[](https://www.npmjs.com/package/@cyanheads/brapi-mcp-server) [](https://www.npmjs.com/package/@cyanheads/brapi-mcp-server) [](./CHANGELOG.md) [](https://www.npmjs.com/package/@cyanheads/mcp-ts-core) [](https://modelcontextprotocol.io/)
|
|
11
11
|
|
|
12
12
|
[](./LICENSE) [](https://www.typescriptlang.org/) [](https://bun.sh/) [](./CHANGELOG.md)
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
## Tools
|
|
19
19
|
|
|
20
|
-
22 tools grouped by shape — connection tools bootstrap a session, `find_*` tools return a summarized page plus distributions and spill overflow rows into a canvas dataframe, `get_*` tools fetch a single record with companion counts, plus pedigree walking, an embedded SQL workspace over spilled rows (DuckDB-backed), file export for human handoff, an additive write surface for observations, and raw passthrough escape hatches.
|
|
20
|
+
22 tools grouped by shape — connection tools bootstrap a session, `find_*` tools return a summarized page plus distributions and spill overflow rows into a canvas dataframe that any agent can query or hand off by ID, `get_*` tools fetch a single record with companion counts, plus pedigree walking, an embedded SQL workspace over spilled rows (DuckDB-backed), file export for human handoff, an additive write surface for observations, and raw passthrough escape hatches.
|
|
21
21
|
|
|
22
22
|
### Orient
|
|
23
23
|
|
|
@@ -95,12 +95,31 @@ Multi-step BrAPI workflow templates — pure user-message generators, no side ef
|
|
|
95
95
|
|
|
96
96
|
---
|
|
97
97
|
|
|
98
|
+
## Multi-agent workflows
|
|
99
|
+
|
|
100
|
+
The server has two stateful layers and two scoping axes:
|
|
101
|
+
|
|
102
|
+
| Layer | Default scope | Why |
|
|
103
|
+
|:------|:--------------|:----|
|
|
104
|
+
| **Connection state** (aliases, exchanged tokens) | Tenant + session | Credentials and live tokens. Tenant gates by user (`jwt`/`oauth`) or collapses to `'default'` (`none`). Session sub-scope (`BRAPI_SESSION_ISOLATION=true`, default) prevents concurrent HTTP sessions in one tenant from sharing each other's tokens. |
|
|
105
|
+
| **Dataframes** (`df_<uuid>` tables) | Tenant + session | Within one (tenant, session), agents share by `df_<uuid>` name — possession grants full read/write/drop, auto-expires in 24h, provenance recorded. The underlying canvas is tenant-gated by the framework; the session sub-scope is enforced by the bridge's keying. |
|
|
106
|
+
|
|
107
|
+
Within one (tenant, session), dataframes act as a self-cleaning shared notebook: hand the `df_<uuid>` name between parallel agents on the same MCP session, persist it across a multi-step workflow, query / project / aggregate / join from any position. Address-by-name, time-bounded, scoped to that session.
|
|
108
|
+
|
|
109
|
+
**Default (isolated) shape.** Under `MCP_AUTH_MODE=none` + HTTP stateful (the default), each MCP session carves its own connection state and its own canvas. Two researchers connected to the same host don't see each other's `brapi_connect` aliases, exchanged SGN/OAuth tokens, or spilled `df_<uuid>` rows. Stdio always behaves as one session (single-process, no concurrency).
|
|
110
|
+
|
|
111
|
+
**Legacy shared-workspace shape.** Set `BRAPI_SESSION_ISOLATION=false` for cross-session collaboration in one tenant — multiple MCP sessions then share connection state and one default canvas, the way pre-0.6 deployments behaved. Useful when planning, analysis, and writeup agents run as separate MCP clients but operate as one researcher on shared upstream credentials.
|
|
112
|
+
|
|
113
|
+
**On privileged data.** The `df_<uuid>` name is a capability token within a canvas — not row-level access control. Anyone holding the name within the same (tenant, session) bucket can read its rows. Under default isolation, that bucket is one MCP session. Under `BRAPI_SESSION_ISOLATION=false`, the bucket widens to the whole tenant (all callers under `auth=none`, or one user's sessions under `jwt`/`oauth`). Treat dataframe names like authenticated share links — pass within the bucket, not externally. The 24h TTL caps blast radius; the provenance trail (originating tool, baseUrl, query) supports audit. Belt-and-braces: `brapi_dataframe_describe` requires an explicit `dataframe` name on shared-trust HTTP (no list-all enumeration), and `brapi_dataframe_query` rejects system-catalog reads (`information_schema`, `pg_catalog`, `sqlite_master`, `duckdb_*`) — so a caller without a known `df_<uuid>` name can't fish through either surface.
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
98
117
|
## BrAPI-specific features
|
|
99
118
|
|
|
119
|
+
- **Dataframe spillover** — `find_*` tools cap in-context rows at `loadLimit` and materialize larger unions (up to 50k rows / 50 pages) as DuckDB-backed `df_<uuid>` canvas dataframes. Discover with `brapi_dataframe_describe`, query with `brapi_dataframe_query` (SQL paging via `LIMIT/OFFSET`, projection, aggregation). Read-only enforcement at the SQL gate; session-scoped by default (tenant-scoped under `BRAPI_SESSION_ISOLATION=false`) — see [Multi-agent workflows](#multi-agent-workflows).
|
|
100
120
|
- **Multi-server session** — `ServerRegistry` maps aliases to live BrAPI connections; one session can span Breedbase, T3, and Sweetpotatobase in parallel.
|
|
101
|
-
- **Capability-aware calls** — `CapabilityRegistry` caches `/serverinfo` per connection and guards every tool call against unsupported endpoints. Falls back to `/calls` when `/serverinfo` is sparse.
|
|
102
121
|
- **Built-in known-server registry** — `bti-cassava`, `bti-sweetpotato`, `bti-breedbase-demo`, `t3-wheat`, `t3-oat`, `t3-barley` resolve out-of-the-box without env vars; orientation envelope carries CC-BY attribution.
|
|
103
|
-
- **
|
|
122
|
+
- **Capability-aware calls** — `CapabilityRegistry` caches `/serverinfo` per connection and guards every tool call against unsupported endpoints. Falls back to `/calls` when `/serverinfo` is sparse.
|
|
104
123
|
- **DuckDB required** — `@duckdb/node-api` is a regular dependency; startup fails closed when the framework canvas is unavailable. Not supported on Cloudflare Workers (no native binary in that runtime).
|
|
105
124
|
- **Async-search transparency** — `brapi_find_genotype_calls` and `brapi_raw_search` handle the `POST /search/{noun}` → `GET /search/{noun}/{id}` 202-retry pattern automatically.
|
|
106
125
|
- **Pedigree DAG walks** — `brapi_walk_pedigree` BFS-traverses ancestry / descendancy with cycle detection (BrAPI only exposes one generation per call).
|
|
@@ -113,10 +132,12 @@ Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp
|
|
|
113
132
|
|
|
114
133
|
---
|
|
115
134
|
|
|
116
|
-
## Working with
|
|
135
|
+
## Working with dataframes
|
|
117
136
|
|
|
118
137
|
When a `find_*` tool's upstream total exceeds `loadLimit`, the full union materializes as a canvas dataframe and the response carries an inline `dataframe` handle (`{ tableName, rowCount, columns, createdAt, expiresAt, … }`). SQL is the paging idiom — use `LIMIT/OFFSET` to walk pages, projection (`SELECT col1, col2`) to trim columns, and aggregation (`COUNT`, `GROUP BY`, `AVG`) to summarize without materializing every row.
|
|
119
138
|
|
|
139
|
+
Dataframe names are session-scoped capability tokens by default — pass `tableName` to any other agent on the same MCP session (or a downstream step in the same workflow) and they query the same workspace by name without re-pulling from the upstream. The `brapi_dataframe_*` tools offer SQL manipulation and more. See [Multi-agent workflows](#multi-agent-workflows) for cross-session / cross-tenant rules.
|
|
140
|
+
|
|
120
141
|
```text
|
|
121
142
|
1. brapi_find_observations { studies: ["s-422"] }
|
|
122
143
|
→ first-page rows inline + dataframe.tableName = "df_<uuid>" (when totalCount > loadLimit)
|
|
@@ -189,8 +210,9 @@ Every variable is optional.
|
|
|
189
210
|
| `BRAPI_CANVAS_DROP_ENABLED` | Opt-in for `brapi_dataframe_drop` registration. Off by default; dataframes expire via TTL when left unmanaged. | `false` |
|
|
190
211
|
| `BRAPI_EXPORT_DIR` | Directory for `brapi_dataframe_export` output files. Setting a path is the opt-in (no separate enable flag); unset leaves the tool out of `tools/list`. Stdio-only — the tool stays disabled under HTTP transport regardless of this value. Bridged to the framework's `CANVAS_EXPORT_PATH` automatically. | — |
|
|
191
212
|
| `BRAPI_CANVAS_MAX_ROWS` / `BRAPI_CANVAS_QUERY_TIMEOUT_MS` | Per-query response row cap and wall-clock timeout for `brapi_dataframe_query`. | `10000` / `30000` |
|
|
192
|
-
| `MCP_TRANSPORT_TYPE` / `MCP_HTTP_PORT` | Transport (`stdio` \| `http`)
|
|
213
|
+
| `MCP_TRANSPORT_TYPE` / `MCP_HTTP_PORT` / `MCP_SESSION_MODE` | Transport (`stdio` \| `http`), HTTP port, session mode (`stateful` \| `stateless` \| `auto`). | `stdio` / `3010` / `auto` |
|
|
193
214
|
| `MCP_AUTH_MODE` / `MCP_LOG_LEVEL` / `STORAGE_PROVIDER_TYPE` / `OTEL_ENABLED` | Auth mode (`none` \| `jwt` \| `oauth`), log level, storage backend, OpenTelemetry. | `none` / `info` / `in-memory` / `false` |
|
|
215
|
+
| `BRAPI_SESSION_ISOLATION` | When `true`, scope ServerRegistry connection state and the CanvasBridge default canvas to `ctx.sessionId` (HTTP stateful/auto). Concurrent callers under `MCP_AUTH_MODE=none` operate in isolated workspaces. Set `false` for the legacy shared-workspace collaboration model. No effect on stdio. | `true` |
|
|
194
216
|
|
|
195
217
|
Per-alias overrides follow the `BRAPI_<ALIAS>_*` pattern — see [`.env.example`](./.env.example) for every override and inline comments.
|
|
196
218
|
|
|
@@ -273,19 +295,26 @@ docker build -t brapi-mcp-server .
|
|
|
273
295
|
docker run --rm -p 3010:3010 brapi-mcp-server
|
|
274
296
|
```
|
|
275
297
|
|
|
276
|
-
Defaults to HTTP transport,
|
|
298
|
+
Defaults to HTTP transport, stateful session mode (engages `mcp-session-id` lifecycle and hijack protection), logs to `/var/log/brapi-mcp-server`. OTel peer deps are installed by default — `--build-arg OTEL_ENABLED=false` to omit.
|
|
299
|
+
|
|
300
|
+
### Deployment shapes
|
|
301
|
+
|
|
302
|
+
`brapi-mcp-server` runs in three shapes — pick the one that matches your trust domain. The differentiator is what isolates **connection state** (registered aliases, cached upstream tokens) and **dataframes**: nothing, the MCP session, or the auth tenant.
|
|
277
303
|
|
|
278
|
-
|
|
304
|
+
| Shape | Settings | Isolation | Best for |
|
|
305
|
+
|:------|:---------|:----------|:---------|
|
|
306
|
+
| **Per-session (default)** | `MCP_AUTH_MODE=none` + HTTP stateful + `BRAPI_SESSION_ISOLATION=true` | Each MCP session carves its own connection state and canvas. Concurrent HTTP callers don't see each other's aliases, exchanged tokens, or `df_<uuid>` rows. | Multi-user host without SSO. Default for institutional / public deployment under shared-trust auth. |
|
|
307
|
+
| **Per-user credentials** | `MCP_AUTH_MODE=jwt` or `oauth` (+ HTTP stateful) | Each user's JWT `tid` claim carves a tenant. Sessions sub-scope inside each tenant when isolation is on. Cross-user spillover impossible at the framework level. | Multi-user host with institutional SSO (Shibboleth, Okta, etc.) — strongest separation. |
|
|
308
|
+
| **Shared workspace (legacy)** | `MCP_AUTH_MODE=none` + `BRAPI_SESSION_ISOLATION=false` | All callers in one tenant share connection state and one canvas. Possession of a `df_<uuid>` name = full read/write across the workspace. | Solo, lab, or hosting where every caller is one researcher running parallel agents on shared upstream credentials. |
|
|
279
309
|
|
|
280
|
-
|
|
310
|
+
**Shape selection guide:**
|
|
281
311
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
| `http` + `jwt` or `oauth` | JWT `tid` claim, fail-closed if absent |
|
|
312
|
+
- **Multi-user public/institutional HTTP, no SSO.** Use the per-session default. Each researcher's stateful HTTP session is isolated even though they all resolve to `tenantId='default'`.
|
|
313
|
+
- **Multi-user with institutional SSO.** Layer JWT or OAuth on top of per-session: `MCP_AUTH_MODE=jwt` (HS256, `MCP_AUTH_SECRET_KEY`) or `oauth` (JWKS, `OAUTH_ISSUER_URL` + `OAUTH_AUDIENCE`). Each user's `tid` carves a tenant; `BRAPI_SESSION_ISOLATION=true` then sub-scopes inside it for users running parallel sessions.
|
|
314
|
+
- **One researcher, parallel agents.** If multiple agents (planner, analyst, writeup) connect as separate MCP clients but should share one workspace, set `BRAPI_SESSION_ISOLATION=false` and rely on shared trust. This is the legacy shape.
|
|
315
|
+
- **Stdio.** Always one session; isolation is moot. The flag has no effect.
|
|
287
316
|
|
|
288
|
-
|
|
317
|
+
**Belt-and-braces under shared trust.** Even with `BRAPI_SESSION_ISOLATION=false`, `brapi_dataframe_describe` requires an explicit `dataframe` name on HTTP (no list-all enumeration), and `brapi_dataframe_query` rejects system-catalog reads (`information_schema`, `pg_catalog`, `sqlite_master`, `duckdb_*`). The dataframe name is the capability token; possession proves it.
|
|
289
318
|
|
|
290
319
|
---
|
|
291
320
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Tenant-isolation hardening on the dataframe surface — gate brapi_dataframe_describe list-all under shared-trust HTTP, reject system-catalog reads in brapi_dataframe_query, and forward gate context on rejection."
|
|
3
|
+
breaking: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 0.5.2 — 2026-05-05
|
|
7
|
+
|
|
8
|
+
Closes two enumeration paths through the dataframe surface that would have let a caller without a known `df_<uuid>` name fish through other concurrent clients' workspaces under shared-trust HTTP. Possession of a dataframe name is the capability gate; these fixes make that gate stand on its own. Also forwards structured gate context (catalog, operators, statementType) on SQL rejection so structured-only consumers see which specific element matched without parsing the message text.
|
|
9
|
+
|
|
10
|
+
## Added
|
|
11
|
+
|
|
12
|
+
- **System-catalog SQL gate in `CanvasBridge.query()`.** Rejects queries that reference DuckDB's metadata views and introspection functions: `information_schema.*`, `pg_catalog.*`, `sqlite_master`, `sqlite_temp_master`, and 30+ `duckdb_*(…)` functions (`duckdb_tables`, `duckdb_columns`, `duckdb_views`, `duckdb_databases`, `duckdb_schemas`, `duckdb_functions`, etc.). Without this gate, `SELECT * FROM information_schema.tables` would leak the full `df_<uuid>` namespace on a shared canvas, bypassing `brapi_dataframe_describe`'s possession-required list-all gate. Throws `validationError` with `data.reason = 'system_catalog_access'` and a `catalog` label naming which family matched. Comments and string literals are stripped before matching so a column named `information_schema_id` or a literal value `'information_schema.tables'` doesn't false-positive. `SYSTEM_CATALOG_ACCESS_REASON` is exported from `@/services/canvas-bridge` so the dataframe-query tool's contract translator routes it through `sql_rejected` alongside the framework's `SQL_GATE_REASONS`.
|
|
13
|
+
- **Typed error contract on `brapi_dataframe_describe`: `list_all_disabled_on_shared_http`.** Calling the tool without a `dataframe` argument under `MCP_AUTH_MODE=none` on HTTP transport (where every caller resolves to `tenantId='default'` and shares the canvas) now throws `Forbidden` with structured recovery: pass `dataframe` with a name from a prior `find_*` spillover (`result.dataframe.tableName`) or one you registered via `brapi_dataframe_query` with `registerAs`. Stdio is unaffected (only the operator runs there); JWT/OAuth is unaffected (each caller carves their own tenant). Tool description now flags this gate inline so an LLM client doesn't burn a call discovering the policy.
|
|
14
|
+
- **`tests/config/server-config.test.ts`.** New unit suite covering `getServerConfig` env-var mapping, defaults, type coercion, and validation errors. Required exporting `ServerConfigSchema` from `src/config/server-config.ts` for testability — purely additive, no runtime change.
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- **`brapi_dataframe_query` forwards gate context on rejection.** When `bridge.query()` rethrows a gate `validationError`, the handler's `sql_rejected` translator now spreads the original error's structured fields (other than `reason` and `recovery`) into `data` — so structured-only consumers see `data.catalog` for system-catalog rejections, `data.operators` for plan-operator rejections, `data.statementType` for non-SELECT rejections, etc. — without parsing the human message text. New `extractGateContext` helper isolates the forwarding logic. Recovery hint and `gateReason` keys still come from the contract / framework.
|
|
19
|
+
- **`brapi_dataframe_describe` and `brapi_dataframe_query` descriptions emphasize the inline-name flow.** Both tools now state explicitly that the dataframe name appears on every `find_*` response that spilled (`result.dataframe.tableName`), so the typical flow is `find_*` → read the name → query / describe by name. Reduces wasted "list everything first" calls — and aligns with the new shared-trust HTTP policy where listing requires possession.
|
|
20
|
+
- **README rewritten around multi-agent collaboration as the headline value.** New top-of-file framing ("A collaborative BrAPI v2.1 workspace for multi-agent research via MCP"), new **Multi-agent workflows** section explaining the connection-state vs dataframe-state split (both tenant-scoped, dataframe `df_<uuid>` names act as in-tenant capability tokens, 24h TTL caps blast radius, provenance trail supports audit), and new **Deployment shapes** section replacing the older **Multi-user HTTP deployments** table with a clearer shared-trust vs per-user-credentials axis. Documents the two new gates inline.
|
|
21
|
+
- **Server descriptions refreshed across `package.json`, `server.json`, README h1, and the GitHub repo metadata** to lead with multi-agent collaboration. `server.json` carries a condensed variant to fit the MCP Registry's 100-character cap.
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
- **`@cyanheads/mcp-ts-core` ^0.8.15 → ^0.8.16.** Picks up the upstream gate context (catalog / operators / statementType structured fields) that the dataframe-query handler now forwards.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Per-session isolation on ServerRegistry connection state and the CanvasBridge default canvas — concurrent HTTP callers under MCP_AUTH_MODE=none now operate in isolated workspaces by default."
|
|
3
|
+
breaking: false
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 0.5.3 — 2026-05-05
|
|
7
|
+
|
|
8
|
+
Adds a session sub-scope on top of tenant-keyed `ctx.state` for the two stateful surfaces. Under HTTP stateful/auto with `BRAPI_SESSION_ISOLATION=true` (the new default), each MCP session carves its own connection-alias namespace and its own default canvas — registered aliases, exchanged SGN/OAuth tokens, and `df_<uuid>` rows do not cross sessions. Stdio and stateless HTTP fall back to per-tenant keying. Set `BRAPI_SESSION_ISOLATION=false` to keep the pre-0.6 multi-agent collaboration model where every caller in a tenant shares one workspace.
|
|
9
|
+
|
|
10
|
+
## Added
|
|
11
|
+
|
|
12
|
+
- **`BRAPI_SESSION_ISOLATION` env var (default `true`).** New `sessionIsolation` field on `ServerConfigSchema`. When `true` and `ctx.sessionId` is present (HTTP stateful/auto), `ServerRegistry` keys connection state by `brapi/conn/sess/<sessionId>/<alias>` and `CanvasBridge` keys the default-canvas pointer by `brapi/canvas/sess/<sessionId>` — so concurrent HTTP callers under `MCP_AUTH_MODE=none` see their own aliases, tokens, and spilled rows. Falls back to the legacy tenant-keyed prefixes (`brapi/conn/<alias>`, `brapi/canvas/default`) for stdio, stateless HTTP, or when the flag is `false`. No effect on JWT/OAuth tenant keying — sessions add a sub-scope inside each tenant.
|
|
13
|
+
- **`ctx.sessionId` reference in `skills/api-context`.** New section covering when the field is defined (HTTP stateful/auto vs stdio/stateless), the `exposeStatelessSessionId` opt-in, the capability-token model, and recipes for strict (`if (!ctx.sessionId) throw invalidRequest(...)`) vs lax (fall back to a tenant-shared key) handling. Bumped to `1.3`.
|
|
14
|
+
- **Session-isolation tests.** New suites in `tests/services/server-registry.test.ts` and `tests/services/canvas-bridge.test.ts` covering: same-tenant sessions land on disjoint buckets, same-session requests share state, one session's alias / dataframe is unreachable from another, undefined `sessionId` falls back to tenant keying, `BRAPI_SESSION_ISOLATION=false` collapses everyone onto the shared workspace.
|
|
15
|
+
|
|
16
|
+
## Changed
|
|
17
|
+
|
|
18
|
+
- **`ServerRegistry` keying refactor.** `connKey(ctx, alias)` and the new `list()` prefix both route through a private `scopePrefix(ctx)` helper — single source of truth for the session-vs-tenant decision, no logic duplication. `register`, `get`, `getOptional`, `list`, and `unregister` all honor the keying scheme uniformly.
|
|
19
|
+
- **`CanvasBridge.getInstance` keying.** The cached default-canvas pointer now reads from `defaultCanvasKey(ctx)` instead of a single constant; same scoping rule (session-when-on, tenant-otherwise). Stale-id recovery (NotFound on acquire → clear cache and re-acquire) honors the keyed slot, so a stale token from one session doesn't leak across.
|
|
20
|
+
- **`Dockerfile` default session mode `stateless` → `stateful`.** Engages `mcp-session-id` lifecycle and hijack protection in the container image — precondition for `BRAPI_SESSION_ISOLATION=true` to actually scope per session. Operators that want the older stateless behavior can override with `-e MCP_SESSION_MODE=stateless` at run time.
|
|
21
|
+
- **README rewritten around three deployment shapes.** Replaces the previous shared-trust-vs-per-user table with three rows: **Per-session (default)** for multi-user shared-trust HTTP without SSO, **Per-user credentials** for institutional JWT/OAuth, **Shared workspace (legacy)** for one-researcher / parallel-agent setups under `BRAPI_SESSION_ISOLATION=false`. Multi-agent workflows section updated to reflect the new (tenant, session) bucket model. Inline references to `MCP_SESSION_MODE` clarify the `auto` default and the precondition for session-keyed isolation.
|
|
22
|
+
|
|
23
|
+
## Dependencies
|
|
24
|
+
|
|
25
|
+
- **`@cyanheads/mcp-ts-core` ^0.8.16 → ^0.8.17.** Picks up the upstream `ctx.sessionId` field on the `Context` interface and the framework's session-binding plumbing for HTTP stateful/auto transports.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* @module config/server-config
|
|
9
9
|
*/
|
|
10
10
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
11
|
-
declare const ServerConfigSchema: z.ZodObject<{
|
|
11
|
+
export declare const ServerConfigSchema: z.ZodObject<{
|
|
12
12
|
defaultBaseUrl: z.ZodOptional<z.ZodString>;
|
|
13
13
|
defaultUsername: z.ZodOptional<z.ZodString>;
|
|
14
14
|
defaultPassword: z.ZodOptional<z.ZodString>;
|
|
@@ -42,10 +42,13 @@ declare const ServerConfigSchema: z.ZodObject<{
|
|
|
42
42
|
exportDir: z.ZodOptional<z.ZodString>;
|
|
43
43
|
canvasMaxRows: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
44
44
|
canvasQueryTimeoutMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
45
|
+
sessionIsolation: z.ZodPipe<z.ZodDefault<z.ZodEnum<{
|
|
46
|
+
true: "true";
|
|
47
|
+
false: "false";
|
|
48
|
+
}>>, z.ZodTransform<boolean, "true" | "false">>;
|
|
45
49
|
}, z.core.$strip>;
|
|
46
50
|
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
47
51
|
export declare function getServerConfig(): ServerConfig;
|
|
48
52
|
/** Test-only — reset the lazy cache between suites. */
|
|
49
53
|
export declare function resetServerConfig(): void;
|
|
50
|
-
export {};
|
|
51
54
|
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoJ7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,wBAAgB,eAAe,IAAI,YAAY,CA6B9C;AAED,uDAAuD;AACvD,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
11
11
|
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
12
|
-
const ServerConfigSchema = z.object({
|
|
12
|
+
export const ServerConfigSchema = z.object({
|
|
13
13
|
defaultBaseUrl: z
|
|
14
14
|
.string()
|
|
15
15
|
.url()
|
|
@@ -131,6 +131,11 @@ const ServerConfigSchema = z.object({
|
|
|
131
131
|
.positive()
|
|
132
132
|
.default(30_000)
|
|
133
133
|
.describe('Per-query wall-clock timeout for brapi_dataframe_query.'),
|
|
134
|
+
sessionIsolation: z
|
|
135
|
+
.enum(['true', 'false'])
|
|
136
|
+
.default('true')
|
|
137
|
+
.transform((v) => v === 'true')
|
|
138
|
+
.describe('When true (default) and an MCP session ID is present (HTTP stateful/auto), scope ServerRegistry connection state and the CanvasBridge default canvas to the session. Concurrent HTTP callers under MCP_AUTH_MODE=none then operate in isolated workspaces — registered aliases, exchanged tokens, and df_<uuid> namespaces do not cross sessions. Set to false to share state across sessions in one tenant (the pre-0.6 multi-agent collaboration model). No effect on stdio (no session) or HTTP stateless without exposeStatelessSessionId; both fall back to per-tenant keying. Under MCP_AUTH_MODE=jwt|oauth, tenants already isolate — sessions add a sub-scope inside each tenant.'),
|
|
134
139
|
});
|
|
135
140
|
let _config;
|
|
136
141
|
export function getServerConfig() {
|
|
@@ -159,6 +164,7 @@ export function getServerConfig() {
|
|
|
159
164
|
exportDir: 'BRAPI_EXPORT_DIR',
|
|
160
165
|
canvasMaxRows: 'BRAPI_CANVAS_MAX_ROWS',
|
|
161
166
|
canvasQueryTimeoutMs: 'BRAPI_CANVAS_QUERY_TIMEOUT_MS',
|
|
167
|
+
sessionIsolation: 'BRAPI_SESSION_ISOLATION',
|
|
162
168
|
});
|
|
163
169
|
return _config;
|
|
164
170
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,C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OAAO,GAAG,SAAS,CAAC;AACtB,CAAC"}
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
* @module mcp-server/tools/definitions/brapi-dataframe-describe.tool
|
|
13
13
|
*/
|
|
14
14
|
import { z } from '@cyanheads/mcp-ts-core';
|
|
15
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
15
16
|
export declare const brapiDataframeDescribe: import("@cyanheads/mcp-ts-core").ToolDefinition<z.ZodObject<{
|
|
16
17
|
dataframe: z.ZodOptional<z.ZodString>;
|
|
17
18
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -32,5 +33,10 @@ export declare const brapiDataframeDescribe: import("@cyanheads/mcp-ts-core").To
|
|
|
32
33
|
expiresAt: z.ZodString;
|
|
33
34
|
}, z.core.$strip>>;
|
|
34
35
|
}, z.core.$strip>>;
|
|
35
|
-
}, z.core.$strip>,
|
|
36
|
+
}, z.core.$strip>, readonly [{
|
|
37
|
+
readonly reason: "list_all_disabled_on_shared_http";
|
|
38
|
+
readonly code: JsonRpcErrorCode.Forbidden;
|
|
39
|
+
readonly when: "Running under MCP_AUTH_MODE=none on HTTP transport — listing every dataframe would expose other concurrent clients' workspaces, since all callers resolve to one shared tenant.";
|
|
40
|
+
readonly recovery: "Pass `dataframe` with a specific name — either from a prior find_* spillover result (`result.dataframe.tableName`) or one you registered via `brapi_dataframe_query` with `registerAs`. Listing all dataframes is not available.";
|
|
41
|
+
}]>;
|
|
36
42
|
//# sourceMappingURL=brapi-dataframe-describe.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brapi-dataframe-describe.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"brapi-dataframe-describe.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AA6CjE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;GAkCjC,CAAC"}
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
* @module mcp-server/tools/definitions/brapi-dataframe-describe.tool
|
|
13
13
|
*/
|
|
14
14
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
15
|
+
import { config } from '@cyanheads/mcp-ts-core/config';
|
|
16
|
+
import { JsonRpcErrorCode } from '@cyanheads/mcp-ts-core/errors';
|
|
15
17
|
import { getCanvasBridge } from '../../../services/canvas-bridge/index.js';
|
|
16
18
|
const ColumnSchema = z.object({
|
|
17
19
|
name: z.string().describe('Column name.'),
|
|
@@ -49,11 +51,26 @@ const InputSchema = z.object({
|
|
|
49
51
|
.describe('When set, return only the named dataframe. Omit to list all dataframes.'),
|
|
50
52
|
});
|
|
51
53
|
export const brapiDataframeDescribe = tool('brapi_dataframe_describe', {
|
|
52
|
-
description: 'Start here after a spillover. Lists dataframes (or describes one) with columns, row counts, and originating-source provenance. The
|
|
54
|
+
description: 'Start here after a spillover. Lists dataframes (or describes one) with columns, row counts, and originating-source provenance. The dataframe name appears inline on every find_* response that spilled (`result.dataframe.tableName`) — pass it as `dataframe` to inspect schema and provenance before writing the first brapi_dataframe_query. Listing without a name is gated under shared-tenant HTTP (`MCP_AUTH_MODE=none`); pass a known name instead.',
|
|
53
55
|
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false },
|
|
56
|
+
errors: [
|
|
57
|
+
{
|
|
58
|
+
reason: 'list_all_disabled_on_shared_http',
|
|
59
|
+
code: JsonRpcErrorCode.Forbidden,
|
|
60
|
+
when: "Running under MCP_AUTH_MODE=none on HTTP transport — listing every dataframe would expose other concurrent clients' workspaces, since all callers resolve to one shared tenant.",
|
|
61
|
+
recovery: 'Pass `dataframe` with a specific name — either from a prior find_* spillover result (`result.dataframe.tableName`) or one you registered via `brapi_dataframe_query` with `registerAs`. Listing all dataframes is not available.',
|
|
62
|
+
},
|
|
63
|
+
],
|
|
54
64
|
input: InputSchema,
|
|
55
65
|
output: OutputSchema,
|
|
56
66
|
async handler(input, ctx) {
|
|
67
|
+
if (input.dataframe === undefined &&
|
|
68
|
+
ctx.tenantId === 'default' &&
|
|
69
|
+
config.mcpTransportType === 'http') {
|
|
70
|
+
throw ctx.fail('list_all_disabled_on_shared_http', undefined, {
|
|
71
|
+
...ctx.recoveryFor('list_all_disabled_on_shared_http'),
|
|
72
|
+
});
|
|
73
|
+
}
|
|
57
74
|
const bridge = getCanvasBridge();
|
|
58
75
|
const describeOpts = {};
|
|
59
76
|
if (input.dataframe !== undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brapi-dataframe-describe.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACvF,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CAChF,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACh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S,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,yEAAyE,CAAC;CACvF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,0BAA0B,EAAE;IACrE,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"brapi-dataframe-describe.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-describe.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC;IACzC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,4DAA4D,CAAC;IACvF,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;CAChF,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,QAAQ,CAAC,sEAAsE,CAAC;IACnF,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACzE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;IACjE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,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KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;YAC3D,KAAK,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;YAC3D,KAAK,CAAC,IAAI,CAAC,gBAAgB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brapi-dataframe-query.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAO/D,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"brapi-dataframe-query.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAsB,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAO/D,OAAO,EAAE,gBAAgB,EAAY,MAAM,+BAA+B,CAAC;AAmH3E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;GAmE9B,CAAC"}
|
|
@@ -25,15 +25,11 @@
|
|
|
25
25
|
import { tool, z } from '@cyanheads/mcp-ts-core';
|
|
26
26
|
import { inferSchemaFromRows, SQL_GATE_REASONS, } from '@cyanheads/mcp-ts-core/canvas';
|
|
27
27
|
import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
|
|
28
|
-
import { getCanvasBridge } from '../../../services/canvas-bridge/index.js';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
* `sql_rejected` contract reason while preserving the granular gate reason
|
|
34
|
-
* on `data.gateReason`.
|
|
35
|
-
*/
|
|
36
|
-
const KNOWN_GATE_REASONS = new Set(Object.values(SQL_GATE_REASONS));
|
|
28
|
+
import { getCanvasBridge, SYSTEM_CATALOG_ACCESS_REASON, } from '../../../services/canvas-bridge/index.js';
|
|
29
|
+
const KNOWN_GATE_REASONS = new Set([
|
|
30
|
+
...Object.values(SQL_GATE_REASONS),
|
|
31
|
+
SYSTEM_CATALOG_ACCESS_REASON,
|
|
32
|
+
]);
|
|
37
33
|
function extractSqlGateReason(err) {
|
|
38
34
|
if (!(err instanceof McpError))
|
|
39
35
|
return;
|
|
@@ -44,6 +40,23 @@ function extractSqlGateReason(err) {
|
|
|
44
40
|
? reason
|
|
45
41
|
: undefined;
|
|
46
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Forward the gate's structured context (e.g. `catalog` for system_catalog_access,
|
|
45
|
+
* `operators` for plan_operator_not_allowed, `statementType` for non_select_statement)
|
|
46
|
+
* so structured-only consumers see which specific element matched without parsing
|
|
47
|
+
* the message text. `reason` becomes `gateReason` upstream; `recovery` is
|
|
48
|
+
* overridden by the contract recovery hint.
|
|
49
|
+
*/
|
|
50
|
+
function extractGateContext(err) {
|
|
51
|
+
if (!(err instanceof McpError) || err.data === null || typeof err.data !== 'object')
|
|
52
|
+
return {};
|
|
53
|
+
const out = {};
|
|
54
|
+
for (const [k, v] of Object.entries(err.data)) {
|
|
55
|
+
if (k !== 'reason' && k !== 'recovery')
|
|
56
|
+
out[k] = v;
|
|
57
|
+
}
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
47
60
|
const InputSchema = z.object({
|
|
48
61
|
sql: z
|
|
49
62
|
.string()
|
|
@@ -94,7 +107,7 @@ const OutputSchema = z.object({
|
|
|
94
107
|
.describe('Name of the dataframe holding the full result, populated when `registerAs` was supplied. Reference this name in follow-up queries.'),
|
|
95
108
|
});
|
|
96
109
|
export const brapiDataframeQuery = tool('brapi_dataframe_query', {
|
|
97
|
-
description: 'Run SQL across in-memory dataframes. Dataframes auto-populate when find_* tools spill (named `df_<uuid>`)
|
|
110
|
+
description: 'Run SQL across in-memory dataframes. Dataframes auto-populate when find_* tools spill (named `df_<uuid>`) — the dataframe name appears inline on every find_* response that spilled (`result.dataframe.tableName`), so the typical flow is find_* → read the name → query here. Use brapi_dataframe_describe to inspect schema and provenance for a known name. SELECT only — writes/DDL/COPY/PRAGMA/ATTACH/file-reads are rejected. Use SQL as the paging idiom: `LIMIT/OFFSET` to walk results, projection to trim columns, aggregation to summarize. Use `registerAs` to chain — the result lands as a new dataframe.',
|
|
98
111
|
annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: false },
|
|
99
112
|
errors: [
|
|
100
113
|
{
|
|
@@ -126,7 +139,7 @@ export const brapiDataframeQuery = tool('brapi_dataframe_query', {
|
|
|
126
139
|
if (gateReason === undefined)
|
|
127
140
|
throw err;
|
|
128
141
|
const message = err instanceof Error ? err.message : 'Query rejected.';
|
|
129
|
-
throw ctx.fail('sql_rejected', message, { gateReason, ...ctx.recoveryFor('sql_rejected') }, { cause: err });
|
|
142
|
+
throw ctx.fail('sql_rejected', message, { gateReason, ...extractGateContext(err), ...ctx.recoveryFor('sql_rejected') }, { cause: err });
|
|
130
143
|
}
|
|
131
144
|
let typedColumns;
|
|
132
145
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brapi-dataframe-query.tool.js","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-dataframe-query.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAgB,IAAI,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EACL,mBAAmB,EAEnB,gBAAgB,GAEjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,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ACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACtB,KAAK,MAAM,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;QAC7C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAC/B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC5B,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI;gBAAE,SAAS;YACpD,MAAM,QAAQ,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACnF,KAAK,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,OAAO,QAAQ,EAAE,CAAC,CAAC;QAC/C,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -321,7 +321,12 @@ export declare const readOnlyToolDefinitions: (import("@cyanheads/mcp-ts-core").
|
|
|
321
321
|
expiresAt: import("zod").ZodString;
|
|
322
322
|
}, import("zod/v4/core").$strip>>;
|
|
323
323
|
}, import("zod/v4/core").$strip>>;
|
|
324
|
-
}, import("zod/v4/core").$strip>,
|
|
324
|
+
}, import("zod/v4/core").$strip>, readonly [{
|
|
325
|
+
readonly reason: "list_all_disabled_on_shared_http";
|
|
326
|
+
readonly code: import("@cyanheads/mcp-ts-core/errors").JsonRpcErrorCode.Forbidden;
|
|
327
|
+
readonly when: "Running under MCP_AUTH_MODE=none on HTTP transport — listing every dataframe would expose other concurrent clients' workspaces, since all callers resolve to one shared tenant.";
|
|
328
|
+
readonly recovery: "Pass `dataframe` with a specific name — either from a prior find_* spillover result (`result.dataframe.tableName`) or one you registered via `brapi_dataframe_query` with `registerAs`. Listing all dataframes is not available.";
|
|
329
|
+
}]> | import("@cyanheads/mcp-ts-core").ToolDefinition<import("zod").ZodObject<{
|
|
325
330
|
sql: import("zod").ZodString;
|
|
326
331
|
registerAs: import("zod").ZodOptional<import("zod").ZodString>;
|
|
327
332
|
preview: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAyBH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAyBH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAoBnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;;8CAAuB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAAyB,CAAC;AAE5D,qEAAqE;AACrE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAA4B,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview CanvasBridge — server-side adapter over the framework's
|
|
3
3
|
* `DataCanvas` primitive. Owns three concerns the framework leaves to the
|
|
4
|
-
* consumer: (1)
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* consumer: (1) default canvas resolution (per-session under
|
|
5
|
+
* `BRAPI_SESSION_ISOLATION=true` with a present `ctx.sessionId`, per-tenant
|
|
6
|
+
* otherwise; the agent never passes `canvas_id`, the bridge caches and reuses
|
|
7
|
+
* it via `ctx.state`), (2) generating SQL-safe `df_<uuid>` table names for
|
|
8
|
+
* spilled find_* results, and (3) tracking originating-source provenance so
|
|
9
|
+
* `brapi_dataframe_describe` can surface it.
|
|
8
10
|
*
|
|
9
11
|
* Canvas is mandatory — `core.canvas` must be configured (DuckDB) for the
|
|
10
12
|
* server to start. There is no on/off toggle; spillover always lands on the
|
|
@@ -41,19 +43,37 @@ export interface RegisterDataframeResult {
|
|
|
41
43
|
tableName: string;
|
|
42
44
|
truncated?: boolean;
|
|
43
45
|
}
|
|
44
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Bridge for `core.canvas` that adds default-canvas semantics — session-scoped
|
|
48
|
+
* under `BRAPI_SESSION_ISOLATION=true` with a present `ctx.sessionId`,
|
|
49
|
+
* tenant-scoped otherwise.
|
|
50
|
+
*/
|
|
45
51
|
export declare class CanvasBridge {
|
|
46
52
|
private readonly canvas;
|
|
47
53
|
private readonly serverConfig;
|
|
48
54
|
constructor(canvas: DataCanvas, serverConfig: ServerConfig);
|
|
49
55
|
/**
|
|
50
|
-
* Acquire the
|
|
51
|
-
* `ctx.state` so subsequent calls reuse the same canvas (sliding TTL on
|
|
52
|
-
* canvas itself keeps it warm). On stale-id errors (NotFound), clears
|
|
53
|
-
* cache and acquires a fresh canvas — matches the spirit of the
|
|
54
|
-
* "omit on retry" recovery hint without surfacing the token to
|
|
56
|
+
* Acquire the default canvas for the current request. The canvasId is cached
|
|
57
|
+
* in `ctx.state` so subsequent calls reuse the same canvas (sliding TTL on
|
|
58
|
+
* the canvas itself keeps it warm). On stale-id errors (NotFound), clears
|
|
59
|
+
* the cache and acquires a fresh canvas — matches the spirit of the
|
|
60
|
+
* framework's "omit on retry" recovery hint without surfacing the token to
|
|
61
|
+
* the agent.
|
|
62
|
+
*
|
|
63
|
+
* Scope follows `BRAPI_SESSION_ISOLATION`: when true (default) and
|
|
64
|
+
* `ctx.sessionId` is present, the canvas is session-scoped — the cache key
|
|
65
|
+
* folds the session ID in, so concurrent HTTP sessions in the same tenant
|
|
66
|
+
* end up on distinct canvases. When isolation is disabled or no session ID
|
|
67
|
+
* is available (stdio, stateless HTTP without opt-in), falls back to the
|
|
68
|
+
* legacy per-tenant shared canvas.
|
|
55
69
|
*/
|
|
56
70
|
getInstance(ctx: Context): Promise<CanvasInstance>;
|
|
71
|
+
/**
|
|
72
|
+
* Resolve the cache key for the default-canvas pointer. Session-scoped when
|
|
73
|
+
* `BRAPI_SESSION_ISOLATION=true` and `ctx.sessionId` is present; per-tenant
|
|
74
|
+
* otherwise. See `getInstance` for the full scoping rules.
|
|
75
|
+
*/
|
|
76
|
+
private defaultCanvasKey;
|
|
57
77
|
/**
|
|
58
78
|
* Materialize a spilled `find_*` result as a canvas dataframe. Generates a
|
|
59
79
|
* `df_<uuid>` table name, registers the rows with an all-nullable schema,
|
|
@@ -62,10 +82,18 @@ export declare class CanvasBridge {
|
|
|
62
82
|
*/
|
|
63
83
|
registerDataframe(ctx: Context, input: RegisterDataframeInput): Promise<RegisterDataframeResult>;
|
|
64
84
|
/**
|
|
65
|
-
* Run a SQL query against the
|
|
85
|
+
* Run a SQL query against the default canvas (see `getInstance` for the
|
|
86
|
+
* session-vs-tenant scoping rules). Caps `rowLimit` to
|
|
66
87
|
* `BRAPI_CANVAS_MAX_ROWS` so a missing/excessive caller value can't bypass
|
|
67
88
|
* the response-size budget. Cancellation flows through `ctx.signal`; the
|
|
68
89
|
* timeout wraps the AbortSignal with a wall-clock cap.
|
|
90
|
+
*
|
|
91
|
+
* Pre-gate: rejects SQL that reaches into DuckDB's system catalogs
|
|
92
|
+
* (`information_schema`, `pg_catalog`, `sqlite_master`, `duckdb_*` metadata
|
|
93
|
+
* functions). Under shared-tenant deployments the canvas hosts every
|
|
94
|
+
* caller's dataframes; without this gate, `SELECT * FROM information_schema.tables`
|
|
95
|
+
* leaks the full df_<uuid> namespace and bypasses brapi_dataframe_describe's
|
|
96
|
+
* possession-required policy.
|
|
69
97
|
*/
|
|
70
98
|
query(ctx: Context, sql: string, options?: {
|
|
71
99
|
preview?: number;
|
|
@@ -113,6 +141,13 @@ export declare class CanvasBridge {
|
|
|
113
141
|
}): Promise<DescribedTable[]>;
|
|
114
142
|
private augmentTableInfo;
|
|
115
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Reason string set on `validationError.data.reason` when a query is rejected
|
|
146
|
+
* for reaching into DuckDB's system catalogs. Exported so the dataframe-query
|
|
147
|
+
* tool can recognize it alongside the framework's `SQL_GATE_REASONS` and route
|
|
148
|
+
* it through the typed `sql_rejected` contract.
|
|
149
|
+
*/
|
|
150
|
+
export declare const SYSTEM_CATALOG_ACCESS_REASON: "system_catalog_access";
|
|
116
151
|
/**
|
|
117
152
|
* Initialize the singleton bridge. The framework canvas is mandatory — the
|
|
118
153
|
* caller is responsible for ensuring `core.canvas` is defined before this
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-bridge.d.ts","sourceRoot":"","sources":["../../../src/services/canvas-bridge/canvas-bridge.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"canvas-bridge.d.ts","sourceRoot":"","sources":["../../../src/services/canvas-bridge/canvas-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,KAAK,EACV,cAAc,EAGd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,mBAAmB,EAEpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAmB,cAAc,EAAE,MAAM,YAAY,CAAC;AAkDlE,uDAAuD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erns the framework leaves to the
|
|
4
|
-
* consumer: (1)
|
|
5
|
-
* `
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* consumer: (1) default canvas resolution (per-session under
|
|
5
|
+
* `BRAPI_SESSION_ISOLATION=true` with a present `ctx.sessionId`, per-tenant
|
|
6
|
+
* otherwise; the agent never passes `canvas_id`, the bridge caches and reuses
|
|
7
|
+
* it via `ctx.state`), (2) generating SQL-safe `df_<uuid>` table names for
|
|
8
|
+
* spilled find_* results, and (3) tracking originating-source provenance so
|
|
9
|
+
* `brapi_dataframe_describe` can surface it.
|
|
8
10
|
*
|
|
9
11
|
* Canvas is mandatory — `core.canvas` must be configured (DuckDB) for the
|
|
10
12
|
* server to start. There is no on/off toggle; spillover always lands on the
|
|
@@ -13,7 +15,7 @@
|
|
|
13
15
|
* @module services/canvas-bridge/canvas-bridge
|
|
14
16
|
*/
|
|
15
17
|
import { unlink } from 'node:fs/promises';
|
|
16
|
-
import { JsonRpcErrorCode, McpError } from '@cyanheads/mcp-ts-core/errors';
|
|
18
|
+
import { JsonRpcErrorCode, McpError, validationError } from '@cyanheads/mcp-ts-core/errors';
|
|
17
19
|
/**
|
|
18
20
|
* Construct a `RequestContext` slice from the handler `Context`. The
|
|
19
21
|
* framework's `RequestContext` carries an `[key: string]: unknown` index
|
|
@@ -33,8 +35,20 @@ function asRequestContext(ctx) {
|
|
|
33
35
|
rc.spanId = ctx.spanId;
|
|
34
36
|
return rc;
|
|
35
37
|
}
|
|
36
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* State keys holding the default canvasId (opaque 10-char token).
|
|
40
|
+
*
|
|
41
|
+
* `DEFAULT_CANVAS_KEY` keys the per-tenant default canvas — the legacy
|
|
42
|
+
* shared workspace; used for stdio, stateless HTTP without opt-in, and any
|
|
43
|
+
* deployment where `BRAPI_SESSION_ISOLATION=false`.
|
|
44
|
+
*
|
|
45
|
+
* `SESSION_CANVAS_PREFIX` keys per-session canvases when isolation is on
|
|
46
|
+
* and `ctx.sessionId` is present. Each session gets its own canvas and
|
|
47
|
+
* therefore its own `df_<uuid>` namespace, so concurrent HTTP callers
|
|
48
|
+
* under `MCP_AUTH_MODE=none` don't see each other's spilled rows.
|
|
49
|
+
*/
|
|
37
50
|
const DEFAULT_CANVAS_KEY = 'brapi/canvas/default';
|
|
51
|
+
const SESSION_CANVAS_PREFIX = 'brapi/canvas/sess/';
|
|
38
52
|
/** Prefix for per-table provenance entries — keyed by canvas table name. */
|
|
39
53
|
const TABLE_META_PREFIX = 'brapi/canvas/tablemeta/';
|
|
40
54
|
/**
|
|
@@ -48,7 +62,11 @@ const TABLE_META_PREFIX = 'brapi/canvas/tablemeta/';
|
|
|
48
62
|
const EXPORT_PATHS_PREFIX = 'brapi/canvas/exports/';
|
|
49
63
|
/** Auto-registered dataframe-table prefix. Anything else is user-derived (registerAs). */
|
|
50
64
|
const DATAFRAME_TABLE_PREFIX = 'df_';
|
|
51
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Bridge for `core.canvas` that adds default-canvas semantics — session-scoped
|
|
67
|
+
* under `BRAPI_SESSION_ISOLATION=true` with a present `ctx.sessionId`,
|
|
68
|
+
* tenant-scoped otherwise.
|
|
69
|
+
*/
|
|
52
70
|
export class CanvasBridge {
|
|
53
71
|
canvas;
|
|
54
72
|
serverConfig;
|
|
@@ -57,31 +75,51 @@ export class CanvasBridge {
|
|
|
57
75
|
this.serverConfig = serverConfig;
|
|
58
76
|
}
|
|
59
77
|
/**
|
|
60
|
-
* Acquire the
|
|
61
|
-
* `ctx.state` so subsequent calls reuse the same canvas (sliding TTL on
|
|
62
|
-
* canvas itself keeps it warm). On stale-id errors (NotFound), clears
|
|
63
|
-
* cache and acquires a fresh canvas — matches the spirit of the
|
|
64
|
-
* "omit on retry" recovery hint without surfacing the token to
|
|
78
|
+
* Acquire the default canvas for the current request. The canvasId is cached
|
|
79
|
+
* in `ctx.state` so subsequent calls reuse the same canvas (sliding TTL on
|
|
80
|
+
* the canvas itself keeps it warm). On stale-id errors (NotFound), clears
|
|
81
|
+
* the cache and acquires a fresh canvas — matches the spirit of the
|
|
82
|
+
* framework's "omit on retry" recovery hint without surfacing the token to
|
|
83
|
+
* the agent.
|
|
84
|
+
*
|
|
85
|
+
* Scope follows `BRAPI_SESSION_ISOLATION`: when true (default) and
|
|
86
|
+
* `ctx.sessionId` is present, the canvas is session-scoped — the cache key
|
|
87
|
+
* folds the session ID in, so concurrent HTTP sessions in the same tenant
|
|
88
|
+
* end up on distinct canvases. When isolation is disabled or no session ID
|
|
89
|
+
* is available (stdio, stateless HTTP without opt-in), falls back to the
|
|
90
|
+
* legacy per-tenant shared canvas.
|
|
65
91
|
*/
|
|
66
92
|
async getInstance(ctx) {
|
|
67
|
-
const
|
|
93
|
+
const key = this.defaultCanvasKey(ctx);
|
|
94
|
+
const cached = await ctx.state.get(key);
|
|
68
95
|
try {
|
|
69
96
|
const instance = await this.canvas.acquire(cached ?? undefined, asRequestContext(ctx));
|
|
70
97
|
if (!cached || instance.isNew) {
|
|
71
|
-
await ctx.state.set(
|
|
98
|
+
await ctx.state.set(key, instance.canvasId);
|
|
72
99
|
}
|
|
73
100
|
return instance;
|
|
74
101
|
}
|
|
75
102
|
catch (err) {
|
|
76
103
|
if (cached && isCanvasNotFound(err)) {
|
|
77
|
-
await ctx.state.delete(
|
|
104
|
+
await ctx.state.delete(key);
|
|
78
105
|
const fresh = await this.canvas.acquire(undefined, asRequestContext(ctx));
|
|
79
|
-
await ctx.state.set(
|
|
106
|
+
await ctx.state.set(key, fresh.canvasId);
|
|
80
107
|
return fresh;
|
|
81
108
|
}
|
|
82
109
|
throw err;
|
|
83
110
|
}
|
|
84
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Resolve the cache key for the default-canvas pointer. Session-scoped when
|
|
114
|
+
* `BRAPI_SESSION_ISOLATION=true` and `ctx.sessionId` is present; per-tenant
|
|
115
|
+
* otherwise. See `getInstance` for the full scoping rules.
|
|
116
|
+
*/
|
|
117
|
+
defaultCanvasKey(ctx) {
|
|
118
|
+
if (this.serverConfig.sessionIsolation && ctx.sessionId) {
|
|
119
|
+
return `${SESSION_CANVAS_PREFIX}${ctx.sessionId}`;
|
|
120
|
+
}
|
|
121
|
+
return DEFAULT_CANVAS_KEY;
|
|
122
|
+
}
|
|
85
123
|
/**
|
|
86
124
|
* Materialize a spilled `find_*` result as a canvas dataframe. Generates a
|
|
87
125
|
* `df_<uuid>` table name, registers the rows with an all-nullable schema,
|
|
@@ -133,12 +171,21 @@ export class CanvasBridge {
|
|
|
133
171
|
return result;
|
|
134
172
|
}
|
|
135
173
|
/**
|
|
136
|
-
* Run a SQL query against the
|
|
174
|
+
* Run a SQL query against the default canvas (see `getInstance` for the
|
|
175
|
+
* session-vs-tenant scoping rules). Caps `rowLimit` to
|
|
137
176
|
* `BRAPI_CANVAS_MAX_ROWS` so a missing/excessive caller value can't bypass
|
|
138
177
|
* the response-size budget. Cancellation flows through `ctx.signal`; the
|
|
139
178
|
* timeout wraps the AbortSignal with a wall-clock cap.
|
|
179
|
+
*
|
|
180
|
+
* Pre-gate: rejects SQL that reaches into DuckDB's system catalogs
|
|
181
|
+
* (`information_schema`, `pg_catalog`, `sqlite_master`, `duckdb_*` metadata
|
|
182
|
+
* functions). Under shared-tenant deployments the canvas hosts every
|
|
183
|
+
* caller's dataframes; without this gate, `SELECT * FROM information_schema.tables`
|
|
184
|
+
* leaks the full df_<uuid> namespace and bypasses brapi_dataframe_describe's
|
|
185
|
+
* possession-required policy.
|
|
140
186
|
*/
|
|
141
187
|
async query(ctx, sql, options = {}) {
|
|
188
|
+
assertNoSystemCatalogAccess(sql);
|
|
142
189
|
const instance = await this.getInstance(ctx);
|
|
143
190
|
const cap = this.serverConfig.canvasMaxRows;
|
|
144
191
|
const rowLimit = Math.min(options.rowLimit ?? cap, cap);
|
|
@@ -268,6 +315,60 @@ export class CanvasBridge {
|
|
|
268
315
|
function generateDataframeName() {
|
|
269
316
|
return `${DATAFRAME_TABLE_PREFIX}${crypto.randomUUID().replace(/-/g, '_')}`;
|
|
270
317
|
}
|
|
318
|
+
/**
|
|
319
|
+
* Reason string set on `validationError.data.reason` when a query is rejected
|
|
320
|
+
* for reaching into DuckDB's system catalogs. Exported so the dataframe-query
|
|
321
|
+
* tool can recognize it alongside the framework's `SQL_GATE_REASONS` and route
|
|
322
|
+
* it through the typed `sql_rejected` contract.
|
|
323
|
+
*/
|
|
324
|
+
export const SYSTEM_CATALOG_ACCESS_REASON = 'system_catalog_access';
|
|
325
|
+
/**
|
|
326
|
+
* DuckDB metadata views and functions that enumerate the canvas. Catalog
|
|
327
|
+
* schemas are matched as qualified references (`schema.thing`) so legitimate
|
|
328
|
+
* column names like `information_schema_id` don't false-positive. DuckDB's
|
|
329
|
+
* `duckdb_*` introspection functions are matched at the call site (`name(`)
|
|
330
|
+
* so columns or projected literals carrying the same prefix don't trigger.
|
|
331
|
+
*/
|
|
332
|
+
const SYSTEM_CATALOG_PATTERNS = [
|
|
333
|
+
{ regex: /\binformation_schema\s*\.\s*\w+/i, label: 'information_schema' },
|
|
334
|
+
{ regex: /\bpg_catalog\s*\.\s*\w+/i, label: 'pg_catalog' },
|
|
335
|
+
{ regex: /\bsqlite_master\b/i, label: 'sqlite_master' },
|
|
336
|
+
{ regex: /\bsqlite_temp_master\b/i, label: 'sqlite_temp_master' },
|
|
337
|
+
{
|
|
338
|
+
regex: /\bduckdb_(?:tables|columns|views|databases|schemas|functions|types|secrets|extensions|settings|temporary_files|memory|approx_database_size|optimizers|prepared_statements|sequences|indexes|constraints|keywords|dependencies|log_contexts|logs|temp_files|temp_relations|sql_keywords|lib_versions)\s*\(/i,
|
|
339
|
+
label: 'duckdb_*',
|
|
340
|
+
},
|
|
341
|
+
];
|
|
342
|
+
/** Strip SQL block and line comments — mirror of the framework gate's helper. */
|
|
343
|
+
function stripSqlComments(sql) {
|
|
344
|
+
return sql.replace(/\/\*[\s\S]*?\*\//g, ' ').replace(/--[^\n]*/g, '');
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Strip standard SQL string literals so values that happen to mention catalog
|
|
348
|
+
* names (e.g. `WHERE col = 'information_schema.tables'`) don't trigger the
|
|
349
|
+
* deny. Matches single-quoted strings with `''` escape; mirror of the
|
|
350
|
+
* framework gate's helper.
|
|
351
|
+
*/
|
|
352
|
+
function stripSqlStringLiterals(sql) {
|
|
353
|
+
return sql.replace(/'(?:[^']|'')*'/g, "''");
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Reject SQL that reaches into DuckDB's system catalogs (information_schema,
|
|
357
|
+
* pg_catalog, sqlite_master, duckdb_* introspection functions). Possession of
|
|
358
|
+
* a `df_<uuid>` name is the capability gate for direct queries; system catalogs
|
|
359
|
+
* would let any caller list every name on the shared canvas, bypassing that
|
|
360
|
+
* gate. Throws `validationError` with `data.reason = 'system_catalog_access'`
|
|
361
|
+
* so the dataframe-query tool's contract translator routes it through
|
|
362
|
+
* `sql_rejected`.
|
|
363
|
+
*/
|
|
364
|
+
function assertNoSystemCatalogAccess(sql) {
|
|
365
|
+
const stripped = stripSqlStringLiterals(stripSqlComments(sql));
|
|
366
|
+
for (const { regex, label } of SYSTEM_CATALOG_PATTERNS) {
|
|
367
|
+
if (regex.test(stripped)) {
|
|
368
|
+
throw validationError(`Canvas query references a system catalog (${label}). System tables and metadata views are not accessible — use brapi_dataframe_describe with a specific dataframe name to inspect schema.`, { reason: SYSTEM_CATALOG_ACCESS_REASON, catalog: label });
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
271
372
|
function tableMetaKey(tableName) {
|
|
272
373
|
return `${TABLE_META_PREFIX}${tableName}`;
|
|
273
374
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas-bridge.js","sourceRoot":"","sources":["../../../src/services/canvas-bridge/canvas-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC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* @module services/canvas-bridge
|
|
5
5
|
*/
|
|
6
|
-
export { CanvasBridge, getCanvasBridge, initCanvasBridge, type RegisterDataframeInput, type RegisterDataframeResult, resetCanvasBridge, } from './canvas-bridge.js';
|
|
6
|
+
export { CanvasBridge, getCanvasBridge, initCanvasBridge, type RegisterDataframeInput, type RegisterDataframeResult, resetCanvasBridge, SYSTEM_CATALOG_ACCESS_REASON, } from './canvas-bridge.js';
|
|
7
7
|
export type { CanvasTableMeta, DescribedTable } from './types.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/canvas-bridge/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/services/canvas-bridge/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @module services/canvas-bridge
|
|
5
5
|
*/
|
|
6
|
-
export { CanvasBridge, getCanvasBridge, initCanvasBridge, resetCanvasBridge, } from './canvas-bridge.js';
|
|
6
|
+
export { CanvasBridge, getCanvasBridge, initCanvasBridge, resetCanvasBridge, SYSTEM_CATALOG_ACCESS_REASON, } from './canvas-bridge.js';
|
|
7
7
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/canvas-bridge/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAGhB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/services/canvas-bridge/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,EAGhB,iBAAiB,EACjB,4BAA4B,GAC7B,MAAM,oBAAoB,CAAC"}
|
|
@@ -33,6 +33,17 @@ export declare class ServerRegistry {
|
|
|
33
33
|
getOptional(ctx: Context, alias?: string): Promise<RegisteredServer | null>;
|
|
34
34
|
list(ctx: Context): Promise<RegisteredServer[]>;
|
|
35
35
|
unregister(ctx: Context, alias?: string): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the state-key prefix for the current ctx. Under
|
|
38
|
+
* `BRAPI_SESSION_ISOLATION=true` (default) and a present `ctx.sessionId`
|
|
39
|
+
* (HTTP stateful/auto), folds the session ID in so concurrent sessions in
|
|
40
|
+
* the same tenant don't share connection state. Falls back to the bare
|
|
41
|
+
* tenant prefix for stdio, stateless HTTP without opt-in, or when
|
|
42
|
+
* isolation is explicitly disabled. Used by both `connKey` (single-alias
|
|
43
|
+
* keys) and `list` (prefix scans).
|
|
44
|
+
*/
|
|
45
|
+
private scopePrefix;
|
|
46
|
+
private connKey;
|
|
36
47
|
private resolveAuth;
|
|
37
48
|
private exchangeSgnToken;
|
|
38
49
|
private exchangeOAuth2Token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-registry.d.ts","sourceRoot":"","sources":["../../../src/services/server-registry/server-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAStD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE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AO,CAAC,IAAI,CAAC;IAI5E;;;;;;;;OAQG;IACH,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,OAAO;YAID,WAAW;YA0BX,gBAAgB;YAqChB,mBAAmB;CAwClC;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,KACtD,OAAO,CAAC,aAAa,CAAC,CAAC;AAE5B,UAAU,aAAa;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAwFD,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG,IAAI,CAEnE;AAED,wBAAgB,iBAAiB,IAAI,cAAc,CAKlD;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -12,6 +12,7 @@ import { forbidden, notFound, serviceUnavailable, validationError, } from '@cyan
|
|
|
12
12
|
import { fetchWithTimeout } from '@cyanheads/mcp-ts-core/utils';
|
|
13
13
|
export const DEFAULT_ALIAS = 'default';
|
|
14
14
|
const CONN_PREFIX = 'brapi/conn/';
|
|
15
|
+
const SESSION_CONN_PREFIX = 'brapi/conn/sess/';
|
|
15
16
|
export class ServerRegistry {
|
|
16
17
|
serverConfig;
|
|
17
18
|
tokenFetcher;
|
|
@@ -38,12 +39,12 @@ export class ServerRegistry {
|
|
|
38
39
|
const resolvedAuth = await this.resolveAuth(auth, registered.baseUrl, ctx);
|
|
39
40
|
if (resolvedAuth)
|
|
40
41
|
registered.resolvedAuth = resolvedAuth;
|
|
41
|
-
await ctx.state.set(connKey(alias), registered);
|
|
42
|
+
await ctx.state.set(this.connKey(ctx, alias), registered);
|
|
42
43
|
return registered;
|
|
43
44
|
}
|
|
44
45
|
/** Fetch a registered connection or throw `NotFound`. */
|
|
45
46
|
async get(ctx, alias = DEFAULT_ALIAS) {
|
|
46
|
-
const entry = await ctx.state.get(connKey(alias));
|
|
47
|
+
const entry = await ctx.state.get(this.connKey(ctx, alias));
|
|
47
48
|
if (!entry) {
|
|
48
49
|
throw notFound(`No BrAPI connection registered under alias '${alias}'. Call brapi_connect first.`, { alias, reason: 'unknown_alias' });
|
|
49
50
|
}
|
|
@@ -51,16 +52,17 @@ export class ServerRegistry {
|
|
|
51
52
|
}
|
|
52
53
|
/** Non-throwing variant of `get`. */
|
|
53
54
|
getOptional(ctx, alias = DEFAULT_ALIAS) {
|
|
54
|
-
return ctx.state.get(connKey(alias));
|
|
55
|
+
return ctx.state.get(this.connKey(ctx, alias));
|
|
55
56
|
}
|
|
56
57
|
async list(ctx) {
|
|
57
58
|
const servers = [];
|
|
58
59
|
let cursor;
|
|
60
|
+
const prefix = this.scopePrefix(ctx);
|
|
59
61
|
do {
|
|
60
62
|
const listOpts = { limit: 100 };
|
|
61
63
|
if (cursor !== undefined)
|
|
62
64
|
listOpts.cursor = cursor;
|
|
63
|
-
const page = await ctx.state.list(
|
|
65
|
+
const page = await ctx.state.list(prefix, listOpts);
|
|
64
66
|
for (const item of page.items) {
|
|
65
67
|
if (isRegisteredServer(item.value))
|
|
66
68
|
servers.push(item.value);
|
|
@@ -70,7 +72,25 @@ export class ServerRegistry {
|
|
|
70
72
|
return servers;
|
|
71
73
|
}
|
|
72
74
|
async unregister(ctx, alias = DEFAULT_ALIAS) {
|
|
73
|
-
await ctx.state.delete(connKey(alias));
|
|
75
|
+
await ctx.state.delete(this.connKey(ctx, alias));
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resolve the state-key prefix for the current ctx. Under
|
|
79
|
+
* `BRAPI_SESSION_ISOLATION=true` (default) and a present `ctx.sessionId`
|
|
80
|
+
* (HTTP stateful/auto), folds the session ID in so concurrent sessions in
|
|
81
|
+
* the same tenant don't share connection state. Falls back to the bare
|
|
82
|
+
* tenant prefix for stdio, stateless HTTP without opt-in, or when
|
|
83
|
+
* isolation is explicitly disabled. Used by both `connKey` (single-alias
|
|
84
|
+
* keys) and `list` (prefix scans).
|
|
85
|
+
*/
|
|
86
|
+
scopePrefix(ctx) {
|
|
87
|
+
if (this.serverConfig.sessionIsolation && ctx.sessionId) {
|
|
88
|
+
return `${SESSION_CONN_PREFIX}${ctx.sessionId}/`;
|
|
89
|
+
}
|
|
90
|
+
return CONN_PREFIX;
|
|
91
|
+
}
|
|
92
|
+
connKey(ctx, alias) {
|
|
93
|
+
return `${this.scopePrefix(ctx)}${alias}`;
|
|
74
94
|
}
|
|
75
95
|
async resolveAuth(auth, baseUrl, ctx) {
|
|
76
96
|
switch (auth.mode) {
|
|
@@ -188,9 +208,6 @@ const defaultTokenFetcher = async (url, body, ctx, options) => {
|
|
|
188
208
|
throw serviceUnavailable('Token exchange returned non-JSON response', { tokenUrl: url, bodyPreview: text.slice(0, 200) }, { cause: err });
|
|
189
209
|
}
|
|
190
210
|
};
|
|
191
|
-
function connKey(alias) {
|
|
192
|
-
return `${CONN_PREFIX}${alias}`;
|
|
193
|
-
}
|
|
194
211
|
function validateAlias(alias) {
|
|
195
212
|
if (!/^[a-zA-Z0-9_-]+$/.test(alias)) {
|
|
196
213
|
throw validationError(`Invalid connection alias '${alias}'. Use letters, digits, '_', or '-'.`, { alias });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-registry.js","sourceRoot":"","sources":["../../../src/services/server-registry/server-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKhE,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC,MAAM,WAAW,GAAG,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"server-registry.js","sourceRoot":"","sources":["../../../src/services/server-registry/server-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,eAAe,GAChB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKhE,MAAM,CAAC,MAAM,aAAa,GAAG,SAAS,CAAC;AAEvC,MAAM,WAAW,GAAG,aAAa,CAAC;AAClC,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;AAQ/C,MAAM,OAAO,cAAc;IAEN;IACA;IAFnB,YACmB,YAA0B,EAC1B,eAA6B,mBAAmB;QADhD,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAoC;IAChE,CAAC;IAEJ;;;;OAIG;IACH,KAAK,CAAC,QAAQ,CAAC,GAAY,EAAE,KAAoB;QAC/C,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,aAAa,CAAC;QACnD,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAE/B,MAAM,IAAI,GAAgB,KAAK,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACzD,MAAM,UAAU,GAAqB;YACnC,KAAK;YACL,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,OAAO,CAAC;YACxC,QAAQ,EAAE,IAAI,CAAC,IAAI;YACnB,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACvC,CAAC;QACF,MAAM,YAAY,GAAG,MAAM,IAAI,C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SAAS,GAAG,SAAS,CAAC;AACxB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cyanheads/brapi-mcp-server",
|
|
3
3
|
"mcpName": "io.github.cyanheads/brapi-mcp-server",
|
|
4
|
-
"version": "0.5.
|
|
5
|
-
"description": "BrAPI v2.1 MCP
|
|
4
|
+
"version": "0.5.3",
|
|
5
|
+
"description": "A collaborative BrAPI v2.1 workspace for multi-agent research via MCP. Search studies, germplasm, genotypes, & more - across Breedbase, T3, Sweetpotatobase, & any BrAPI v2-compliant server.",
|
|
6
6
|
"author": "Casey Hand @cyanheads (https://github.com/cyanheads/brapi-mcp-server#readme)",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/index.js",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
-
"@cyanheads/mcp-ts-core": "^0.8.
|
|
74
|
+
"@cyanheads/mcp-ts-core": "^0.8.17",
|
|
75
75
|
"@duckdb/node-api": "^1.5.2-r.1",
|
|
76
76
|
"pino-pretty": "^13.1.3"
|
|
77
77
|
},
|
package/server.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
3
|
"name": "io.github.cyanheads/brapi-mcp-server",
|
|
4
|
-
"description": "BrAPI v2.1 MCP
|
|
4
|
+
"description": "Collaborative BrAPI v2.1 MCP workspace — studies, germplasm, genotypes across Breedbase, T3, more.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"url": "https://github.com/cyanheads/brapi-mcp-server",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "0.5.
|
|
9
|
+
"version": "0.5.3",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
14
14
|
"identifier": "@cyanheads/brapi-mcp-server",
|
|
15
15
|
"runtimeHint": "bun",
|
|
16
|
-
"version": "0.5.
|
|
16
|
+
"version": "0.5.3",
|
|
17
17
|
"packageArguments": [
|
|
18
18
|
{ "type": "positional", "value": "run" },
|
|
19
19
|
{ "type": "positional", "value": "start:stdio" }
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"registryBaseUrl": "https://registry.npmjs.org",
|
|
50
50
|
"identifier": "@cyanheads/brapi-mcp-server",
|
|
51
51
|
"runtimeHint": "bun",
|
|
52
|
-
"version": "0.5.
|
|
52
|
+
"version": "0.5.3",
|
|
53
53
|
"packageArguments": [
|
|
54
54
|
{ "type": "positional", "value": "run" },
|
|
55
55
|
{ "type": "positional", "value": "start:http" }
|