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.
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
- groundlens library —
pip install groundlens - Documentation
- Website
- Demo
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file groundlens_mcp-2026.5.18.tar.gz.
File metadata
- Download URL: groundlens_mcp-2026.5.18.tar.gz
- Upload date:
- Size: 151.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3ef9063fdaa4d4f1548ec355039f95ec0cd5e077e27c835d939a1f52c0caade
|
|
| MD5 |
ca50df53154a9b87b2a1835a6ead6533
|
|
| BLAKE2b-256 |
063579899455282213be6df745aa5ccfd3faeeb6e19b18ba1013735ed1b275cc
|
Provenance
The following attestation bundles were made for groundlens_mcp-2026.5.18.tar.gz:
Publisher:
publish.yml on groundlens-dev/groundlens-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
groundlens_mcp-2026.5.18.tar.gz -
Subject digest:
a3ef9063fdaa4d4f1548ec355039f95ec0cd5e077e27c835d939a1f52c0caade - Sigstore transparency entry: 1519903367
- Sigstore integration time:
-
Permalink:
groundlens-dev/groundlens-mcp@584a008cc2a5575c28f6425e696ce06083701649 -
Branch / Tag:
refs/tags/v2026.5.18 - Owner: https://github.com/groundlens-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@584a008cc2a5575c28f6425e696ce06083701649 -
Trigger Event:
release
-
Statement type:
File details
Details for the file groundlens_mcp-2026.5.18-py3-none-any.whl.
File metadata
- Download URL: groundlens_mcp-2026.5.18-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a38dfcc6febd0a2a8132065cde3bc1a3546f03f24eb0b96d617d5e28f91ea0a
|
|
| MD5 |
df598e620072a6d88db1dfd1a70678f1
|
|
| BLAKE2b-256 |
b0068c9aaa64f39b42bc99c83a4084077177f9f0f41d05bc76039d0a3fd56555
|
Provenance
The following attestation bundles were made for groundlens_mcp-2026.5.18-py3-none-any.whl:
Publisher:
publish.yml on groundlens-dev/groundlens-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
groundlens_mcp-2026.5.18-py3-none-any.whl -
Subject digest:
3a38dfcc6febd0a2a8132065cde3bc1a3546f03f24eb0b96d617d5e28f91ea0a - Sigstore transparency entry: 1519903373
- Sigstore integration time:
-
Permalink:
groundlens-dev/groundlens-mcp@584a008cc2a5575c28f6425e696ce06083701649 -
Branch / Tag:
refs/tags/v2026.5.18 - Owner: https://github.com/groundlens-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@584a008cc2a5575c28f6425e696ce06083701649 -
Trigger Event:
release
-
Statement type: