groundlens-mcp
Enables hallucination detection for AI assistants by providing tools to assess whether responses are grounded in source material or follow grounded patterns.
README
Groundlens-mcp
<p align="center"> <img src="https://raw.githubusercontent.com/groundlens-dev/groundlens-mcp/main/assets/logo_groundlens_mcp.png" alt="groundlens MCP" width="200"> </p> <br/> <div align="center">
</div>
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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.