Skip to main content
Glama
SammySnake-d

Fast Context MCP

by SammySnake-d

Fast Context MCP

AI駆動のセマンティックコード検索をMCPツールとして提供します — WindsurfのリバースエンジニアリングされたSWE-grepプロトコルを利用。

MCP互換のクライアント(Claude Code、Claude Desktop、Cursorなど)は、自然言語クエリでコードベースを検索できます。すべてのツールはnpm経由でバンドルされています — システムレベルの依存関係は不要です(ripgrepは @vscode/ripgrep、treeは tree-node-cli を使用)。macOS、Windows、Linuxで動作します。

動作の仕組み

You: "where is the authentication logic?"
         │
         ▼
┌─────────────────────────┐
│  Fast Context MCP       │
│  (local MCP server)     │
│                         │
│  1. Maps project → /codebase
│  2. Sends query to Windsurf Devstral API
│  3. AI generates rg/readfile/tree commands
│  4. Executes commands locally (built-in rg)
│  5. Returns results to AI
│  6. Repeats for N rounds
│  7. Returns file paths + line ranges
│     + suggested search keywords
└─────────────────────────┘
         │
         ▼
Found 3 relevant files.
  [1/3] /project/src/auth/handler.py (L10-60)
  [2/3] /project/src/middleware/jwt.py (L1-40)
  [3/3] /project/src/models/user.py (L20-80)

Suggested search keywords:
  authenticate, jwt.*verify, session.*token

Related MCP server: code-rag

前提条件

  • Node.js >= 18

  • Windsurfアカウント — 無料枠で利用可能(APIキーに必要)

ripgrepをインストールする必要はありません — @vscode/ripgrep 経由でバンドルされています。

インストール

オプション1: npm(推奨)

# Latest stable release
npm install @sammysnake/fast-context-mcp

# Or beta/next release
npm install @sammysnake/fast-context-mcp@next

オプション2: ソースから

git clone https://github.com/SammySnake-d/fast-context-mcp.git
cd fast-context-mcp
npm install

セットアップ

1. Windsurf/Devin APIキーを取得する

サーバーはDevin CLI/DesktopまたはレガシーなWindsurfインストールからAPIキーを自動抽出します。セットアップ後に extract_windsurf_key MCPツールを使用するか、手動で WINDSURF_API_KEY を設定することもできます。

デスクトップの認証情報は、Devin、レガシーの Deviv、その後 Windsurf の順で検出されます。

プラットフォーム

パス

macOS

~/Library/Application Support/Devin/User/globalStorage/state.vscdb

Windows

%APPDATA%/Devin/User/globalStorage/state.vscdb

Linux

~/.config/Devin/User/globalStorage/state.vscdb

WSL/Linuxでは、サーバーは最初に ~/.local/share/devin/credentials.toml でDevin CLIの認証情報を確認します。WSL内でWindowsで抽出したキーが403を返す場合は、WSL内で devin login を実行して再試行してください。

2. MCPクライアントを設定する

Claude Code

~/.claude.jsonmcpServers に追加します:

{
  "fast-context": {
    "command": "npx",
    "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp"],
    "env": {
      "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
    }
  }
}

ベータ/次期リリースの場合:

{
  "fast-context": {
    "command": "npx",
    "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp@next"],
    "env": {
      "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
    }
  }
}

Claude Desktop

claude_desktop_config.jsonmcpServers に追加します:

{
  "fast-context": {
    "command": "npx",
    "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp"],
    "env": {
      "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
    }
  }
}

ベータ/次期リリースの場合:

{
  "fast-context": {
    "command": "npx",
    "args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp@next"],
    "env": {
      "WINDSURF_API_KEY": "sk-ws-01-xxxxx"
    }
  }
}

WINDSURF_API_KEY が省略された場合、サーバーはローカルのWindsurfインストールから自動的に検出します。

環境変数

変数

デフォルト

説明

WINDSURF_API_KEY

(自動検出)

Windsurf APIキー

FC_MAX_TURNS

3

クエリごとの検索ラウンド数(多いほど深く検索されますが、遅くなります)

FC_MAX_COMMANDS

8

ラウンドごとの最大並列コマンド数

FC_TIMEOUT_MS

30000

ストリーミングリクエストのConnect-Timeout-Ms

FC_HIDE_EXTRACT_WINDSURF_KEY_TOOL

false

1trueyeson に設定すると、MCPツールから extract_windsurf_key を非表示にします

FC_RESULT_MAX_LINES

50

コマンド出力の最大行数(切り詰め)

FC_LINE_MAX_CHARS

250

出力行の最大文字数(切り詰め)

FC_CACHE_DISABLED

(未設定)

1trueyeson でインメモリ結果キャッシュを無効にします

FC_CACHE_TTL_MS

300000

結果キャッシュのTTL。<=0 でキャッシュを無効化

FC_CACHE_MAX_ENTRIES

200

インメモリキャッシュの最大エントリ数

FC_ALLOW_INSECURE_TLS

(未設定)

信頼された企業プロキシがTLS検証の無効化を必要とする場合にのみ 1 に設定します

WS_MODEL

MODEL_SWE_1_6_FAST

Windsurfモデル名

WS_APP_VER

1.48.2

Windsurfアプリバージョン(プロトコルメタデータ)

WS_LS_VER

1.9544.35

Windsurf言語サーバーバージョン(プロトコルメタデータ)

利用可能なモデル

モデルは WS_MODEL を設定することで変更できます(上記の環境変数を参照)。

利用可能なモデル

デフォルト: MODEL_SWE_1_6_FAST — 最速の速度、最も豊富なgrepキーワード、最も細かい位置の粒度。

MCPツール

調整可能なパラメータを備えたAI駆動のセマンティックコード検索。

パラメータ

必須

デフォルト

説明

query

string

はい

自然言語の検索クエリ

project_path

string

いいえ

cwd

プロジェクトルートへの絶対パス

tree_depth

integer

いいえ

3

リポジトリマップのディレクトリツリーの深さ(1〜6)。大きいほどコンテキストが増えますが、ペイロードも大きくなります。ツリーが250KBを超えると、自動的に浅い深さにフォールバックします。巨大なモノレポ(5000ファイル超)では1〜2、ほとんどのプロジェクトでは3、小規模プロジェクトでは4〜6を使用します。

max_turns

integer

いいえ

3

検索ラウンド数(1〜5)。多いほど深く検索されますが、遅くなります。単純な検索では1〜2、ほとんどのクエリでは3、複雑な分析では4〜5を使用します。

max_results

integer

いいえ

10

返すファイルの最大数(1〜30)。小さいほど焦点が絞られ、大きいほど広く探索されます。

exclude_paths

string[]

いいえ

[]

リポジトリマップと検索コンテキストから除外するディレクトリ/ファイルパターン。

戻り値:

  1. 関連ファイル と行範囲

  2. 提案された検索キーワード(AI検索で使用されたrgパターン)

  3. 診断メタデータ(使用された実際のtree_depth、ツリーサイズ、フォールバックが発生したかどうかを示す [config] 行)

出力例:

Found 3 relevant files.

  [1/3] /project/src/auth/handler.py (L10-60, L120-180)
  [2/3] /project/src/middleware/jwt.py (L1-40)
  [3/3] /project/src/models/user.py (L20-80)

grep keywords: authenticate, jwt.*verify, session.*token

[config] tree_depth=3, tree_size=12.5KB, max_turns=3

エラー出力にはステータス別のヒントが含まれます:

Error: Request failed: HTTP 403

[hint] 403 Forbidden: Authentication failed. The API key may be expired or revoked.
Try re-extracting with extract_windsurf_key, or set a fresh WINDSURF_API_KEY env var.
If you are running inside WSL, run `devin login` inside WSL so `~/.local/share/devin/credentials.toml` exists.
Error: Request failed: HTTP 413

[diagnostic] tree_depth_used=3, tree_size=280.0KB (auto fell back from requested depth)
[hint] If the error is payload-related, try a lower tree_depth value.

extract_windsurf_key

ローカルインストールからWindsurf APIキーを抽出します。パラメータはありません。

MCPサーバー起動時に FC_HIDE_EXTRACT_WINDSURF_KEY_TOOL=1 を設定すると、このツールを tools/list から非表示にできます。これは fast_context_search の内部APIキー自動検出を無効にするものではありません。

プロジェクト構造

fast-context-mcp/
├── package.json
├── src/
│   ├── server.mjs        # MCP server entry point
│   ├── core.mjs          # Auth, message building, streaming, search loop
│   ├── executor.mjs      # Tool executor: rg, readfile, tree, ls, glob
│   ├── extract-key.mjs   # Windsurf API Key extraction (SQLite)
│   ├── path-safety.mjs   # Project-root confinement for model-selected paths
│   ├── response-repair.mjs # Malformed response repair and evidence salvage
│   ├── shared.mjs        # Repository map, answer parser, prompt builder
│   ├── cache.mjs         # In-memory search-result cache
│   └── protobuf.mjs      # Protobuf encoder/decoder + Connect-RPC frames
├── test/                 # Unit and MCP stdio integration tests
├── README.md
└── LICENSE

検索の仕組み

  1. プロジェクトディレクトリを仮想パス /codebase にマッピング

  2. 要求された深さ(デフォルトL=3)でディレクトリツリーを生成。ツリーが250KBを超える場合は、浅い深さに自動フォールバックします。

  3. クエリとディレクトリツリーをConnect-RPC/Protobuf経由でWindsurfのDevstralモデルに送信

  4. Devstralがツールコマンド(ripgrep、ファイル読み取り、tree、ls、glob)を生成

  5. コマンドをローカルで並列実行(ラウンドごとに最大 FC_MAX_COMMANDS

  6. 結果をDevstralに送り返して次のラウンドへ

  7. max_turns ラウンド後、Devstralがファイルパスと行範囲を返す

  8. 検索中に使用されたすべてのrgパターンを提案キーワードとして収集

  9. 診断メタデータを追加して、呼び出し元のAIがパラメータを調整できるようにする

技術詳細

  • プロトコル: Connect-RPC over HTTP/1.1、Protobufエンコーディング、gzip圧縮

  • モデル: Devstral (MODEL_SWE_1_6_FAST、設定可能)

  • ローカルツール: rg(@vscode/ripgrep経由でバンドル)、readfile(Node.js fs)、tree(tree-node-cli)、ls(Node.js fs)、glob(Node.js fs)

  • 認証: APIキー → JWT(セッションごとに自動取得)

  • ランタイム: Node.js >= 18 (ESM)

依存関係

パッケージ

用途

@modelcontextprotocol/sdk

MCPサーバーフレームワーク

@vscode/ripgrep

バンドルされたripgrepバイナリ(クロスプラットフォーム)

tree-node-cli

クロスプラットフォームのディレクトリツリー(システムの tree の代替)

sql.js

ネイティブビルドステップなしでDevin/WindsurfのローカルSQLite DBを読み取る

zod (^3.25.76)

スキーマ検証。一部のnpmミラーが配信する不完全な 3.25.0 tarballを回避

関連リンク

ライセンス

MIT

Install Server
A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
3dResponse time
8wRelease cycle
4Releases (12mo)
Commit activity
Issues opened vs closed

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables AI-driven semantic code search using Windsurf's reverse-engineered SWE-grep protocol to query local codebases with natural language. It executes local search tools like ripgrep and tree-node-cli to return relevant file paths and line ranges to MCP-compatible clients.
    2
    227
    MIT
  • F
    license
    Not graded
    quality
    C
    maintenance
    A semantic code search MCP server that enables natural language queries against your codebase, supporting features like related file discovery and context expansion, all running locally.
    2
  • A
    license
    Not graded
    quality
    A
    maintenance
    Semantic code search MCP server that reduces token usage by ~95% by returning top relevant code chunks instead of full files.
    9
    MIT

View all related MCP servers

Related MCP Connectors

  • Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.

View all MCP Connectors

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/SammySnake-d/fast-context-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server