linkup-mcp
Provides web search and local document RAG using Ollama, enabling privacy-preserving AI assistance in Cursor IDE.
README
Cursor Linkup MCP Server
Custom MCP (Model Context Protocol) server for Cursor IDE with:
- 🌐 Web Search - Deep web searches using Linkup API
- 📚 RAG (Retrieval Augmented Generation) - Query documents using LlamaIndex with Ollama
✨ Key Features
- ✅ Local AI - Uses Ollama (llama3.2) for complete privacy
- ✅ Zero API Costs - RAG tool is completely free (uses local models)
- ✅ Source Citations - Know where answers come from
- ✅ Multiple Document Types - Supports PDF, DOCX, MD, TXT, and more
- ✅ Cursor Integration - Works seamlessly in Cursor IDE
📋 Prerequisites
- Python 3.12+
- uv package manager
- Ollama installed locally with llama3.2 model
- Linkup API key (optional, only for web search)
🚀 Quick Start
1. Clone & Install Dependencies
git clone https://github.com/RanneG/linkup_mcp.git
cd linkup_mcp
uv sync
Default install (uv sync / pip install -e .) is Cursor MCP + RAG only (lighter venv). For stitch_rag_bridge.py, face/OAuth/Gmail, and server-side voice STT, add --extra stitch-bridge. For ElevenLabs voice/music asset generation (elevenlabs-gen CLI), add --extra elevenlabs — see docs/elevenlabs/README.md.
2. Install Ollama & Model
# Download from https://ollama.ai/download
# Then pull the model:
ollama pull llama3.2
3. Configure Environment (Optional)
Create a .env file for web search (RAG works without API keys):
LINKUP_API_KEY=your_linkup_api_key # Optional, for web_search tool
4. Configure Cursor
Add to ~/.cursor/mcp.json (or C:\Users\<username>\.cursor\mcp.json on Windows):
{
"mcpServers": {
"linkup-server": {
"command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Microsoft\\WindowsApps\\python.exe",
"args": [
"-m", "uv", "run",
"--directory", "C:\\path\\to\\linkup_mcp",
"python", "server.py"
]
}
}
}
Replace YOUR_USERNAME and path with your actual values.
5. Free local dev ports (optional)
If 8765 (Stitch bridge / bundled UI), 1420 (Tauri), or 5173 (Vite) are stuck after a crash, run Close-DevPorts.bat at the repo root (or .\scripts\Close-StitchDevPorts.ps1). Use -DryRun to list listeners without killing. This stops processes listening on those ports, not “localhost” itself.
6. Restart Cursor & Use!
In Cursor's chat:
- "Use the rag tool to tell me about [topic]"
- "Use the rag_stitch tool to get a UI-ready answer payload"
- "Search the web for [query]" (requires Linkup API key)
- Local Whisper (no Linkup):
whisper_stt_statusthentranscribe_wav_filewith a path to a.wavfile. Requirespip install -e ".[stitch-whisper]"and a Cursor MCP restart.
7. Voice-to-prompt hotkey tool (offline)
Use voice_prompt_tool.py for one-shot dictation directly into your coding flow:
uv sync --extra stitch-whisper --extra voice-prompt
python voice_prompt_tool.py --hotkey ctrl+shift+v
What it does:
- global start/stop hotkey for microphone capture
- local faster-whisper transcription (offline)
- file reference extraction (
auth.ts->@auth.ts) - prompt envelope copied to clipboard:
[FILE REFERENCE: ...][TASK: ...]
Optional direct paste after copy:
python voice_prompt_tool.py --autopaste
📚 Using the RAG Tool
Add documents to the data/ folder:
data/
├── document1.pdf
├── notes.md
└── research/
└── paper.pdf
Supported: PDF, DOCX, TXT, MD, HTML, and more.
Stitch-style response shape
The rag tool now returns a JSON string with:
answer: final synthesized answer textconfidence:low,medium, orhighfallback:truewhen evidence is weak/insufficientsources: ranked source snippets (source_id,score,snippet)
The rag_stitch tool returns a UI-oriented JSON string:
state:answeredorfallbackanswerconfidence(low,medium, orhigh)source_cards(empty whenstateisfallbackso the UI stays clean)show_sources(falseon fallback)debug_retrieval_cards(only whenSTITCH_RAG_DEBUG=1and fallback — raw top chunks for debugging)
Repository split (Stitch production)
The Stitch desktop app (React + Tauri) is migrating to RanneG/stitch-app; linkup_mcp remains the MCP server and HTTP bridge for local RAG, OAuth, subscriptions, face, and in-app help. Cutover checklist and file inventory: docs/stitch/MIGRATION.md (see docs/stitch/README.md).
stitch-api-types (TypeScript)
NPM workspace packages/stitch-api-types publishes .d.ts for POST /api/rag/stitch, POST /api/rag/stitch-help, GET /api/health, and related payloads. Build from repo root: npm run build:stitch-api-types. stitch-app can depend on it with a file: path (see stitch-app docs/BACKEND.md).
Stitch HTTP bridge (for the Stitch desktop app)
Run a small Flask server that exposes the same payload as rag_stitch, plus optional local face verification (/api/face/*, DeepFace + OpenCV liveness — see face_verification/). Requires stitch-bridge extras:
uv sync --extra stitch-bridge
.\.venv\Scripts\python.exe stitch_rag_bridge.py
Then point the Stitch app’s Vite dev proxy at http://127.0.0.1:8765 (see stitch-app docs/BACKEND.md or integrations/stitch/README.md; proxy /api for RAG, face, auth, subscriptions, and help routes).
Who needs what: Anyone can run the Stitch UI from stitch-app with Node (see docs/RUNNING.md). linkup_mcp is required for /api/* backend capabilities (auth, data, RAG, face, server-backed Help).
Develop Stitch UI from this repo (optional)
Root scripts npm run dev:browser, npm run dev:desktop, npm run build:stitch-web, npm run build:stitch-app use scripts/run-stitch-ui.mjs, which resolves STITCH_APP_ROOT or sibling ../stitch-app only. See docs/stitch/MIGRATION.md.
Stitch single-window GUI
The canonical bundled flow now starts from stitch-app (Stitch.bat there). It uses this repo for backend bridge capabilities when needed.
- Build the Stitch desktop bundle inside stitch-app (
npm run build). - Run
Stitch.batfrom stitch-app root. - Keep this repo available for the bridge runtime (
stitch_rag_bridge.py) on127.0.0.1:8765.
Stitch as a native desktop app (no long manual command chain)
Stitch’s apps/desktop package uses Tauri for a real windowed app (npm run dev there = tauri dev). Run these from stitch-app:
| Goal | What to do |
|---|---|
| One double-click (bridge + sync + Tauri) | Run Stitch-Desktop.bat in the stitch-app repo root. |
| Same from a terminal | npm run dev (stitch-app) |
| Bridge already running | Start Stitch from stitch-app and keep this repo bridge on 127.0.0.1:8765 |
| Tauri only (you start the bridge yourself) | npm run dev:desktop |
| Browser tab only (no Tauri) | npm run dev:browser (uses stitch-app via run-stitch-ui.mjs) |
Packaged .exe / installer |
npm run build:stitch-app (after Tauri prerequisites and a stitch-app clone) |
You need Node on PATH and a local stitch-app clone (sibling ../stitch-app or STITCH_APP_ROOT). The first Tauri dev run may compile Rust dependencies (one-time wait).
Quick regression run
To run the v1 prompt suite against your local PDF corpus:
python rag_regression.py
This prints each response payload and a small summary (sourced count, fallback count, low-confidence count).
Stitch JSON contract tests
python -m unittest tests.test_rag_stitch_contract -v
Validates rag_stitch_contract._to_stitch_view shapes (answered vs fallback, show_sources, optional debug_retrieval_cards).
If MCP-security prompts fall back, add the MCP landscape paper to data/:
🛠️ Project Structure
linkup_mcp/
├── server.py # Main MCP server
├── local_whisper_stt.py # faster-whisper helpers (MCP transcribe_wav_file)
├── rag.py # RAG workflow
├── stitch_rag_bridge.py # Local HTTP bridge for Stitch UI dev (RAG + /api/face)
├── face_verification/ # Local 1:1 face match + liveness (used by bridge)
├── integrations/stitch/ # Pointer README — UI lives in stitch-app repo
├── docs/ # e.g. stitch_user_guide.md (bridge Help / Ask Stitch)
├── data/ # Your documents
├── pyproject.toml # Dependencies
├── .cursorrules # AI context for Cursor
└── .env # Environment variables (create this)
🔧 How It Works
Cursor IDE → MCP Server (server.py)
↓
┌────────────┴────────────┐
│ RAG Tool │ Web Search│
│ (rag.py) │ (Linkup) │
└──────┬──────┴────────────┘
↓
Ollama (llama3.2) - runs locally
💰 Cost
| Tool | Cost |
|---|---|
| RAG | $0 (local Ollama) |
| Web Search | ~$10-50/month (Linkup API) |
| Ollama | $0 (runs locally) |
🐛 Troubleshooting
MCP server not loading?
- Check Ollama is running:
ollama list - Verify path in
mcp.json - Check Cursor logs:
%APPDATA%\Cursor\logs\
Ollama connection refused?
ollama serve
🔐 Privacy
- ✅ RAG Tool: 100% local, documents never leave your machine
- ✅ Ollama: Runs locally, no cloud API calls
- ⚠️ Web Search: Queries sent to Linkup servers
📖 Related Projects
| Repository | Purpose |
|---|---|
| chatbot-rag-core | Reusable Python RAG library |
| chatbot-api-server | Production Docker API server |
🎓 Resources
📝 License
MIT License - See LICENSE
🙏 Credits
- Original: patchy631/ai-engineering-hub
- Linkup for web search
- LlamaIndex for RAG
- Ollama for local AI
Made with ❤️ for Cursor IDE users
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。