Skip to main content
Glama
SammySnake-d

Fast Context MCP

by SammySnake-d

Fast Context MCP

AI-driven semantic code search as an MCP tool — powered by Windsurf's reverse-engineered SWE-grep protocol.

Any MCP-compatible client (Claude Code, Claude Desktop, Cursor, etc.) can use this to search codebases with natural language queries. All tools are bundled via npm — no system-level dependencies needed (ripgrep via @vscode/ripgrep, tree via tree-node-cli). Works on macOS, Windows, and Linux.

How It Works

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

Prerequisites

  • Node.js >= 18

  • Windsurf account — free tier works (needed for API key)

No need to install ripgrep — it's bundled via @vscode/ripgrep.

Installation

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

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

Option 2: From Source

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

Setup

1. Get Your Windsurf/Devin API Key

The server auto-extracts the API key from Devin CLI/Desktop or a legacy Windsurf installation. You can also use the extract_windsurf_key MCP tool after setup, or set WINDSURF_API_KEY manually.

Desktop credentials are discovered in this order: Devin, legacy Deviv, then Windsurf.

Platform

Path

macOS

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

Windows

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

Linux

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

On WSL/Linux, the server first checks Devin CLI credentials at ~/.local/share/devin/credentials.toml. If a Windows-extracted key returns 403 inside WSL, run devin login inside WSL and retry.

2. Configure MCP Client

Claude Code

Add to ~/.claude.json under mcpServers:

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

For beta/next release:

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

Claude Desktop

Add to claude_desktop_config.json under mcpServers:

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

For beta/next release:

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

If WINDSURF_API_KEY is omitted, the server auto-discovers it from your local Windsurf installation.

Environment Variables

Variable

Default

Description

WINDSURF_API_KEY

(auto-discover)

Windsurf API key

FC_MAX_TURNS

3

Search rounds per query (more = deeper but slower)

FC_MAX_COMMANDS

8

Max parallel commands per round

FC_TIMEOUT_MS

30000

Connect-Timeout-Ms for streaming requests

FC_HIDE_EXTRACT_WINDSURF_KEY_TOOL

false

Hide extract_windsurf_key from MCP tools when set to 1, true, yes, or on

FC_RESULT_MAX_LINES

50

Max lines per command output (truncation)

FC_LINE_MAX_CHARS

250

Max characters per output line (truncation)

FC_CACHE_DISABLED

(unset)

Disable the in-memory result cache with 1, true, yes, or on

FC_CACHE_TTL_MS

300000

Result-cache TTL; <=0 disables caching

FC_CACHE_MAX_ENTRIES

200

Maximum in-memory cache entries

FC_ALLOW_INSECURE_TLS

(unset)

Set to 1 only when a trusted corporate proxy requires disabled TLS verification

WS_MODEL

MODEL_SWE_1_6_FAST

Windsurf model name

WS_APP_VER

1.48.2

Windsurf app version (protocol metadata)

WS_LS_VER

1.9544.35

Windsurf language server version (protocol metadata)

Available Models

The model can be changed by setting WS_MODEL (see environment variables above).

Available Models

Default: MODEL_SWE_1_6_FAST — fastest speed, richest grep keywords, finest location granularity.

MCP Tools

AI-driven semantic code search with tunable parameters.

Parameter

Type

Required

Default

Description

query

string

Yes

Natural language search query

project_path

string

No

cwd

Absolute path to project root

tree_depth

integer

No

3

Directory tree depth for repo map (1-6). Higher = more context but larger payload. Auto falls back to lower depth if tree exceeds 250KB. Use 1-2 for huge monorepos (>5000 files), 3 for most projects, 4-6 for small projects.

max_turns

integer

No

3

Search rounds (1-5). More = deeper search but slower. Use 1-2 for simple lookups, 3 for most queries, 4-5 for complex analysis.

max_results

integer

No

10

Maximum number of files to return (1-30). Smaller = more focused, larger = broader exploration.

exclude_paths

string[]

No

[]

Directory/file patterns excluded from the repository map and search context.

Returns:

  1. Relevant files with line ranges

  2. Suggested search keywords (rg patterns used during AI search)

  3. Diagnostic metadata ([config] line showing actual tree_depth used, tree size, and whether fallback occurred)

Example output:

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 output includes status-specific hints:

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

Extract Windsurf API Key from local installation. No parameters.

Set FC_HIDE_EXTRACT_WINDSURF_KEY_TOOL=1 at MCP server startup to hide this tool from tools/list. This does not disable internal API-key auto-discovery for fast_context_search.

Project Structure

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

How the Search Works

  1. Project directory is mapped to virtual /codebase path

  2. Directory tree generated at requested depth (default L=3), with automatic fallback to lower depth if tree exceeds 250KB

  3. Query + directory tree sent to Windsurf's Devstral model via Connect-RPC/Protobuf

  4. Devstral generates tool commands (ripgrep, file reads, tree, ls, glob)

  5. Commands executed locally in parallel (up to FC_MAX_COMMANDS per round)

  6. Results sent back to Devstral for the next round

  7. After max_turns rounds, Devstral returns file paths + line ranges

  8. All rg patterns used during search are collected as suggested keywords

  9. Diagnostic metadata appended to help the calling AI tune parameters

Technical Details

  • Protocol: Connect-RPC over HTTP/1.1, Protobuf encoding, gzip compression

  • Model: Devstral (MODEL_SWE_1_6_FAST, configurable)

  • Local tools: rg (bundled via @vscode/ripgrep), readfile (Node.js fs), tree (tree-node-cli), ls (Node.js fs), glob (Node.js fs)

  • Auth: API Key → JWT (auto-fetched per session)

  • Runtime: Node.js >= 18 (ESM)

Dependencies

Package

Purpose

@modelcontextprotocol/sdk

MCP server framework

@vscode/ripgrep

Bundled ripgrep binary (cross-platform)

tree-node-cli

Cross-platform directory tree (replaces system tree)

sql.js

Read Devin/Windsurf's local SQLite DB without a native build step

zod (^3.25.76)

Schema validation; avoids the incomplete 3.25.0 tarball served by some npm mirrors

友情链接

License

MIT

Available Tools

2 tools
extract_windsurf_keyA

Extract Windsurf API Key from local installation. Auto-detects OS (macOS/Windows/Linux) and reads the API key from Windsurf's local database. Set the result as WINDSURF_API_KEY env var.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Given no annotations, the description fully covers the tool's behavior: auto-detecting OS, reading a local database, and setting an environment variable. It could mention potential permissions or security considerations for reading a local database, but overall is transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise with two clear, front-loaded sentences. No unnecessary information, every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters, no output schema, and a straightforward operation, the description provides complete context: what the tool does, how it works (auto-detection), and the outcome (setting env var).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and 100% schema coverage, so the baseline is 4. The description does not need to add parameter information, and it adequately explains that no parameters are needed due to auto-detection.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: extracting the Windsurf API key from the local installation, with OS auto-detection and env var setting. It distinguishes from the sibling tool 'fast_context_search' which serves a different function.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states the outcome (setting the env var) but does not provide explicit guidance on when or when not to use this tool versus alternatives. Usage context is implied but not detailed.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.2.1
    • Changedfast_context_search4 fields changed
      • addedInput schema / properties / exclude_paths
        Added value: +{
        +  "default": [],
        +  "description": "Directory/file patterns to exclude from tree and search context. Useful for reducing payload size on large repos. Examples: ['node_modules', 'dist', '.git', 'build', 'coverage', '*.min.*']",
        +  "items": {
        +    "type": "string"
        +  },
        +  "type": "array"
        +}
      • addedInput schema / properties / max_results
        Added value: +{
        +  "default": 10,
        +  "description": "Maximum number of files to return. Default 10. Use a smaller value (3-5) for focused queries. Use a larger value (15-30) for broad exploration queries.",
        +  "maximum": 30,
        +  "minimum": 1,
        +  "type": "integer"
        +}
      • addedInput schema / properties / max_turns
        Added value: +{
        +  "default": 3,
        +  "description": "Number of search rounds. Each round: remote AI generates search commands → local execution → results sent back. Default 3. Use 1 for quick simple lookups. Use 4-5 for complex queries requiring deep tracing across many files. More rounds = better results but slower and uses more API quota.",
        +  "maximum": 5,
        +  "minimum": 1,
        +  "type": "integer"
        +}
      • addedInput schema / properties / tree_depth
        Added value: +{
        +  "default": 3,
        +  "description": "Directory tree depth for the initial repo map sent to the remote AI. Default 3. Use 1-2 for huge monorepos (>5000 files) or if you get payload size errors. Use 4-6 for small projects (<200 files) where you want the AI to see deeper structure. Auto falls back to a lower depth if tree output exceeds 250KB.",
        +  "maximum": 6,
        +  "minimum": 1,
        +  "type": "integer"
        +}
  2. 2 tool updatesv1.0.0
    • First observedextract_windsurf_key
    • First observedfast_context_search

TDQS

A4.1/5.0
Disambiguation5/5

The two tools have completely distinct purposes: one extracts an API key from a local installation, the other performs semantic code search. No overlap or ambiguity exists.

Naming Consistency4/5

Both tools use snake_case and follow a descriptive pattern (extract_* and fast_*). Although the verb style differs slightly (command vs. brand adjective), the naming is clear and consistent in format.

Tool Count3/5

With only two tools, the server feels minimal. While the tools are focused, the count is on the low end of what is typically expected, making it borderline appropriate.

Completeness2/5

The server covers API key extraction and semantic search, but lacks related operations like API key management, file content retrieval, or result navigation. Significant gaps exist for a context-focused server.

Maintenance

ActivityMaintained
ResponsivenessWithin a week

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Connectors

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
    171
    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
    A
    quality
    C
    maintenance
    Semantic code search MCP server that reduces token usage by ~95% by returning top relevant code chunks instead of full files.
    8
    9
    MIT

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