Install Fast Context MCP from source
mainTo install from the source repository:
git clone https://github.com/SammySnake-d/fast-context-mcp.git
cd fast-context-mcp
npm installrepository·main·Indexed 43 days ago
https://github.com/sammysnake-d/fast-context-mcpAn AI-driven semantic code search tool implemented as an MCP server. It uses a reverse-engineered Windsurf SWE-grep protocol to enable AI clients like Claude or Cursor to perform natural-language searches across local codebases using bundled tools like ripgrep and tree. Version 1.3.2.
To install from the source repository:
git clone https://github.com/SammySnake-d/fast-context-mcp.git
cd fast-context-mcp
npm installYou can install the latest stable release or the beta/next release using npm. This project has no system-level dependencies as ripgrep and tree are bundled.
Latest stable release:
npm install @sammysnake/fast-context-mcpBeta/next release:
npm install @sammysnake/fast-context-mcp@nextAdd the server configuration to your claude_desktop_config.json file under the mcpServers key. You must provide your WINDSURF_API_KEY in the env object.
Stable release configuration:
{
"fast-context": {
"command": "npx",
"args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp"],
"env": {
"WINDSURF_API_KEY": "sk-ws-01-xxxxx"
}
}
}Beta/next release configuration:
{
"fast-context": {
"command": "npx",
"args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp@next"],
"env": {
"WINDSURF_API_KEY": "sk-ws-01-xxxxx"
}
}
}Add the server configuration to your ~/.claude.json file under the mcpServers key. You must provide your WINDSURF_API_KEY in the env object.
Stable release configuration:
{
"fast-context": {
"command": "npx",
"args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp"],
"env": {
"WINDSURF_API_KEY": "sk-ws-01-xxxxx"
}
}
}Beta/next release configuration:
{
"fast-context": {
"command": "npx",
"args": ["-y", "--prefer-online", "@sammysnake/fast-context-mcp@next"],
"env": {
"WINDSURF_API_KEY": "sk-ws-01-xxxxx"
}
}
}The server is a Node.js application that communicates via the Model Context Protocol (MCP) using standard input/output (stdio) transport. You can start it directly using node.
node src/server.mjsPerforms AI-driven semantic code search. It maps your project, generates a directory tree, and uses the Windsurf Devstral model to execute local commands (like rg) to find relevant code.
Parameters:
query (string, Required): Natural language search query.project_path (string, Optional): Absolute path to project root. Defaults to cwd.tree_depth (integer, Optional): Directory tree depth for repo map (1-6). Default is 3. Use 1-2 for huge monorepos, 3 for most projects, 4-6 for small projects. Automatically falls back to a lower depth if the tree exceeds 250KB.max_turns (integer, Optional): Search rounds (1-5). Default is 3. Use 1-2 for simple lookups, 3 for most queries, 4-5 for complex analysis.max_results (integer, Optional): Maximum number of files to return (1-30). Default is 10.exclude_paths (string[], Optional): Directory/file patterns excluded from the repository map and search context. Defaults to [].Returns:
rg patterns used).[config] line showing actual tree_depth used and tree size).Attempts to extract the Windsurf API Key from your local installation (Devin, Deviv, or Windsurf) by reading local SQLite databases. This tool takes no parameters.
Note: You can hide this tool from the MCP tool list by setting the environment variable FC_HIDE_EXTRACT_WINDSURF_KEY_TOOL=1 at startup.
The server behavior can be tuned using the following environment variables:
| Variable | Description | Default |
|---|---|---|
WINDSURF_API_KEY | Windsurf API key (auto-discovered if not set) | N/A |
FC_MAX_TURNS | Search rounds per query (clamped 1-5) | 3 |
FC_MAX_COMMANDS | Max parallel commands per round (clamped 1-20) | 8 |
FC_TIMEOUT_MS | Connect-Timeout-Ms for streaming requests (clamped 1000-300000) | 30000 |
FC_HIDE_EXTRACT_WINDSURF_KEY_TOOL | If true, hides the extract_windsurf_key tool from MCP clients | false |
You can control the truncation behavior of the ToolExecutor output by setting the following environment variables. This is useful if you need to increase the amount of context returned to an AI agent.
| Variable | Default | Range | Description |
|---|---|---|---|
FC_RESULT_MAX_LINES | 50 | 1 to 500 | Maximum number of lines returned in a result. |
FC_LINE_MAX_CHARS | 250 | 20 to 10000 | Maximum characters per line before silent truncation. |
Use these environment variables to tune the behavior of the MCP server.
| 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) |
The ToolExecutor class is designed to execute restricted filesystem and search commands (like rg, ls, readfile, tree, and glob) within a specific project root. It is optimized to mimic Windsurf's behavior, including path remapping (converting real paths to /codebase) and output truncation to prevent overwhelming the context.
To use it, instantiate the class with your project's absolute path. You can then either call specific methods directly or use the execCommand / execToolCall methods to dispatch commands from structured objects.
import { ToolExecutor } from './src/executor.mjs';
const executor = new ToolExecutor('/absolute/path/to/project');
// Direct method call
const files = executor.ls('/codebase', true, false);
// Dispatching via command object
const result = executor.execCommand({
type: 'rg',
pattern: 'TODO',
path: '/codebase'
});Use extractKeyInfo() to programmatically retrieve information about the discovered Windsurf API key. This is useful for verifying if the user is correctly logged into Windsurf before starting a search.
import { extractKeyInfo } from '@sammysnake/fast-context-mcp';
try {
const keyInfo = await extractKeyInfo();
console.log('API Key found:', keyInfo.api_key);
} catch (err) {
console.error('Could not find API key:', err.message);
}