Skip to main content

envbert-mcp

MCP server exposing raw envbert (DistilBERT EDD classification) to Claude — standalone.


This server calls envbert.due_diligence.envbert_predict() directly.

If you need the LLM-fallback behaviour (e.g. building a non-LLM pipeline), use envbert-agent.


Architecture

Claude / Claude Code
        │ MCP (stdio)
        ▼
envbert_mcp/server.py     ←── this file, single process
        │ in-process call
        ▼
envbert.due_diligence.envbert_predict()
        │
        ▼
DistilBERT (d4data/environmental-due-diligence-model)

Everything runs in one process. The model loads once at startup (warmup, ~10-40s on a cold HuggingFace cache) and stays in memory for the life of the server.


Tools

Tool Purpose
check_envbert_status Confirm the model is loaded before relying on fast responses — the very first call in a session may be slow while warmup is still in progress
classify_environmental_text Classify one sentence/paragraph — label + confidence, no LLM step
classify_environmental_document Classify all paragraphs of a document concurrently, with category distribution and low-confidence flagging

Note on confidence: this is a cosine similarity between the input text and a reference embedding for the predicted category — not a calibrated probability. It's a useful relative signal (higher = closer match) but shouldn't be read as "X% likely correct." Scores at or below 0.3 are already relabeled Not Relevant internally before they reach you. Every response also includes a score_basis field as a reminder.

Why low-confidence flagging matters here

Without an LLM fallback, a low envbert confidence score (e.g. 0.42) is the final answer — there's no second opinion baked in. classify_environmental_document surfaces a low_confidence_items list explicitly so Claude can apply its own judgement to exactly those paragraphs, rather than treating every result as equally reliable.

Note that confidence here is a cosine similarity to a reference embedding, not a calibrated probability — see the caveat under Tools above.

{
  "category_distribution": {"Geology": 4, "Contaminants": 2},
  "score_basis": "cosine_similarity_not_probability",
  "low_confidence_count": 1,
  "low_confidence_items": [
    {"index": 3, "label": "Remediation Standards", "confidence": 0.42}
  ],
  "results": [ ... ]
}

Quickstart

pip install envbert envbert-mcp

Register the server with Claude Code:

claude mcp add envbert -- envbert-mcp

(Add --scope user instead of the default local scope if you want it available in every project, not just the one you ran this from.)

Restart Claude Code. The model warms up in the background on first launch — check_envbert_status will report "loading": true until ready.

Example prompts:

  • "Is envbert ready?"
  • "Classify this: 'weathered shale was encountered below the surface with fluvial deposits'"
  • "Here's a 12-paragraph site report — classify each section and flag anything you're not confident about."

envbert-mcp vs envbert-agent which to use

This package (raw envbert) envbert-agent
Used by Claude / MCP clients CLI, pipelines, non-LLM consumers
LLM fallback None Yes — Ollama (local) or Azure
Typical latency <1s always <1s confident, ~10s on fallback
External dependencies None beyond envbert Ollama or Azure OpenAI
Confidence on ambiguous text Raw model score only LLM-resolved final label
Why this shape Claude can reason over raw scores itself — a second hidden LLM call is redundant No reasoning layer downstream; the agent must resolve ambiguity itself

Both are legitimate — they're solving for different consumers of the classification, not competing implementations of the same thing.


Configuration

Variable Default Description
LOG_LEVEL INFO Logging verbosity

No other configuration needed — there's no backend URL, no LLM provider, no API keys. That's the point.


License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

envbert_mcp-3.1.0.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

envbert_mcp-3.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file envbert_mcp-3.1.0.tar.gz.

File metadata

  • Download URL: envbert_mcp-3.1.0.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for envbert_mcp-3.1.0.tar.gz
Algorithm Hash digest
SHA256 24685edfcc5021944a72909e3b7ed99ed15a6618ac83c0e41750fd46b24f0e83
MD5 914d355159781bcbbe3a495e812872a1
BLAKE2b-256 6bef093ba92dc5e89d7fc9e9a6c89b959f32276766b9e57f5b7d0313a7ec5c7f

See more details on using hashes here.

File details

Details for the file envbert_mcp-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: envbert_mcp-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for envbert_mcp-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 926d5a00e34f1bc5937856780a4e0125ed57044375e5557ca52bf57eff7240d5
MD5 49b7e37d205ace480ce80211abde1191
BLAKE2b-256 f6580975f6ae78f508e8c6ca7cae7d59ad4b4300e90ea3606bc3f55ab905f160

See more details on using hashes here.

Release history Release notifications | RSS feed

4.1.0

2 files

4.0.0

2 files

This release

3.1.0 This release

2 files

3.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page