mcp-context
Local MCP server that provides semantic search (RAG) over code repositories, enabling AI clients like Claude and Gemini to access project context without manual re-upload.
README
mcp-context
Local Model Context Protocol (MCP) server with semantic search (RAG) over code repositories. Exposes the context of multiple projects to external AI clients — Claude.ai, Gemini, Claude Code — eliminating the need to manually repass context at each session.
Stack: Python · FastMCP · Qdrant · sentence-transformers · Next.js · Docker · Cloudflare Tunnel
Prerequisites
Make sure the items below are installed before continuing:
| Tool | Minimum version | Check |
|---|---|---|
| Python | 3.11 | python3 --version |
| Docker | 24.0 | docker --version |
| Docker Compose | 2.20 | docker compose version |
| Node.js | 18.0 | node --version |
| npm | 9.0 | npm --version |
| Git | any | git --version |
| cloudflared | any | cloudflared --version |
A Cloudflare account with an active domain is required for remote connectivity (Phase 3).
Installation
# 1. Clone the repository
git clone https://github.com/ericlimabr/mcp-context.git
cd mcp-context
# 2. Copy the environment variables file
cp .env.example .env
# 3. Run setup — installs Python dependencies via uv and starts Qdrant
make setup
Note on
GITHUB_TOKEN: The.envfile includes aGITHUB_TOKENvariable for read access to repositories. To get this token, go to your GitHub Settings > Developer settings > Personal access tokens. Generate a new token and paste it into your.envfile.
Configuration
1. Environment variables
Edit the .env file created in the previous step:
# Root path where your projects are stored on the machine
PROJECTS_ROOT=/home/your-user/projects
# Access password for the administrative panel
ADMIN_PASSWORD=choose-a-strong-password
2. Configure Cloudflare Tunnel
# Authenticate cloudflared with your Cloudflare account
cloudflared tunnel login
# Create the permanent tunnel
cloudflared tunnel create mcp-context
# Associate with your subdomain (replace yourdomain.com)
cloudflared tunnel route dns mcp-context mcp.yourdomain.com
Create cloudflared/config.yml in the project root (this file is gitignored). Replace <id> with the UUID printed by the tunnel create command above:
tunnel: mcp-context
credentials-file: /home/your-user/.cloudflared/<id>.json
ingress:
- hostname: mcp.yourdomain.com
service: http://localhost:17800
- service: http_status:404
3. Create the frontend
This step is only needed once. It creates the Next.js project and removes the internal .git/ automatically:
make frontend-setup
4. Index the first project
Open the frontend, add a project path and trigger indexing:
make frontend
# Access http://localhost:17801
Or run the indexer directly from the terminal:
make index
Running locally (development)
To start the MCP server with auto-reload (recommended while developing):
make dev
This starts Qdrant, the Cloudflare Tunnel, and the MCP server with hot-reload enabled. The server restarts automatically on every file change in server/.
To start all services in the background (MCP server, frontend, tunnel, Qdrant):
make server-dev
Available services:
| Service | URL |
|---|---|
| MCP Server | http://localhost:17800 |
| Frontend (admin + dashboard) | http://localhost:17801 |
| Qdrant (API) | http://localhost:17810 |
Real-time logs are available in logs/:
tail -f logs/server.log # MCP server
tail -f logs/frontend.log # frontend
tail -f logs/tunnel.log # Cloudflare Tunnel
make qdrant-logs # Qdrant
To stop everything:
make stop
Local deploy (all services in containers)
To run the project fully containerized — useful for simulating the production environment or having everything start together with Docker:
# First time: build the images
make prod-build
# Start all containers
make prod-up
# Stop everything
make prod-down
# Real-time logs
make prod-logs
Warning: make sure
PROJECTS_ROOTin.envpoints to the correct directory before runningprod-up. The MCP server container mounts that path to access local files.
Make commands
| Command | Description |
|---|---|
make setup |
First run: installs deps via uv and starts Qdrant |
make frontend-setup |
Creates the Next.js project in apps/frontend/ (once) |
make dev |
Starts Qdrant + tunnel + MCP server with auto-reload |
make server-dev |
Starts all services in the background |
make stop |
Stops all dev services |
make server |
Starts only the MCP server (port 17800) |
make frontend |
Starts only the Next.js frontend (port 17801) |
make tunnel |
Starts only the Cloudflare Tunnel |
make index |
Runs the indexing worker |
make qdrant-up |
Starts Qdrant via Docker Compose |
make qdrant-down |
Stops Qdrant |
make qdrant-logs |
Qdrant logs in real time |
make prod-build |
Build of all Docker images |
make prod-up |
Starts all containers |
make prod-down |
Stops all containers |
make prod-logs |
Logs of all containers in real time |
Repository structure
mcp-context/
├── server/ # MCP Server (FastMCP/SSE, port 17800)
│ ├── main.py # Entrypoint and MCP configuration
│ ├── tools/ # MCP tool definitions (planned)
│ ├── resources/ # MCP resource definitions (planned)
│ └── embeddings.py # Local embedding model loading (planned)
├── indexer/ # Project indexing worker (planned)
│ ├── worker.py # Orchestrates indexing
│ ├── chunker.py # Function-scope chunking
│ └── qdrant_client.py # Qdrant client abstraction
├── apps/
│ └── frontend/ # Next.js app — admin panel + dashboard (port 17801)
│ # Generated by make frontend-setup
├── cloudflared/ # Cloudflare Tunnel config (gitignored)
│ └── config.yml
├── docs/
│ ├── ARCHITECTURE.md # Detailed system architecture
│ ├── DECISIONS.md # Architecture decisions
│ ├── ENDPOINTS.md # Endpoints documentation
│ └── ROADMAP.md # Implementation phases
├── logs/ # Service logs in dev (gitignored)
├── .pids/ # Process PIDs in dev (gitignored)
├── qdrant_data/ # Persisted Qdrant data (gitignored)
├── config.json # Project configuration (gitignored)
├── .env # Environment variables (gitignored)
├── .env.example # Environment variables template
├── docker-compose.yml # Qdrant for development
├── docker-compose.prod.yml # All services for local deploy
├── Makefile # Command shortcuts
├── pyproject.toml # Python project and dependencies (uv)
├── CONTEXT.md # Project context for LLMs
└── README.md # This file
Known limitations
- The server depends on the local machine being on to work remotely via Cloudflare Tunnel
- The Qdrant index reflects the state of the code at the time of the last indexing — configure a
post-commithook to keep the index updated automatically after each commit - Binary files, images and assets are not indexed
- The embedding model (
jina-embeddings-v2-base-code, ~160 MB) is automatically downloaded on the first run viasentence-transformers
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。