mcp-ai-detection
Enables multi-tier AI-detection screening on academic papers by extracting text from .tex and .docx files, splitting into standard sections, and running a pipeline of statistical and LLM-based analysis.
README
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_pipeline - Input: LaTeX
.texand Word.docx - Text extraction: Pandoc for LaTeX when installed, robust fallback cleaner,
python-docxfor Word - Narrative/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 default - Tier 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
Install
python -m pip install -e .
Pandoc is optional but recommended for LaTeX:
# macOS
brew install pandoc
# Ubuntu/Debian
sudo apt-get install pandoc
MCP server
Run with stdio transport:
python -m mcp_ai_detection.server
Example 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.json
Configuration
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.75
Tier 2 uses the local Ollama model named by LOCAL_LLM_MODEL. Recommended:
ollama pull gemma4:e4b
ollama serve
Check that Ollama is using the GPU:
ollama ps
The 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: high- Tier 2 early stop: probability
< 0.4 - Sections 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 tests
Run lint if dev extras are installed:
ruff check .
gemma3:4b is a smaller fallback for slower machines:
LOCAL_LLM_MODEL=gemma3:4b
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。