@cyanheads/brapi-mcp-server 0.4.11 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/CLAUDE.md +1 -1
  2. package/README.md +152 -503
  3. package/changelog/0.4.x/0.4.12.md +29 -0
  4. package/changelog/0.4.x/0.4.13.md +42 -0
  5. package/dist/config/alias-credentials.d.ts +27 -15
  6. package/dist/config/alias-credentials.d.ts.map +1 -1
  7. package/dist/config/alias-credentials.js +79 -30
  8. package/dist/config/alias-credentials.js.map +1 -1
  9. package/dist/config/builtin-aliases.d.ts +51 -0
  10. package/dist/config/builtin-aliases.d.ts.map +1 -0
  11. package/dist/config/builtin-aliases.js +126 -0
  12. package/dist/config/builtin-aliases.js.map +1 -0
  13. package/dist/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.js +4 -4
  14. package/dist/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.js.map +1 -1
  15. package/dist/mcp-server/tools/definitions/brapi-connect.tool.d.ts +6 -0
  16. package/dist/mcp-server/tools/definitions/brapi-connect.tool.d.ts.map +1 -1
  17. package/dist/mcp-server/tools/definitions/brapi-connect.tool.js +3 -3
  18. package/dist/mcp-server/tools/definitions/brapi-connect.tool.js.map +1 -1
  19. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.d.ts +2 -2
  20. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.js +2 -2
  21. package/dist/mcp-server/tools/definitions/brapi-dataframe-describe.tool.js.map +1 -1
  22. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.d.ts +2 -2
  23. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.js +2 -2
  24. package/dist/mcp-server/tools/definitions/brapi-dataframe-drop.tool.js.map +1 -1
  25. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts +2 -2
  26. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.d.ts.map +1 -1
  27. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.js +7 -5
  28. package/dist/mcp-server/tools/definitions/brapi-dataframe-query.tool.js.map +1 -1
  29. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.d.ts +1 -1
  30. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js +2 -2
  31. package/dist/mcp-server/tools/definitions/brapi-find-genotype-calls.tool.js.map +1 -1
  32. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.js +1 -1
  33. package/dist/mcp-server/tools/definitions/brapi-find-locations.tool.js.map +1 -1
  34. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts +1 -1
  35. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.d.ts.map +1 -1
  36. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.js +8 -4
  37. package/dist/mcp-server/tools/definitions/brapi-find-studies.tool.js.map +1 -1
  38. package/dist/mcp-server/tools/definitions/brapi-get-image.tool.js +1 -1
  39. package/dist/mcp-server/tools/definitions/brapi-get-image.tool.js.map +1 -1
  40. package/dist/mcp-server/tools/definitions/brapi-get-study.tool.d.ts +1 -1
  41. package/dist/mcp-server/tools/definitions/brapi-get-study.tool.d.ts.map +1 -1
  42. package/dist/mcp-server/tools/definitions/brapi-get-study.tool.js +8 -4
  43. package/dist/mcp-server/tools/definitions/brapi-get-study.tool.js.map +1 -1
  44. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.d.ts.map +1 -1
  45. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.js +3 -3
  46. package/dist/mcp-server/tools/definitions/brapi-manage-dataset.tool.js.map +1 -1
  47. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.d.ts +1 -1
  48. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.js +1 -1
  49. package/dist/mcp-server/tools/definitions/brapi-raw-search.tool.js.map +1 -1
  50. package/dist/mcp-server/tools/definitions/brapi-server-info.tool.d.ts +6 -0
  51. package/dist/mcp-server/tools/definitions/brapi-server-info.tool.d.ts.map +1 -1
  52. package/dist/mcp-server/tools/definitions/brapi-submit-observations.tool.js +1 -1
  53. package/dist/mcp-server/tools/definitions/brapi-submit-observations.tool.js.map +1 -1
  54. package/dist/mcp-server/tools/definitions/index.d.ts +22 -10
  55. package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -1
  56. package/dist/mcp-server/tools/shared/connect-auth-schema.d.ts.map +1 -1
  57. package/dist/mcp-server/tools/shared/connect-auth-schema.js +15 -6
  58. package/dist/mcp-server/tools/shared/connect-auth-schema.js.map +1 -1
  59. package/dist/mcp-server/tools/shared/find-helpers.js +1 -1
  60. package/dist/mcp-server/tools/shared/find-helpers.js.map +1 -1
  61. package/dist/mcp-server/tools/shared/orientation-envelope.d.ts +12 -0
  62. package/dist/mcp-server/tools/shared/orientation-envelope.d.ts.map +1 -1
  63. package/dist/mcp-server/tools/shared/orientation-envelope.js +45 -4
  64. package/dist/mcp-server/tools/shared/orientation-envelope.js.map +1 -1
  65. package/dist/mcp-server/tools/shared/raw-routing-hints.js +2 -2
  66. package/dist/mcp-server/tools/shared/raw-routing-hints.js.map +1 -1
  67. package/package.json +1 -1
  68. package/server.json +3 -3
@@ -0,0 +1,29 @@
1
+ ---
2
+ summary: "Built-in alias registry — `cassava`, `sweetpotato`, `wheat`, and `breedbase` resolve out-of-the-box without env vars; orientation envelope now carries CC-BY attribution metadata."
3
+ breaking: false
4
+ ---
5
+
6
+ # 0.4.12 — 2026-05-04
7
+
8
+ `brapi_connect` now ships with a curated registry of public BrAPI v2 endpoints, so agents can call `brapi_connect({ alias: 'cassava' })` (or `sweetpotato`, `wheat`, `breedbase`) on a fresh deployment without any env-var setup. Each builtin was probed against the live upstream surface — anonymous reads return real data and the standard `/studies`, `/germplasm`, `/variables` endpoints respond with non-trivial totals. Two servers that brapi.org/servers still lists as no-auth (`musabase.org`, `solgenomics.net`) actually require login on every endpoint and are intentionally absent.
9
+
10
+ ## Added
11
+
12
+ - **Built-in known-server registry** at `src/config/builtin-aliases.ts`. Frozen list with attribution metadata (license, citation, homepage, demo flag). Resolves between per-alias env vars and `BRAPI_DEFAULT_*` so operator overrides still win and credentialed connections still work as before.
13
+ - **`attribution` block in the orientation envelope** — when a connection comes from a builtin, the envelope returned by `brapi_connect` and `brapi_server_info` includes `{ license, citation, homepage, isDemo? }`. CC-BY attribution propagates to the agent automatically; the formatted text output now renders an `## Attribution` section. Absent for custom env-only or agent-passed connections.
14
+ - **`BRAPI_BUILTIN_ALIASES_DISABLED`** opt-out env var. Comma-separated alias names (case-insensitive, whitespace-tolerant) remove specific builtins from resolution and discovery for deployments that prefer a stripped surface.
15
+ - **`origin: 'env' | 'builtin'`** field on `DiscoveredAlias`. The connect tool description now splits the two sources into separate sentences so agents can tell which aliases ship out-of-the-box vs which the operator pre-wired.
16
+
17
+ ## Changed
18
+
19
+ - **`resolveConnectInput` precedence is four layers** (was three): agent input → per-alias env → builtin registry → default env. When the baseUrl comes from a builtin, `BRAPI_DEFAULT_*` credentials are no longer layered on top — those belong to the default server, not whatever upstream the builtin happens to point at. Per-alias credentials still apply.
20
+ - **README** documents the new precedence, the four shipped aliases, override behavior (`BRAPI_<ALIAS>_BASE_URL` repoints, `BRAPI_<ALIAS>_USERNAME`+`_PASSWORD` attaches auth), and the opt-out env var.
21
+
22
+ ## Fixed
23
+
24
+ - **`brapi_find_studies` and `brapi_get_study` tolerate `seasons: [null]`** — the breedbase.org demo deployment serves studies with a literal null inside the seasons array, which previously caused Zod to reject the entire response. Inner element type is now `string \| null`; the format renderers and distribution computation skip null entries. New sparse-payload test case covers the breedbase shape.
25
+
26
+ ## Notes
27
+
28
+ - Hosted-deployment migration: operators currently setting `BRAPI_CASSAVA_BASE_URL=https://cassavabase.org/brapi/v2` can drop that env var — the builtin covers it. `BRAPI_CASSAVA_USERNAME` / `_PASSWORD` (if set for write access) continue to work unchanged.
29
+ - Each Breedbase instance has its own user table — no SSO across `cassavabase.org`, `sweetpotatobase.org`, `wheat.triticeaetoolbox.org`. Write access still requires separate registration on each upstream.
@@ -0,0 +1,42 @@
1
+ ---
2
+ summary: "Built-in alias rename — source-prefixed handles (`bti-*`, `t3-*`); adds T3/Oat and T3/Barley; fixes hyphenated-builtin env shadow."
3
+ breaking: false
4
+ ---
5
+
6
+ # 0.4.13 — 2026-05-04
7
+
8
+ Source-prefixed alias rename across the built-in registry, plus two new T3 small-grains servers. Tool schemas refresh on next connect, so agents reading the current connect tool description pick up the new handles automatically. Operators with per-alias credential env vars (e.g. `BRAPI_CASSAVA_USERNAME`) need to rename to the new prefix (`BRAPI_BTI_CASSAVA_USERNAME`) — see Migration below.
9
+
10
+ ## Added
11
+
12
+ - **`t3-oat` and `t3-barley` built-ins** — Triticeae Toolbox (T3) hosts three sibling Breedbase instances at `*.triticeaetoolbox.org`; only wheat shipped before. Live probes confirm anonymous reads return real data: T3/Oat advertises 2,564 studies / 59,780 germplasm / 288 variables, T3/Barley 1,574 / 63,859 / 208. Same Breedbase platform underneath, same CC-BY posture, same Morales et al. 2022 citation as the existing entries.
13
+
14
+ ## Changed
15
+
16
+ - **Built-in aliases renamed to source-prefixed handles** so the hosting source is visible at the call site:
17
+
18
+ | Before | After |
19
+ |:-------|:------|
20
+ | `cassava` | `bti-cassava` |
21
+ | `sweetpotato` | `bti-sweetpotato` |
22
+ | `wheat` | `t3-wheat` |
23
+ | `breedbase` | `bti-breedbase-demo` |
24
+
25
+ Tool input schema is unchanged (alias is still a free-form `z.string().regex(...)`), and the connect tool description lists current builtins dynamically — fresh agent sessions read the new handles and use them. Custom env-only aliases under the old short names (`cassava`, `sweetpotato`, `wheat`, `breedbase`) are now valid free-form names that resolve via `BRAPI_<ALIAS>_*` env vars only — they no longer shadow a built-in.
26
+
27
+ ## Fixed
28
+
29
+ - **`discoverConfiguredAliases` reverse-maps env var keys against hyphenated builtins.** The regex extracted alias names from `BRAPI_<X>_BASE_URL` keys but couldn't tell whether an underscore in the captured group should map back to a hyphen, so an env var like `BRAPI_BTI_CASSAVA_BASE_URL` was reported as a separate `bti_cassava` alias instead of shadowing the built-in `bti-cassava`. Discovery now consults the registry's underscored-name map and uses the canonical hyphenated alias when one matches. `resolveConnectInput` was unaffected — it derives the env prefix from the alias the agent passed.
30
+
31
+ ## Migration
32
+
33
+ Operators who attached per-alias credentials to a built-in via env vars need to rename:
34
+
35
+ | Old env var | New env var |
36
+ |:------------|:------------|
37
+ | `BRAPI_CASSAVA_*` | `BRAPI_BTI_CASSAVA_*` |
38
+ | `BRAPI_SWEETPOTATO_*` | `BRAPI_BTI_SWEETPOTATO_*` |
39
+ | `BRAPI_WHEAT_*` | `BRAPI_T3_WHEAT_*` |
40
+ | `BRAPI_BREEDBASE_*` | `BRAPI_BTI_BREEDBASE_DEMO_*` |
41
+
42
+ `BRAPI_BUILTIN_ALIASES_DISABLED` values follow the same rename. Hardcoded `alias: 'cassava'` (etc.) in agent system prompts or saved scripts also need updating to the new handles.
@@ -39,44 +39,56 @@ export interface ResolvedConnectInput {
39
39
  baseUrl: string;
40
40
  }
41
41
  /**
42
- * Layer agent input over alias env over default env. Returns the resolved
43
- * baseUrl + auth. Throws when no baseUrl is resolvable from any layer.
42
+ * Layer agent input over alias env over the builtin registry over default env.
43
+ * Returns the resolved baseUrl + auth. Throws when no baseUrl is resolvable
44
+ * from any layer.
44
45
  *
45
46
  * Precedence:
46
47
  * 1. Explicit agent input (`baseUrl`, `auth`) wins.
47
48
  * 2. Per-alias env vars (`BRAPI_<ALIAS>_*`).
48
- * 3. Default env vars (`BRAPI_DEFAULT_*`) only when alias differs.
49
- * 4. `auth` falls through to `{ mode: 'none' }`; `baseUrl` has no fallback.
49
+ * 3. Built-in known-server registrysee `config/builtin-aliases.ts`.
50
+ * 4. Default env vars (`BRAPI_DEFAULT_*`) only when alias differs.
51
+ * 5. `auth` falls through to `{ mode: 'none' }`; `baseUrl` has no fallback.
52
+ *
53
+ * When the baseUrl is satisfied by a builtin, default-env auth is NOT used —
54
+ * default credentials belong to the default server, not whatever upstream the
55
+ * builtin happens to point at. Per-alias creds still apply, since those were
56
+ * explicitly set for this alias.
50
57
  */
51
58
  export declare function resolveConnectInput(alias: string, agent: {
52
59
  baseUrl?: string | undefined;
53
60
  auth?: ConnectAuth | undefined;
54
61
  }, env?: NodeJS.ProcessEnv): ResolvedConnectInput;
55
62
  /**
56
- * Summary of an alias discovered from env vars — what the operator pre-wired
57
- * for this deployment. Surfaced to the LLM via the connect tool description so
58
- * agents can pick a shortcut without the human having to enumerate them.
63
+ * Summary of an alias the agent can call out-of-the-box. Either pre-wired by
64
+ * the operator via `BRAPI_<ALIAS>_BASE_URL` (`origin: 'env'`) or shipped in the
65
+ * built-in known-server registry (`origin: 'builtin'`). Surfaced to the LLM
66
+ * via the connect tool description so agents can pick a shortcut without the
67
+ * human having to enumerate them.
59
68
  */
60
69
  export interface DiscoveredAlias {
61
70
  alias: string;
62
71
  authMode: AuthMode;
63
72
  baseUrl: string;
73
+ origin: 'env' | 'builtin';
64
74
  }
65
75
  /**
66
- * Scan env for `BRAPI_<X>_BASE_URL` keys and derive the alias inventory the
67
- * operator has pre-configured. Each alias resolves its credential family via
68
- * the same logic `resolveConnectInput` uses; ambiguous families fall back to
69
- * `none` so the alias is still surfaced (the connect call will then raise the
70
- * same `ValidationError` the agent would have hit anyway).
76
+ * Inventory of aliases the agent can call without specifying a baseUrl. Merges
77
+ * env-driven entries (operator-set `BRAPI_<X>_BASE_URL`) with the built-in
78
+ * known-server registry. Env-set aliases win when both are present, since the
79
+ * resolver gives env precedence; their `origin` reflects that. Per-alias
80
+ * credentials still derive auth in either case, so a builtin alias with
81
+ * `BRAPI_<ALIAS>_USERNAME` set surfaces with the right `authMode`.
71
82
  *
72
83
  * Default-alias entries land first; the rest are alphabetical.
73
84
  */
74
85
  export declare function discoverConfiguredAliases(env?: NodeJS.ProcessEnv): DiscoveredAlias[];
75
86
  /**
76
87
  * Render the discovered alias list as a sentence appended to the connect
77
- * tool's description. Empty when nothing is pre-configured the original
78
- * description stands alone in that case. Phrased so that absent aliases are
79
- * never read as restricted servers: any BrAPI v2 URL stays connectable.
88
+ * tool's description. Empty when nothing is configured. Splits builtins from
89
+ * env-driven aliases so the LLM understands which work out-of-the-box vs
90
+ * which the operator pre-wired. Phrased so that absent aliases are never read
91
+ * as restricted servers: any BrAPI v2 URL stays connectable.
80
92
  */
81
93
  export declare function formatConfiguredAliasesHint(aliases: DiscoveredAlias[]): string;
82
94
  //# sourceMappingURL=alias-credentials.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"alias-credentials.d.ts","sourceRoot":"","sources":["../../src/config/alias-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAEjF;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAgBD,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,gBAAgB,CAQlB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,GACZ,WAAW,GAAG,SAAS,CAwCzB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,WA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AG,MAAM,CAEpD;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,gBAAgB,CAQlB;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,gBAAgB,EACvB,KAAK,EAAE,MAAM,GACZ,WAAW,GAAG,SAAS,CAwCzB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;CAAE,EACvE,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,oBAAoB,CAwBtB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,KAAK,GAAG,SAAS,CAAC;CAC3B;AAID;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,eAAe,EAAE,CA2CjG;AAaD;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,MAAM,CAmB9E"}
@@ -9,6 +9,7 @@
9
9
  * @module config/alias-credentials
10
10
  */
11
11
  import { validationError } from '@cyanheads/mcp-ts-core/errors';
12
+ import { findBuiltinAlias, listBuiltinAliases } from '../config/builtin-aliases.js';
12
13
  const FIELD_SUFFIXES = [
13
14
  ['baseUrl', 'BASE_URL'],
14
15
  ['username', 'USERNAME'],
@@ -21,6 +22,7 @@ const FIELD_SUFFIXES = [
21
22
  ['oauthTokenUrl', 'OAUTH_TOKEN_URL'],
22
23
  ];
23
24
  const DEFAULT_ALIAS = 'default';
25
+ const NONE_AUTH = { mode: 'none' };
24
26
  /** Compute the env-var prefix for an alias. `my-server` → `BRAPI_MY_SERVER_`. */
25
27
  export function aliasEnvPrefix(alias) {
26
28
  return `BRAPI_${alias.replace(/-/g, '_').toUpperCase()}_`;
@@ -81,59 +83,85 @@ export function deriveAuthFromCredentials(creds, alias) {
81
83
  return;
82
84
  }
83
85
  /**
84
- * Layer agent input over alias env over default env. Returns the resolved
85
- * baseUrl + auth. Throws when no baseUrl is resolvable from any layer.
86
+ * Layer agent input over alias env over the builtin registry over default env.
87
+ * Returns the resolved baseUrl + auth. Throws when no baseUrl is resolvable
88
+ * from any layer.
86
89
  *
87
90
  * Precedence:
88
91
  * 1. Explicit agent input (`baseUrl`, `auth`) wins.
89
92
  * 2. Per-alias env vars (`BRAPI_<ALIAS>_*`).
90
- * 3. Default env vars (`BRAPI_DEFAULT_*`) only when alias differs.
91
- * 4. `auth` falls through to `{ mode: 'none' }`; `baseUrl` has no fallback.
93
+ * 3. Built-in known-server registrysee `config/builtin-aliases.ts`.
94
+ * 4. Default env vars (`BRAPI_DEFAULT_*`) only when alias differs.
95
+ * 5. `auth` falls through to `{ mode: 'none' }`; `baseUrl` has no fallback.
96
+ *
97
+ * When the baseUrl is satisfied by a builtin, default-env auth is NOT used —
98
+ * default credentials belong to the default server, not whatever upstream the
99
+ * builtin happens to point at. Per-alias creds still apply, since those were
100
+ * explicitly set for this alias.
92
101
  */
93
102
  export function resolveConnectInput(alias, agent, env = process.env) {
94
103
  const aliasCreds = readAliasCredentials(alias, env);
95
104
  const defaultCreds = alias === DEFAULT_ALIAS ? aliasCreds : readAliasCredentials(DEFAULT_ALIAS, env);
96
- const baseUrl = agent.baseUrl ?? aliasCreds.baseUrl ?? defaultCreds.baseUrl;
105
+ const builtin = !agent.baseUrl && !aliasCreds.baseUrl ? findBuiltinAlias(alias, env) : undefined;
106
+ const baseUrl = agent.baseUrl ?? aliasCreds.baseUrl ?? builtin?.baseUrl ?? defaultCreds.baseUrl;
97
107
  if (!baseUrl) {
98
108
  throw validationError(`No baseUrl provided. Pass \`baseUrl\` explicitly, or set ${aliasEnvPrefix(alias)}BASE_URL${alias === DEFAULT_ALIAS ? '' : ` or ${aliasEnvPrefix(DEFAULT_ALIAS)}BASE_URL`}.`, { alias });
99
109
  }
110
+ const allowDefaultAuthFallback = !builtin && alias !== DEFAULT_ALIAS;
100
111
  const auth = agent.auth ??
101
112
  deriveAuthFromCredentials(aliasCreds, alias) ??
102
- (alias === DEFAULT_ALIAS
103
- ? undefined
104
- : deriveAuthFromCredentials(defaultCreds, DEFAULT_ALIAS)) ??
105
- { mode: 'none' };
113
+ (allowDefaultAuthFallback
114
+ ? deriveAuthFromCredentials(defaultCreds, DEFAULT_ALIAS)
115
+ : undefined) ??
116
+ NONE_AUTH;
106
117
  return { baseUrl, auth };
107
118
  }
108
119
  const ALIAS_BASE_URL_PATTERN = /^BRAPI_([A-Z0-9_]+)_BASE_URL$/;
109
120
  /**
110
- * Scan env for `BRAPI_<X>_BASE_URL` keys and derive the alias inventory the
111
- * operator has pre-configured. Each alias resolves its credential family via
112
- * the same logic `resolveConnectInput` uses; ambiguous families fall back to
113
- * `none` so the alias is still surfaced (the connect call will then raise the
114
- * same `ValidationError` the agent would have hit anyway).
121
+ * Inventory of aliases the agent can call without specifying a baseUrl. Merges
122
+ * env-driven entries (operator-set `BRAPI_<X>_BASE_URL`) with the built-in
123
+ * known-server registry. Env-set aliases win when both are present, since the
124
+ * resolver gives env precedence; their `origin` reflects that. Per-alias
125
+ * credentials still derive auth in either case, so a builtin alias with
126
+ * `BRAPI_<ALIAS>_USERNAME` set surfaces with the right `authMode`.
115
127
  *
116
128
  * Default-alias entries land first; the rest are alphabetical.
117
129
  */
118
130
  export function discoverConfiguredAliases(env = process.env) {
119
131
  const result = [];
132
+ const seen = new Set();
133
+ const builtins = listBuiltinAliases(env);
134
+ // Reverse-map for hyphen → underscore env-var translation: a builtin named
135
+ // `bti-cassava` exposes BRAPI_BTI_CASSAVA_*, but the regex below only sees
136
+ // the underscored form. Without this map, an env var that shadows a
137
+ // hyphenated builtin would be reported as a separate `bti_cassava` alias.
138
+ const builtinByUnderscoredName = new Map(builtins.map((b) => [b.alias.replace(/-/g, '_'), b]));
120
139
  for (const [key, value] of Object.entries(env)) {
121
140
  const match = key.match(ALIAS_BASE_URL_PATTERN);
122
141
  const captured = match?.[1];
123
142
  if (!captured || !value)
124
143
  continue;
125
- const alias = captured.toLowerCase();
144
+ const lowerCaptured = captured.toLowerCase();
145
+ const alias = builtinByUnderscoredName.get(lowerCaptured)?.alias ?? lowerCaptured;
126
146
  const creds = readAliasCredentials(alias, env);
127
- let authMode = 'none';
128
- try {
129
- const auth = deriveAuthFromCredentials(creds, alias);
130
- if (auth)
131
- authMode = auth.mode;
132
- }
133
- catch {
134
- // Ambiguous credential family — surface the alias anyway.
135
- }
136
- result.push({ alias, authMode, baseUrl: value });
147
+ result.push({
148
+ alias,
149
+ authMode: deriveModeForDiscovery(creds, alias),
150
+ baseUrl: value,
151
+ origin: 'env',
152
+ });
153
+ seen.add(alias);
154
+ }
155
+ for (const builtin of builtins) {
156
+ if (seen.has(builtin.alias))
157
+ continue;
158
+ const creds = readAliasCredentials(builtin.alias, env);
159
+ result.push({
160
+ alias: builtin.alias,
161
+ authMode: deriveModeForDiscovery(creds, builtin.alias),
162
+ baseUrl: builtin.baseUrl,
163
+ origin: 'builtin',
164
+ });
137
165
  }
138
166
  result.sort((a, b) => {
139
167
  if (a.alias === DEFAULT_ALIAS)
@@ -144,16 +172,37 @@ export function discoverConfiguredAliases(env = process.env) {
144
172
  });
145
173
  return result;
146
174
  }
175
+ function deriveModeForDiscovery(creds, alias) {
176
+ try {
177
+ const auth = deriveAuthFromCredentials(creds, alias);
178
+ return auth?.mode ?? 'none';
179
+ }
180
+ catch {
181
+ // Ambiguous credential family — surface the alias as `none` so the agent
182
+ // still sees it; the connect call will raise the same ValidationError.
183
+ return 'none';
184
+ }
185
+ }
147
186
  /**
148
187
  * Render the discovered alias list as a sentence appended to the connect
149
- * tool's description. Empty when nothing is pre-configured the original
150
- * description stands alone in that case. Phrased so that absent aliases are
151
- * never read as restricted servers: any BrAPI v2 URL stays connectable.
188
+ * tool's description. Empty when nothing is configured. Splits builtins from
189
+ * env-driven aliases so the LLM understands which work out-of-the-box vs
190
+ * which the operator pre-wired. Phrased so that absent aliases are never read
191
+ * as restricted servers: any BrAPI v2 URL stays connectable.
152
192
  */
153
193
  export function formatConfiguredAliasesHint(aliases) {
154
194
  if (aliases.length === 0)
155
195
  return '';
156
- const names = aliases.map((a) => `\`${a.alias}\``).join(', ');
157
- return `Pre-configured aliases on this deployment (callable without \`baseUrl\` or \`auth\` — credentials are read from server env vars): ${names}. Aliases are shortcuts only; any other BrAPI v2 server is reachable by passing \`baseUrl\` directly.`;
196
+ const builtin = aliases.filter((a) => a.origin === 'builtin').map((a) => `\`${a.alias}\``);
197
+ const env = aliases.filter((a) => a.origin === 'env').map((a) => `\`${a.alias}\``);
198
+ const parts = [];
199
+ if (builtin.length > 0) {
200
+ parts.push(`Built-in known servers (callable with no \`baseUrl\` or \`auth\` — public BrAPI v2 endpoints): ${builtin.join(', ')}.`);
201
+ }
202
+ if (env.length > 0) {
203
+ parts.push(`Operator-configured aliases on this deployment (credentials and/or baseUrl read from server env vars): ${env.join(', ')}.`);
204
+ }
205
+ parts.push('Aliases are shortcuts only; any other BrAPI v2 server is reachable by passing `baseUrl` directly.');
206
+ return parts.join(' ');
158
207
  }
159
208
  //# sourceMappingURL=alias-credentials.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alias-credentials.js","sourceRoot":"","sources":["../../src/config/alias-credentials.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAmBhE,MAAM,cAAc,GAA6D;IAC/E,CAAC,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AI,EAAE,IAAI,IAAI,MAAM,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,uEAAuE;QACvE,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAA0B;IACpE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC3F,MAAM,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IACnF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,KAAK,CAAC,IAAI,CACR,kGAAkG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACxH,CAAC;IACJ,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnB,KAAK,CAAC,IAAI,CACR,0GAA0G,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC5H,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,IAAI,CACR,mGAAmG,CACpG,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * @fileoverview Built-in known-server registry. Curated list of public BrAPI v2
3
+ * endpoints that ship as default connection aliases — operators can call
4
+ * `brapi_connect({ alias: 'cassava' })` (or any other entry) without setting
5
+ * `BRAPI_<ALIAS>_BASE_URL`. Each entry carries CC-BY attribution metadata so
6
+ * the orientation envelope can surface license + citation alongside the data.
7
+ *
8
+ * Override behavior: env-set `BRAPI_<ALIAS>_BASE_URL` always wins over the
9
+ * builtin URL — the builtin is a fallback, not a lock. Per-alias credentials
10
+ * (`BRAPI_<ALIAS>_USERNAME` / `_PASSWORD` / etc.) layer on top of any selected
11
+ * baseUrl, so write workflows still need a separate registration on each
12
+ * upstream instance.
13
+ *
14
+ * Opt-out: comma-separated alias names in `BRAPI_BUILTIN_ALIASES_DISABLED`
15
+ * remove specific builtins from resolution and discovery (matched
16
+ * case-insensitively).
17
+ *
18
+ * @module config/builtin-aliases
19
+ */
20
+ export interface BuiltinAlias {
21
+ readonly alias: string;
22
+ readonly baseUrl: string;
23
+ readonly citation: string;
24
+ readonly cropFocus: string;
25
+ readonly homepage: string;
26
+ readonly isDemo?: boolean;
27
+ readonly license: 'CC-BY';
28
+ readonly organizationName: string;
29
+ }
30
+ /**
31
+ * Frozen registry of known public BrAPI v2 servers. Each entry was verified
32
+ * against the live upstream surface — anonymous reads return real data and
33
+ * the standard `/studies`, `/germplasm`, `/variables` endpoints respond with
34
+ * non-trivial totals. Servers that flipped to an auth wall (musabase,
35
+ * solgenomics) are intentionally absent.
36
+ */
37
+ export declare const BUILTIN_ALIASES: ReadonlyArray<BuiltinAlias>;
38
+ /**
39
+ * Resolve a builtin entry by alias. Case-insensitive lookup; respects the
40
+ * `BRAPI_BUILTIN_ALIASES_DISABLED` opt-out list. Returns `undefined` when the
41
+ * alias is unknown or disabled — callers fall through to the next baseUrl
42
+ * source (default env, then a thrown ValidationError).
43
+ */
44
+ export declare function findBuiltinAlias(alias: string, env?: NodeJS.ProcessEnv): BuiltinAlias | undefined;
45
+ /**
46
+ * Active builtins — the registry minus any aliases listed in
47
+ * `BRAPI_BUILTIN_ALIASES_DISABLED`. Used by alias discovery so the connect
48
+ * tool description can advertise what's available out-of-the-box.
49
+ */
50
+ export declare function listBuiltinAliases(env?: NodeJS.ProcessEnv): ReadonlyArray<BuiltinAlias>;
51
+ //# sourceMappingURL=builtin-aliases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-aliases.d.ts","sourceRoot":"","sources":["../../src/config/builtin-aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,YAAY,CAwDtD,CAAC;AAmBH;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,YAAY,GAAG,SAAS,CAK1B;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,aAAa,CAAC,YAAY,CAAC,CAI7B"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * @fileoverview Built-in known-server registry. Curated list of public BrAPI v2
3
+ * endpoints that ship as default connection aliases — operators can call
4
+ * `brapi_connect({ alias: 'cassava' })` (or any other entry) without setting
5
+ * `BRAPI_<ALIAS>_BASE_URL`. Each entry carries CC-BY attribution metadata so
6
+ * the orientation envelope can surface license + citation alongside the data.
7
+ *
8
+ * Override behavior: env-set `BRAPI_<ALIAS>_BASE_URL` always wins over the
9
+ * builtin URL — the builtin is a fallback, not a lock. Per-alias credentials
10
+ * (`BRAPI_<ALIAS>_USERNAME` / `_PASSWORD` / etc.) layer on top of any selected
11
+ * baseUrl, so write workflows still need a separate registration on each
12
+ * upstream instance.
13
+ *
14
+ * Opt-out: comma-separated alias names in `BRAPI_BUILTIN_ALIASES_DISABLED`
15
+ * remove specific builtins from resolution and discovery (matched
16
+ * case-insensitively).
17
+ *
18
+ * @module config/builtin-aliases
19
+ */
20
+ const BREEDBASE_CITATION = 'Morales et al. 2022. "Breedbase: a digital ecosystem for modern plant breeding." G3 12(7): jkac078. https://doi.org/10.1093/g3journal/jkac078';
21
+ /**
22
+ * Frozen registry of known public BrAPI v2 servers. Each entry was verified
23
+ * against the live upstream surface — anonymous reads return real data and
24
+ * the standard `/studies`, `/germplasm`, `/variables` endpoints respond with
25
+ * non-trivial totals. Servers that flipped to an auth wall (musabase,
26
+ * solgenomics) are intentionally absent.
27
+ */
28
+ export const BUILTIN_ALIASES = Object.freeze([
29
+ Object.freeze({
30
+ alias: 'bti-cassava',
31
+ baseUrl: 'https://cassavabase.org/brapi/v2',
32
+ homepage: 'https://cassavabase.org/',
33
+ organizationName: 'Boyce Thompson Institute',
34
+ cropFocus: 'Cassava',
35
+ license: 'CC-BY',
36
+ citation: BREEDBASE_CITATION,
37
+ }),
38
+ Object.freeze({
39
+ alias: 'bti-sweetpotato',
40
+ baseUrl: 'https://sweetpotatobase.org/brapi/v2',
41
+ homepage: 'https://sweetpotatobase.org/',
42
+ organizationName: 'Boyce Thompson Institute',
43
+ cropFocus: 'SweetPotato',
44
+ license: 'CC-BY',
45
+ citation: BREEDBASE_CITATION,
46
+ }),
47
+ Object.freeze({
48
+ alias: 't3-wheat',
49
+ baseUrl: 'https://wheat.triticeaetoolbox.org/brapi/v2',
50
+ homepage: 'https://wheat.triticeaetoolbox.org/',
51
+ organizationName: 'Triticeae Toolbox (T3)',
52
+ cropFocus: 'Wheat',
53
+ license: 'CC-BY',
54
+ citation: BREEDBASE_CITATION,
55
+ }),
56
+ Object.freeze({
57
+ alias: 't3-oat',
58
+ baseUrl: 'https://oat.triticeaetoolbox.org/brapi/v2',
59
+ homepage: 'https://oat.triticeaetoolbox.org/',
60
+ organizationName: 'Triticeae Toolbox (T3)',
61
+ cropFocus: 'Oat',
62
+ license: 'CC-BY',
63
+ citation: BREEDBASE_CITATION,
64
+ }),
65
+ Object.freeze({
66
+ alias: 't3-barley',
67
+ baseUrl: 'https://barley.triticeaetoolbox.org/brapi/v2',
68
+ homepage: 'https://barley.triticeaetoolbox.org/',
69
+ organizationName: 'Triticeae Toolbox (T3)',
70
+ cropFocus: 'Barley',
71
+ license: 'CC-BY',
72
+ citation: BREEDBASE_CITATION,
73
+ }),
74
+ Object.freeze({
75
+ alias: 'bti-breedbase-demo',
76
+ baseUrl: 'https://breedbase.org/brapi/v2',
77
+ homepage: 'https://breedbase.org/',
78
+ organizationName: 'Boyce Thompson Institute',
79
+ cropFocus: 'Demo (sample data)',
80
+ license: 'CC-BY',
81
+ citation: BREEDBASE_CITATION,
82
+ isDemo: true,
83
+ }),
84
+ ]);
85
+ const DISABLED_ENV_VAR = 'BRAPI_BUILTIN_ALIASES_DISABLED';
86
+ /**
87
+ * Parse the comma-separated disabled list from env. Whitespace tolerant,
88
+ * case-insensitive — entries are lowercased to match alias keys.
89
+ */
90
+ function readDisabledSet(env) {
91
+ const raw = env[DISABLED_ENV_VAR];
92
+ if (!raw)
93
+ return new Set();
94
+ const out = new Set();
95
+ for (const part of raw.split(',')) {
96
+ const trimmed = part.trim().toLowerCase();
97
+ if (trimmed)
98
+ out.add(trimmed);
99
+ }
100
+ return out;
101
+ }
102
+ /**
103
+ * Resolve a builtin entry by alias. Case-insensitive lookup; respects the
104
+ * `BRAPI_BUILTIN_ALIASES_DISABLED` opt-out list. Returns `undefined` when the
105
+ * alias is unknown or disabled — callers fall through to the next baseUrl
106
+ * source (default env, then a thrown ValidationError).
107
+ */
108
+ export function findBuiltinAlias(alias, env = process.env) {
109
+ const key = alias.toLowerCase();
110
+ const disabled = readDisabledSet(env);
111
+ if (disabled.has(key))
112
+ return;
113
+ return BUILTIN_ALIASES.find((entry) => entry.alias === key);
114
+ }
115
+ /**
116
+ * Active builtins — the registry minus any aliases listed in
117
+ * `BRAPI_BUILTIN_ALIASES_DISABLED`. Used by alias discovery so the connect
118
+ * tool description can advertise what's available out-of-the-box.
119
+ */
120
+ export function listBuiltinAliases(env = process.env) {
121
+ const disabled = readDisabledSet(env);
122
+ if (disabled.size === 0)
123
+ return BUILTIN_ALIASES;
124
+ return BUILTIN_ALIASES.filter((entry) => !disabled.has(entry.alias));
125
+ }
126
+ //# sourceMappingURL=builtin-aliases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin-aliases.js","sourceRoot":"","sources":["../../src/config/builtin-aliases.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,kBAAkB,GACtB,+IAA+I,CAAC;AAalJ;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAgC,MAAM,CAAC,MAAM,CAAC;IACxE,MAAM,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,kCAAkC;QAC3C,QAAQ,EAAE,0BAA0B;QACpC,gBAAgB,EAAE,0BAA0B;QAC5C,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;IACF,MAAM,CAAC,MAAM,CAAC;QACZ,KAAK,EAAE,iBAAiB;QACxB,OAAO,EAAE,sCAAsC;QAC/C,QAAQ,EAAE,8BAA8B;QACxC,gBAAgB,EAAE,0BAA0B;QAC5C,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE,OAAO;QAChB,QAAQ,EAAE,kBAAkB;KAC7B,CAAC;IACF,MAAM,CAAC,MAAM,CAAC;QACZ,KAA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CAAC,EAAE,CAAC;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC1C,IAAI,OAAO;YAAE,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,KAAa,EACb,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAChC,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC;QAAE,OAAO;IAC9B,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC;QAAE,OAAO,eAAe,CAAC;IAChD,OAAO,eAAe,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AACvE,CAAC"}
@@ -9,7 +9,7 @@
9
9
  */
10
10
  import { prompt, z } from '@cyanheads/mcp-ts-core';
11
11
  export const brapiMetaAnalysis = prompt('brapi_meta_analysis', {
12
- description: 'Cross-study meta-analysis playbook for a germplasm × trait combination — resolve trait, find studies, pull observations, harmonize scales, summarize across studies.',
12
+ description: 'Run a cross-study meta-analysis on a germplasm × trait combination — resolve trait, find studies, pull observations, harmonize scales, summarize across studies.',
13
13
  args: z.object({
14
14
  germplasmDbIds: z
15
15
  .string()
@@ -18,7 +18,7 @@ export const brapiMetaAnalysis = prompt('brapi_meta_analysis', {
18
18
  traitName: z
19
19
  .string()
20
20
  .min(1)
21
- .describe('Target trait name or free-text query — e.g. "dry matter content", "Plant height". The agent will resolve it to one or more observation variables via brapi_find_variables.'),
21
+ .describe('Target trait name or free-text query — e.g. "dry matter content", "Plant height". Resolved to one or more observation variables via brapi_find_variables.'),
22
22
  alias: z
23
23
  .string()
24
24
  .regex(/^[a-zA-Z0-9_-]+$/)
@@ -36,7 +36,7 @@ export const brapiMetaAnalysis = prompt('brapi_meta_analysis', {
36
36
  `You are running a cross-study meta-analysis on the **${args.traitName}** trait across ${ids.length} germplasm: ${ids.map((id) => `\`${id}\``).join(', ')}. Use the curated \`brapi_*\` tools throughout. Reproducibility matters — record every dataset handle and query you generate.`,
37
37
  '',
38
38
  '## Step 1 — Resolve the trait to one or more observation variables',
39
- `1. Call \`brapi_find_variables\` with \`text: "${args.traitName}"${aliasArg}\` to score candidates via the OntologyResolver.`,
39
+ `1. Call \`brapi_find_variables\` with \`text: "${args.traitName}"${aliasArg}\` to rank candidates against ontology terms.`,
40
40
  '2. Inspect `ontologyCandidates`. If exactly one candidate has an unambiguous PUI / trait name match, use it. If multiple variables represent the same biological trait (e.g. "Dry Matter %" measured by gravimetric vs NIR methods), keep all of them and note the method differences — you will harmonize later.',
41
41
  '3. Record the resulting `observationVariableDbId[]` and the scale `dataType` and `scaleName` for each. Numeric scales can be averaged across studies; categorical scales need a mapping table before pooling.',
42
42
  '',
@@ -97,7 +97,7 @@ export const brapiMetaAnalysis = prompt('brapi_meta_analysis', {
97
97
  '7. **Pedigree notes** — Step 7 if you ran it.',
98
98
  '8. **Caveats** — missing data rates, dropped observations, sample-size warnings, capability gaps from the server (e.g. ontology endpoint missing).',
99
99
  '',
100
- 'Reproducibility is non-negotiable: cite the dataset handle returned by every `find_*` call so a future agent can re-run with the same upstream snapshot.',
100
+ 'Reproducibility is non-negotiable: cite the dataset handle returned by every `find_*` call so a future run can reproduce the same upstream snapshot.',
101
101
  ].join('\n');
102
102
  return [
103
103
  {
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-meta-analysis.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,EAAE;IAC7D,WAAW,EACT,sKAAsK;IACxK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,wLAAwL,CACzL;QACH,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,4KAA4K,CAC7K;QACH,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,KAAK,CAAC,kBAAkB,CAAC;aACzB,QAAQ,EAAE;aACV,QAAQ,CACP,yKAAyK,CAC1K;KACJ,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc;aAC5B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;aACtB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QAEvC,MAAM,IAAI,GAAG;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O;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aAChC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
1
+ {"version":3,"file":"brapi-meta-analysis.prompt.js","sourceRoot":"","sources":["../../../../src/mcp-server/prompts/definitions/brapi-meta-analysis.prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAEnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,qBAAqB,EAAE;IAC7D,WAAW,EACT,kKAAkK;IACpK,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC;QACb,cAAc,EAAE,CAAC;aACd,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,wLAAwL,CACzL;QACH,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CACP,2JAA2J,CAC5J;QACH,KAAK,EAAE,CAAC;aACL,MAAM,EAAE;aACR,KAAK,CAAC,kBAAkB,CAAC;aACzB,QAAQ,EAAE;aACV,QAAQ,CACP,yKAAyK,CAC1K;KACJ,CAAC;IACF,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE;QACjB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,cAAc;aAC5B,KAAK,CAAC,GAAG,CAAC;aACV,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC;aACtB,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACjC,MAAM,UAAU,G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EAAE;YACF,sJAAsJ;SACvJ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAEb,OAAO;YACL;gBACE,IAAI,EAAE,MAAM;gBACZ,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;aAChC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
@@ -79,6 +79,12 @@ export declare const brapiConnect: import("@cyanheads/mcp-ts-core").ToolDefiniti
79
79
  programCount: z.ZodOptional<z.ZodNumber>;
80
80
  locationCount: z.ZodOptional<z.ZodNumber>;
81
81
  }, z.core.$strip>;
82
+ attribution: z.ZodOptional<z.ZodObject<{
83
+ homepage: z.ZodString;
84
+ license: z.ZodString;
85
+ citation: z.ZodString;
86
+ isDemo: z.ZodOptional<z.ZodBoolean>;
87
+ }, z.core.$strip>>;
82
88
  notes: z.ZodArray<z.ZodString>;
83
89
  fetchedAt: z.ZodString;
84
90
  }, z.core.$strip>, readonly [{
@@ -1 +1 @@
1
- {"version":3,"file":"brapi-connect.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-connect.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAqBjE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FvB,CAAC"}
1
+ {"version":3,"file":"brapi-connect.tool.d.ts","sourceRoot":"","sources":["../../../../src/mcp-server/tools/definitions/brapi-connect.tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAQ,CAAC,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAqBjE,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FvB,CAAC"}