Skip to main content
Glama
charles-gentry

rb209-mcp

README.md
# rb209-mcp

MCP server exposing the AHDB **RB209 (Nutrient Management Guide) Web API v2** —
94 tools — plus a nutrient-planning skill.

The three `Users` auth endpoints (Login / Logout / Refresh_Token) are deliberately
not exposed: the server manages that token lifecycle itself, so a tool call to
`Logout` could only ever invalidate its own session.

The extension ships its own usage guidance, so installing the `.mcpb` in Claude Desktop is enough — you don't need to load the skill separately. The server exposes an MCP `instructions` brief on connect, and the highest-risk tools (notably the recommendation endpoint) carry the must-know rules in their tool descriptions. `skill/rb209-nutrient-planning/SKILL.md` remains the fuller guide (for Claude Code / claude.ai and as a versioned release asset); the embedded guidance is a condensed subset kept in sync with it by hand.

Tools are a faithful passthrough to the API with one deliberate exception: the
recommendation endpoint has a footgun where a missing `field.grass` (which the
API's validation does not report) makes the call fail with the misleading
`422 "…calculating the crop order"`. For that endpoint only, the server fills
the incidental required-empty sections (`grass`, `grassland`, `organicMaterials`,
`mannerOutputs`) when they are absent — never overwriting supplied data, and with
no effect on the result. See `src/recommendationGuardrail.ts`.

## Requirements

You need your own AHDB RB209 Web API licence (register at
<https://rb209.ahdb.org.uk/Home/RequestAccess>). Each user supplies their own
credentials; they never leave your machine.

## Install (non-technical — Claude Desktop)

1. Download `rb209-mcp.mcpb` from the latest [Release](../../releases).
2. Double-click it; Claude Desktop opens the installer.
3. Enter your RB209 **email** and **password** in the settings form.
4. Done — the RB209 tools appear in your chat tool.

## Install (developers)

```bash
npm install && npm run build
RB209_EMAIL=you@example.com RB209_PASSWORD=secret node dist/index.js
```

Add to an MCP client config with `command: node`, `args: [".../dist/index.js"]`,
and `env: { RB209_EMAIL, RB209_PASSWORD }`.

## Configuration

| Env var | Required | Default | Purpose |
|---------|----------|---------|---------|
| `RB209_EMAIL` | yes | — | Your RB209 licence email |
| `RB209_PASSWORD` | yes | — | Your RB209 licence password |
| `RB209_BASE_URL` | no | `https://rb209api.ahdb.org.uk` | API base URL |
| `RB209_ENABLED_GROUPS` | no | all | Comma-separated tags to expose (e.g. `Recommendation,Soil`) |
| `RB209_SPEC_PATH` | no | vendored spec | Only set when running a manually-extracted bundle standalone (the .mcpb manifest wires it automatically) |

## Development

```bash
npm test          # unit tests (msw-mocked)
npm run test:watch
RB209_EMAIL=... RB209_PASSWORD=... npm test   # also runs the live integration test
```

This server is released under the [MIT Licence](LICENSE). The RB209 data it
returns is licensed API content © AHDB under the Open Government Licence v3.0.

TDQS

B3/5.0

Scored across 94 tools

Disambiguation2/5

The set has many near-identical lookup families—e.g., at least four soil nutrient-index-by-value variants and multiple organic-material-type filters—so an agent must parse subtle parameter differences to avoid misselection. Singular/plural pairs and a deprecated endpoint duplicated by a country-aware version further blur boundaries.

Naming Consistency3/5

All tools share a uniform `rb209_<area>_<resource>` snake_case pattern, which is predictable. However, naming is inconsistent at the resource level: `soil_nutrient_indices` vs `soil_nutrient_indexes` are both present, singular and plural forms are mixed, and some names are awkwardly long (`rb209_grass_growth_class_by_soil_type_rainfall_altitude_chalk`).

Tool Count1/5

94 tools is an extreme tool count for an MCP server, far beyond the point where an agent can reliably choose. Many endpoints are trivial singular/plural pairs or filter variants that could be collapsed into parameterized tools, so this feels like a direct API surface dump rather than a curated tool set.

Completeness5/5

For the RB209 nutrient-recommendation domain, the tool surface is remarkably complete: it includes the main recommendation calculator plus lookups for crops, grass, soil, organic materials, rainfall, measurements, previous cropping, and fertiliser prices. There are no obvious dead-end workflows; even caveats around no-soil-analysis and country-specific paths are covered.

Maintenance

ActivitySlowing
ResponsivenessNo issues