mcp-ai-detection
Provides integration with Ollama to run local large language models for AI detection screening, enabling Tier 1 optional LLM analysis and Tier 2 rubric-based adjudication without external API keys.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-ai-detection
Open-source MIT MCP server for multi-tier AI-detection screening on academic
papers. It accepts .tex and .docx, extracts clean text, splits standard
paper sections, and runs a three-tier risk pipeline.
AI detection is screening, not proof. Reports include limits, threats to validity, and a final recommendation framed as decision support.
Features
MCP tools:
extract_text,split_sections,full_pipelineInput: LaTeX
.texand Word.docxText extraction: Pandoc for LaTeX when installed, robust fallback cleaner,
python-docxfor WordNarrative/structured split: tables, formulas, captions, references, keyword lines, markdown tables, and dense math lines are excluded from the main authorship score
Section splitting: Abstract, Introduction, Methods, Results, Discussion, Conclusion
Tier 1 offline: burstiness, lexical diversity, AI-like connectives, n-gram repetition, sentence-length variance, repeated patterns, hedging, example density
Optional Tier 1 local LLM through Ollama with
gemma4:e4bby defaultTier 2 local Gemma adjudicator through Ollama: rubric-based JSON screening calibrated with Tier 1 metrics, no paid API keys
Tier 3 open-source ensemble hooks: DetectGPT, Fast-DetectGPT, NPR command adapters plus built-in proxy analysis for repetition, lexical diversity, and semantic coherence
JSON and Markdown reports with executive summary, section breakdown, section x tier score table, narrative score, structured-content diagnostic, limits, and recommendation
Related MCP server: signs-of-ai
Install
python -m pip install -e .Pandoc is optional but recommended for LaTeX:
# macOS
brew install pandoc
# Ubuntu/Debian
sudo apt-get install pandocMCP server
Run with stdio transport:
python -m mcp_ai_detection.serverExample MCP client config:
{
"mcpServers": {
"ai-detection": {
"command": "python",
"args": ["-m", "mcp_ai_detection.server"],
"env": {
"LOCAL_LLM_MODEL": "gemma4:e4b"
}
}
}
}Tools
extract_text
{
"file_path": "paper.tex",
"prefer_pandoc": true
}Returns clean text, word count, extractor used, and warnings.
split_sections
{
"text": "Abstract\n...\nIntroduction\n..."
}Returns detected standard sections with line ranges and word counts.
full_pipeline
{
"file_path": "paper.docx",
"use_llm": false,
"tier2_provider": "gemma-local",
"early_stop": true
}Runs extraction, sectioning, Tier 1 statistics, conditional Tier 2 Gemma/Ollama,
conditional Tier 3, then returns report_json and report_markdown.
CLI
python -m mcp_ai_detection.cli paper.tex --markdown report.md --json report.jsonConfiguration
Environment variables:
LOCAL_LLM_MODEL=gemma4:e4b
OLLAMA_HOST=http://localhost:11434
OLLAMA_KEEP_ALIVE=30m
HTTP_TIMEOUT_SECONDS=120
TIER1_LLM_WEIGHT=0.6
TIER1_STATS_WEIGHT=0.4
DETECTGPT_CMD=
FAST_DETECTGPT_CMD=
NPR_CMD=
METHODS_WEIGHT_REDUCTION=0.75Tier 2 uses the local Ollama model named by LOCAL_LLM_MODEL. Recommended:
ollama pull gemma4:e4b
ollama serveCheck that Ollama is using the GPU:
ollama psThe PROCESSOR column should show 100% GPU for loaded models.
External Tier 3 commands receive section text on stdin and should return JSON:
{
"score": 0.72,
"confidence": 0.64,
"details": {
"model": "your-detector"
}
}If commands are not configured, built-in proxy scorers keep the pipeline fully offline and deterministic.
Thresholds
< 0.3: low0.3-0.6: medium>= 0.6: highTier 2 early stop: probability
< 0.4Sections below 80 narrative words are marked
insufficient_evidenceand are excluded from the document-level narrative score
Methods sections get reduced Tier 3 weight by default to lower false positives from formulaic scientific prose.
Development
Run offline tests:
python -m unittest discover -s testsRun lint if dev extras are installed:
ruff check .gemma3:4b is a smaller fallback for slower machines:
LOCAL_LLM_MODEL=gemma3:4bTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
DraftCheck: flags AI-writing patterns in prose with fix hints. Deterministic linter, not a detector.
Check every reference in a paper, compile LaTeX to PDF, and get cited data: SEC, trade, web traffic.
Extract structured data points from research papers and other documents with an LLM.
Check if references exist or were retracted, look up journal AI policies, and preview manuscripts.
Related MCP Servers
- FlicenseCqualityCmaintenanceEnables to turn a research folder into a submission-ready academic paper, with stages for screening, venue selection, drafting, humanization, and final QA. Runs locally without uploading any data.21-
- AlicenseAqualityBmaintenanceBilingual (EN/ES) AI-writing detection that shows the evidence instead of a percentage: named tells with line and column, hidden-character inspection, and citation cross-checking against a document's own bibliography. Seven of its nine tools run entirely locally and never touch the network.1030MIT
- AlicenseAqualityBmaintenanceProvides local, deterministic scoring and detailed auditing of text for AI-writing patterns via two read-only tools, with no network calls or language models.217 npm3MIT
- FlicenseNot gradedqualityAmaintenanceAnalyzes text and files for formulaic AI writing patterns, returning a 0-100 score, band label, specific violations with context, and concrete revision advice. Runs entirely locally with rule-based heuristics, requiring no LLM judge or API calls.-