mcp-context
コードリポジトリに対してセマンティック検索(RAG)を行う、ローカルのModel Context Protocol (MCP)サーバーです。複数のプロジェクトのコンテキストをClaude.ai、Gemini、Claude Codeなどの外部AIクライアントに公開し、セッションごとに手動でコンテキストを再入力する手間を省きます。
スタック: Python · FastMCP · Qdrant · sentence-transformers · Next.js · Docker · Cloudflare Tunnel
前提条件
作業を始める前に、以下のツールがインストールされていることを確認してください:
ツール | 最小バージョン | 確認コマンド |
Python | 3.11 |
|
Docker | 24.0 |
|
Docker Compose | 2.20 |
|
Node.js | 18.0 |
|
npm | 9.0 |
|
Git | any |
|
cloudflared | any |
|
リモート接続(フェーズ3)には、有効なドメインを持つCloudflareアカウントが必要です。
Related MCP server: mcplens
インストール
# 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
GITHUB_TOKENに関する注意:.envファイルには、リポジトリへの読み取りアクセス権を持つGITHUB_TOKEN変数が含まれています。このトークンを取得するには、GitHubのSettings > Developer settings > Personal access tokensに移動してください。新しいトークンを生成し、.envファイルに貼り付けます。
設定
1. 環境変数
前のステップで作成した.envファイルを編集します:
# 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-password2. 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プロジェクトのルートにcloudflared/config.ymlを作成します(このファイルはgitignoredです)。<id>を上記のtunnel createコマンドで出力されたUUIDに置き換えてください:
tunnel: mcp-context
credentials-file: /home/your-user/.cloudflared/<id>.json
ingress:
- hostname: mcp.yourdomain.com
service: http://localhost:17800
- service: http_status:4043. フロントエンドの作成
このステップは1回だけ必要です。Next.jsプロジェクトを作成し、内部の.git/を自動的に削除します:
make frontend-setup4. 最初のプロジェクトのインデックス作成
フロントエンドを開き、プロジェクトパスを追加してインデックス作成をトリガーします:
make frontend
# Access http://localhost:17801または、ターミナルから直接インデクサーを実行します:
make indexローカルでの実行(開発)
自動リロード付きでMCPサーバーを起動するには(開発中推奨):
make devこれにより、Qdrant、Cloudflare Tunnel、およびホットリロードが有効なMCPサーバーが起動します。server/内のファイルが変更されるたびに、サーバーは自動的に再起動します。
すべてのサービスをバックグラウンドで起動するには(MCPサーバー、フロントエンド、トンネル、Qdrant):
make server-dev利用可能なサービス:
サービス | URL |
MCP Server | |
Frontend (admin + dashboard) | |
Qdrant (API) |
リアルタイムログは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すべて停止するには:
make stopローカルデプロイ(すべてのサービスをコンテナで実行)
プロジェクトを完全にコンテナ化して実行するには(本番環境のシミュレーションや、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警告:
prod-upを実行する前に、.env内のPROJECTS_ROOTが正しいディレクトリを指していることを確認してください。MCPサーバーコンテナは、ローカルファイルにアクセスするためにそのパスをマウントします。
Makeコマンド
コマンド | 説明 |
| 初回実行: uv経由で依存関係をインストールし、Qdrantを起動 |
|
|
| Qdrant + トンネル + 自動リロード付きMCPサーバーを起動 |
| すべてのサービスをバックグラウンドで起動 |
| すべての開発サービスを停止 |
| MCPサーバーのみ起動(ポート17800) |
| Next.jsフロントエンドのみ起動(ポート17801) |
| Cloudflare Tunnelのみ起動 |
| インデックス作成ワーカーを実行 |
| Docker Compose経由でQdrantを起動 |
| Qdrantを停止 |
| Qdrantのログをリアルタイムで表示 |
| すべてのDockerイメージをビルド |
| すべてのコンテナを起動 |
| すべてのコンテナを停止 |
| すべてのコンテナのログをリアルタイムで表示 |
リポジトリ構造
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既知の制限事項
Cloudflare Tunnel経由でリモートから動作させるには、ローカルマシンが起動している必要があります
Qdrantのインデックスは、最後にインデックスを作成した時点のコードの状態を反映します。コミットごとに自動的にインデックスを更新するには、
post-commitフックを設定してくださいバイナリファイル、画像、アセットはインデックスされません
埋め込みモデル(
jina-embeddings-v2-base-code、約160 MB)は、初回実行時にsentence-transformers経由で自動的にダウンロードされます
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ericlimabr/mcp-context'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
