faststack-mcp

faststack-mcp

Local-first, read-only MCP server for Claude Code that indexes and searches full-stack projects (FastAPI + React + PostgreSQL) with SQLite-backed FTS, cross-reference graph, and file-watcher auto-reload.

Category
访问服务器

README

faststack-mcp

Local-first, read-only MCP server for Claude Code. Indexes and searches full-stack projects (FastAPI + React + PostgreSQL) with SQLite-backed FTS, cross-reference graph, and file-watcher auto-reload — so Claude reads only what it needs instead of entire files.


Quick Start

Step 1 — Install

# From local source (development)
cd C:\path\to\faststack-mcp
pip install -e .

# From GitHub
pip install "git+https://github.com/Evaan-devlops/faststack-mcp.git"

# With optional extras
pip install -e ".[watch]"     # file watcher (watchfiles)
pip install -e ".[postgres]"  # PostgreSQL backend (psycopg2-binary)
pip install -e ".[all]"       # both

Already have watchfiles / psycopg2 globally? Nothing extra to install — they're picked up automatically.

Step 2 — Add to Claude Code

{
  "mcpServers": {
    "faststack": {
      "command": ".venv\\Scripts\\python.exe",
      "args": ["-m", "faststack_mcp"]
    }
  }
}

Step 3 — Index your project

index_folder("/path/to/your/project")          → project_id + counts
index_folder("/path/to/project", watch=True)   → + auto-reindex on file changes

Step 4 — Explore

get_project_outline(project_id)                → structure at a glance (~17 tokens)
search_symbols(project_id, "createUser")       → find functions, routes, hooks, models
get_symbol(project_id, symbol_id)              → exact code snippet only
find_references(project_id, "get_db")          → all files that import / call a symbol
get_file_context(project_id, "db.py", 120)     → 80 lines around line 120
get_file_outline(project_id, "main.py")        → all symbols in one file
search_text(project_id, "HTTPException")       → fallback full-text search
get_file_tree(project_id)                      → directory tree
list_projects()                                → all indexed projects
invalidate_cache(project_id)                   → force full re-index
get_token_usage()                              → cost + per-session averages

Tools reference (12 tools)

Tool Purpose Key params
index_folder Scan & cache a project path, force, watch, include_env_files
list_projects Browse cached projects
search_symbols Primary nav — ranked FTS symbol search query, kind, language, include_synthetic
get_symbol Read exact code snippet by symbol_id symbol_id
find_references New — import graph + text scan for a symbol symbol_name, limit
get_file_context New — read N lines around a line number file_path, around_line, radius=40
search_text Full-text search across all files query, limit
get_project_outline Grouped structure overview sections
get_file_tree Directory tree of indexed files
get_file_outline All symbols in one file file_path
invalidate_cache Remove cached index project_id
get_token_usage Session cost + tool breakdown last_n, session_id

find_references — dependency impact analysis

find_references(project_id, "get_db")
→ {
    symbol_name: "get_db",
    files_found: 3,
    total_usages: 3,
    references: [
      { file_path: "users.py",  usages: [{ line: 5,  context: "from db import get_db" }] },
      { file_path: "auth.py",   usages: [{ line: 12, context: "db = get_db()" }] },
      { file_path: "orders.py", usages: [{ line: 8,  context: "from db import get_db" }] }
    ]
  }

Use before modifying a shared symbol to understand blast radius. Uses the import graph built during index_folder (fast path) with a whole-word regex scan as fallback.

get_file_context — surrounding code window

get_file_context(project_id, "src/db.py", around_line=120, radius=40)
→ lines 80–160, line 120 marked with >>>

Use when get_symbol is too narrow — e.g. understanding the code around a symbol boundary, inspecting a migration function, or reading error-handling context.


Storage backends

Controlled by FASTSTACK_STORAGE environment variable.

Value Default When to use
sqlite Yes Local dev, any project size. Single ~/.faststack-mcp/faststack.db with FTS5.
postgres No Shared team index, large projects, or when you want the index in your project DB. Requires DATABASE_URL.
json No Backward compat with pre-v0.2 caches. No FTS or reference graph.

SQLite (default)

No configuration needed. Features:

  • FTS5 virtual table on symbol name + qualified_name + signature
  • Combined FTS5 + LIKE fallback (handles get_db, create_user underscore names)
  • refs table for find_references lookups
  • WAL mode — concurrent reads while indexing

PostgreSQL

export FASTSTACK_STORAGE=postgres
export DATABASE_URL=postgresql://user:pass@localhost:5433/mydb

Features:

  • GENERATED ALWAYS AS tsvector column + GIN index (zero-maintenance FTS)
  • ts_rank relevance ordering + ILIKE supplement
  • Tables prefixed faststack_* (no conflicts with your app tables)
  • Batch inserts via execute_values (500 rows/page)
  • faststack_references table for find_references

psycopg2-binary must be installed (pip install psycopg2-binary or pip install faststack-mcp[postgres]).


File watcher (auto-reindex)

# Start watcher alongside indexing
index_folder("/path/to/project", watch=True)
  • Uses watchfiles (install: pip install watchfiles or pip install faststack-mcp[watch])
  • 1.5 s debounce — rapid saves are batched before re-index fires
  • Background daemon thread — does not block Claude
  • Falls back silently if watchfiles is not installed

Cross-reference graph

Built automatically during index_folder. Tracks every import and from X import Y statement across Python and TypeScript/JavaScript files.

The graph is stored in the index and queried by find_references. It enables:

  • "What calls / imports this symbol?" in one tool call
  • Impact analysis before refactoring shared utilities
  • Understanding FastAPI dependency injection (Depends(get_db))

Search — include_synthetic behaviour

Synthetic symbols (auto-generated model fields, config keys) are shown or hidden depending on context:

Query kind Default
pydantic_model, model, type, interface Shown (fields are useful)
config_key, config_file, tsconfig, json_key Shown
Everything else Hidden

Override explicitly: search_symbols(project_id, "User", include_synthetic=True)


Token usage analytics

get_token_usage(last_n=20)
→ {
    totals: { input_tokens, output_tokens, estimated_cost_usd },
    averages: { input_tokens_per_session, cost_usd_per_session },
    tool_breakdown: { get_symbol: { calls: 18, est_saved: 136800 }, ... },
    estimated_tokens_saved_by_mcp: 209000
  }

Requires the Stop hook in ~/.claude/settings.json to log session data.


Supported file types

Source: .py .ts .tsx .js .jsx .sql

Config / meta: .json .jsonl .toml .yaml .yml .ini

Named files: package.json pyproject.toml tsconfig.json tsconfig.app.json tsconfig.node.json vite.config.* alembic.ini eslint.config.js tailwind.config.js tailwind.config.ts manifest.json chunks.jsonl index.faiss bunfig.toml .env.example

Skipped dirs: .git node_modules .next dist build coverage .venv venv __pycache__ .mypy_cache .pytest_cache .idea .vscode .claude

Sensitive files skipped: .env .env.* *.pem *.key *.p12 id_rsa id_ed25519 (.env* files opt-in via include_env_files=True)


Parsers

Language Parser Extracts
Python / FastAPI ast functions, classes, routes, pydantic models, services, repos, decorators, Depends()
TypeScript / React tree-sitter + regex fallback components, hooks, types, interfaces, backend routes/services/repos
SQL regex tables, views, indexes, functions, procedures, triggers
JSON / JSONL json.loads root keys, RAG chunk fields, manifest metadata
Config tomllib / json / yaml / ini package scripts/deps, tsconfig, vite, eslint, alembic
Env regex (masked) variable names — values stored as ***MASKED***
Tailwind heuristics config keys, className usage

Security

  • All file reads path-confined to the indexed project root
  • Symlink escape checks on every lookup
  • Binary file detection (null-byte scan)
  • File size cap (default 2 MB)
  • Sensitive file patterns skipped by default
  • No write or shell operations on project files
  • SQLite cache isolated at ~/.faststack-mcp/

Installation options

# Local dev
pip install -e "C:\path\to\faststack-mcp"

# GitHub
pip install "git+https://github.com/Evaan-devlops/faststack-mcp.git"

# With extras
pip install -e ".[watch]"       # watchfiles — file watcher
pip install -e ".[postgres]"    # psycopg2-binary — PostgreSQL backend
pip install -e ".[all]"         # both

Environment variables

Variable Default Description
FASTSTACK_STORAGE sqlite Storage backend: sqlite, postgres, json
DATABASE_URL PostgreSQL DSN (required when FASTSTACK_STORAGE=postgres)

Development

python -m venv .venv
.venv\Scripts\python -m pip install -e .
python -m py_compile src/faststack_mcp/server.py  # syntax check
pytest tests/

Env parsing

  • .env.example indexed by default with masked values (***MASKED***)
  • .env and .env.* skipped unless include_env_files=True
  • Raw values never persisted

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选