DEV Community

clestigon
clestigon

Posted on

Wrapping 22 ESG certification registries into one MCP server

#a

If you have ever tried to answer a question like "which PEFC chain-of-custody sawmills in Vietnam are flagged for EUDR due diligence?" with an LLM, you know the failure mode: the model will happily invent a plausible sawmill. The data exists — it is just locked inside twenty different certification registries, each with its own search form, its own pagination, and no API.

I build data products for a living, so I did the boring part twenty-two times and then wrapped it once.

The shape of the problem

Green building and sustainable procurement runs on certificates:

  • Green building: BREEAM / BRE GreenBookLive, LEED-adjacent product lists, IWBI WELL, EDGE
  • Product certification: UL SPOT (GREENGUARD, ECOLOGO), GECA, Green Tag, SCS FloorScore, CRI Green Label Plus, Blue Angel, Green Seal, EPEAT, KEYMARK, Eurovent, CRRC, SRCC, Phius
  • Supply chain: GOTS / GRTS, PEFC (including EUDR due-diligence flags)

Each registry is a search page. Some are cold-fusion era ASP.NET, some are modern JS apps, one is a PDF index. None of them gives you:

  1. a stable record shape,
  2. paging that does not lose rows,
  3. the certificate identifier as a field rather than inside a description blob,
  4. contact data for the certified company.

So a retrieval-augmented agent cannot answer a certification question even when the answer is public. That is the gap MCP is perfect for: one server, many tools, one schema.

Design decisions that mattered

1. One tool, not twenty-two

The naive design exposes 22 tools — breeam_search, spot_search, geca_search... Twenty-two tools in a tool list is a tax on every prompt: the model has to read 22 descriptions before deciding anything.

Instead the server exposes four:

Tool Why
esg_list_actors browse the catalog by category or keyword
esg_search run one registry synchronously, return items
esg_run_async long runs → runId + datasetId
esg_get_run_items page a dataset later

The agent does discovery with one call, then acts. Tool-selection accuracy went up immediately compared to a flat list — fewer, better-described tools beat more, narrower ones when the input space is homogeneous.

2. A friendly input that maps onto hostile schemas

Every registry names its search box differently. Real field names from the twenty-two actors:

searchQuery, searchKeyword, keyword, brandKeyword,
manufacturerQuery, productQuery, certificateHolder, producer
Enter fullscreen mode Exit fullscreen mode

Nobody should have to memorise that. So the server keeps a per-actor field map and translates a single shape:

{ "actor": "pefc", "query": "plywood", "country": "Vietnam", "maxItems": 25 }
Enter fullscreen mode Exit fullscreen mode

becomes the actor's actual input, with input available as an escape hatch that always wins. This is the difference between a tool an agent can use on the first try and a tool that needs a schema-reading round trip.

3. A stable envelope, nulls over omissions

Registries disagree about everything except that they are disagreeable. Each record is normalised to a fixed envelope:

{
  "recordId": "spot-portfolio-insulation",
  "recordType": "BRAND_CERTIFICATION_PORTFOLIO",
  "productName": "...",
  "manufacturer": "...",
  "productType": "Building Materials & Finishes",
  "csiMasterFormat": "09 00 00 Finishes",
  "certifications": "GREENGUARD Gold Certification | GREENGUARD Certification",
  "ulStandardNumber": "UL 2818 - 2022 Gold Standard for Chemical Emissions",
  "eligibleGreenCredits": "LEED v5 BD+C | LEED v5 ID+C | WELL v2 Pilot",
  "leedV5Compliant": true
}
Enter fullscreen mode Exit fullscreen mode

Fields a registry does not publish come back as null, never missing. Downstream code stops branching on hasOwnProperty, and the model stops hallucinating a field that was simply absent.

4. Sync first, async as the escape hatch

run-sync-get-dataset-items is the right default: the agent gets rows in one hop. But registries with 40k rows do not finish in 300 seconds. Those get esg_run_async returning a runId and a console link, plus esg_get_run_items for paging. One extra tool, no extra concepts.

What it looks like in practice

> Find BREEAM-certified heat pump manufacturers in the UK with EPDs

→ esg_search { "actor": "breeam", "query": "heat pump", "country": "United Kingdom" }
← 23 items · manufacturer, certificateNumber, validUntil, epdReference, csiMasterFormat
Enter fullscreen mode Exit fullscreen mode
> Which GOTS-certified organic cotton mills ship to the EU?

→ esg_list_actors { "keyword": "gots" }
→ esg_search { "actor": "gotspulse", "country": "EU", "maxItems": 100 }
← 61 items with certification body, licence number, product category, country
Enter fullscreen mode Exit fullscreen mode

The registry quirks stay in the server. The agent sees two tools' worth of vocabulary.

Wiring it into a client

Claude Desktop:

{
  "mcpServers": {
    "esg-compliance": {
      "command": "npx",
      "args": ["-y", "apify-esg-compliance-mcp-hub"],
      "env": { "APIFY_TOKEN": "apify_api_xxx" }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Same block works in Cursor, VS Code, Cline and Continue; any stdio host can run node src/server.js directly.

The server itself is about 250 lines: MCP SDK, zod schemas, a catalog JSON, and one fetch wrapper around the Apify API. No framework, no build step, no Docker.

Lessons worth stealing

Tool count is a budget. Four well-described tools outperformed 22 narrow ones. Spend that budget on input mapping instead.

Normalise nulls. null is information: "this registry does not publish EPD references". A missing key is ambiguity, and ambiguity is where models start inventing.

Make the escape hatch explicit. input: { raw: true }-style passthroughs kept me from shipping a mapper for every exotic field, and kept users from being blocked when a registry adds one.

Credential, not demo. Running against a paid API ($6 per 1,000 results) means there is no free demo endpoint that silently returns three fake rows — the first call either works or tells you exactly why it did not.

What is next

  • a esg_compare(company) tool that fans out across registries and returns one cross-certification profile
  • cached certificate expiry watch: re-check validUntil monthly and emit changes
  • additional registries: RoHS/REACH declarations, FSC, Cradle to Cradle product registry

The repo is MIT: clestigon/apify-esg-compliance-mcp-hub. If you are building agents for construction, procurement or compliance, the twenty-two actors behind it are on the Apify Store and each one runs standalone.

Certification data is public, it is just unreadable. Making it readable is the whole job.

Top comments (0)