Skip to main content

MCP server for groundlens — LLM hallucination detection for Claude Desktop, Cursor, Windsurf, and any MCP client

Project description

GROUNDLENS-MCP

MCP server for groundlens — LLM hallucination detection for Claude Desktop, Cursor, Windsurf, and any MCP-compatible client.

No second LLM. Deterministic. Same inputs → same scores, every time.

PyPI CI codecov Python License

What it does

Adds three tools to your AI assistant:

Tool What it checks When to use it
groundlens_check Auto-selects the right method Default — just use this one
groundlens_sgi Response vs. source document (SGI) RAG pipelines, document Q&A
groundlens_dgi Response patterns without context (DGI) Chat, general Q&A

SGI (Semantic Grounding Index) measures whether the response actually used the source material or just rephrased the question. Score > 0.95 = grounded.

DGI (Directional Grounding Index) measures whether the response follows geometric patterns typical of grounded answers. Score > 0.30 = grounded.

Install

pip install groundlens-mcp

Or with uv:

uv pip install groundlens-mcp

Configure your client

Claude Desktop

Add to your claude_desktop_config.json:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "groundlens": {
      "command": "groundlens-mcp"
    }
  }
}

If you installed with uv and the command isn't on your PATH:

{
  "mcpServers": {
    "groundlens": {
      "command": "uv",
      "args": ["run", "groundlens-mcp"]
    }
  }
}

Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "groundlens": {
      "command": "groundlens-mcp"
    }
  }
}

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "groundlens": {
      "command": "groundlens-mcp"
    }
  }
}

How to use

Once configured, ask your ai assistant:

"Check if this response is hallucinated"

"Is this answer grounded in the document I provided?"

"Run a hallucination check on this ChatGPT output"

The tools return JSON with a verdict (GROUNDED or HALLUCINATION RISK), a numeric score, and a plain-language explanation.

Example output

{
  "verdict": "HALLUCINATION RISK",
  "explanation": "The response may not be based on the source material provided.",
  "method": "SGI (Semantic Grounding Index)",
  "score": 0.8721,
  "threshold": 0.95,
  "flagged": true,
  "detail": {
    "q_dist": 0.4312,
    "ctx_dist": 0.4945,
    "interpretation": "Response stayed close to the question rather than engaging with the context."
  }
}

How it works

groundlens uses embedding geometry — not a second LLM — to detect hallucinations:

  • SGI computes dist(response, question) / dist(response, context). If the response moved toward the context, it's grounded. If it stayed near the question, the context was likely ignored.
  • DGI projects the question→response displacement onto the mean direction of verified grounded pairs. Positive alignment = grounded pattern.

Both methods run a single embedding call. No model inference for evaluation. Deterministic.

First-call latency

The first tool call downloads and loads the sentence-transformer model (~100MB). Subsequent calls are fast. The model is loaded lazily so your MCP client doesn't slow down on startup.

Running from source

git clone https://github.com/groundlens-dev/groundlens-mcp.git
cd groundlens-mcp
pip install -e .
groundlens-mcp

Or:

python -m groundlens_mcp

Links

License

MIT

Project details


Download files

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

Source Distribution

groundlens_mcp-2026.5.13.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

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

groundlens_mcp-2026.5.13-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file groundlens_mcp-2026.5.13.tar.gz.

File metadata

  • Download URL: groundlens_mcp-2026.5.13.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for groundlens_mcp-2026.5.13.tar.gz
Algorithm Hash digest
SHA256 92425b37f080bbbd0a0ad13e36f4dd2bd53bcd29033fb202aa85a2d6bc5c1b48
MD5 3f6827510e4d50699cad566493073ebe
BLAKE2b-256 37da6fd178cf6cf654b992e166fab1988b465be51939b3ff1ec373310869461b

See more details on using hashes here.

Provenance

The following attestation bundles were made for groundlens_mcp-2026.5.13.tar.gz:

Publisher: publish.yml on groundlens-dev/groundlens-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file groundlens_mcp-2026.5.13-py3-none-any.whl.

File metadata

File hashes

Hashes for groundlens_mcp-2026.5.13-py3-none-any.whl
Algorithm Hash digest
SHA256 33e9c1be6000ba4a903453f481b044f99cfde044ef0455d63fd5a4d626f25896
MD5 6dc81dc7aeba05787d4d79227d601c65
BLAKE2b-256 89b72b4df93a10d5ff1566d4b8b18e98c1c47a8f85cd7c44a0b06754da732594

See more details on using hashes here.

Provenance

The following attestation bundles were made for groundlens_mcp-2026.5.13-py3-none-any.whl:

Publisher: publish.yml on groundlens-dev/groundlens-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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