Scopewalker Mcp

io.github.timohaa由 GitHub 账号 timohaa 发布v1.4.2更新于 Nov 3, 2026

Codebase analysis tools for AI agents: complexity, prop drilling, doc coverage, code smells.

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

本地只读 MCP 服务器,用于分析代码库的规模、复杂度、文档覆盖率、代码异味、prop drilling 与死代码。

可以做什么
  • 统计文件与函数:行数、函数/方法识别、规模阈值检查
  • 评估复杂度:嵌套深度、参数数量、认知与圈复杂度、热点标记
  • 盘点代码结构:类、方法、接口、枚举、常量与导出
  • 检查文档覆盖率并列出缺少文档的函数、类和方法
  • 发现代码异味,如 TODO/FIXME/HACK 标记与 TypeScript 双重类型断言
  • 检测 prop drilling 以及未被引用的符号或导出
适用场景
适合在助手编写或审查代码时,对文件与函数规模、复杂度、文档和遗留标记做客观检查,例如提交前核对。也适合通过技能、子代理或规则文件推行更严格代码规范的团队。
运行要求
通过 npx 或全局 npm 安装后在本地以 stdio 运行;需要 Node.js 22+ 以及单独安装的 tokei 可执行文件。无需 API 密钥或账号。分析范围限于允许的根目录,由 SCOPEWALKER_ALLOWED_ROOTS 或客户端共享的工作区根目录决定。
安装前请注意
所有工具均为只读,服务器不发起网络请求,数据不会离开本机。代码异味中的注释文本默认被隐去,除非设置 include_text;扫描不超出允许的根目录,不跟随符号链接,AST 工具会跳过超过 1 MB 的文件。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Scopewalker Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Scopewalker MCP

[Buy Me A Coffee]

AI agents will happily create 1000+ line source files and add a 20th parameter to a function call, even if there's a rule file telling them not to. Scopewalker exists to enforce stricter codebase standards.

It's a local MCP server (open source, runs over stdio, makes no network calls) that exposes 9 read-only tools:

  • get_line_counts - per-file line counts (total, code, blank, comment) with sorting, extension filters, and project-wide totals
  • get_functions - function and method detection; per-file counts, or per-function line metrics via detail=lines with a min_lines filter for hunting oversized functions
  • get_complexity_metrics - max/average nesting depth and parameter counts (JSX props included), import counts, a per-file cognitive-complexity score, and per-function cyclomatic complexity with high/extreme severity bands, plus hotspots flagged for deeply nested or over-parameterized functions
  • check_thresholds - flags files and functions exceeding size thresholds (defaults: 300 lines per file, 100 per function)
  • get_code_inventory - classes with their methods, functions, interfaces/types, enums, and constants, each marked exported or not; private symbols hidden by default
  • get_documentation_coverage - coverage percentage plus every function, class, or method missing a doc comment (JSDoc, Python docstrings, Rust ///, and other per-language formats)
  • get_code_smells - TODO/FIXME/HACK/XXX/BUG/UNUSED/DEPRECATED markers found by scanning actual comments via the AST (no false positives from string literals), plus as unknown as / as any as double casts in TypeScript
  • get_prop_drilling - parameter names threaded through many functions and files, with forwarding evidence and a high/medium/low risk rating
  • find_dead_code - unreferenced top-level symbols and private methods, split into certain dead_code and human-judgment unreferenced_exports

It's tree-sitter (parsing) + tokei (line counting) + fast-glob (file discovery) under the hood; nothing is custom-parsed. Tested on macOS with Claude Code, but should work with Cursor, VS Code, Windsurf, Antigravity CLI, Codex, or anything else that speaks MCP.

See TOOLS.md for the quick reference, docs/ for per-tool parameters and example responses, and docs/usage-examples.md for a guide to wiring Scopewalker into skills, subagents, and AGENTS.md.

Safety Defaults

  • No network access: All analysis runs locally over stdio: no data leaves your machine, no API keys or external services involved.
  • Path scoping: All tools only operate inside allowed roots. SCOPEWALKER_ALLOWED_ROOTS=/abs/path1,/abs/path2 takes precedence when set. Otherwise the server uses the workspace roots your MCP client shares, and falls back to the current working directory and system temp when the client shares none.
  • Large file guard: AST-based tools skip files larger than 1 MB to avoid excessive memory/CPU use. Tokei-based line counts do not enforce this limit.
  • Input ceilings: max_files caps at 10000, max_depth at 64, limit at 5000.
  • Symlinks: Directory scans do not follow symbolic links.
  • Output limits: Tools default to returning 20 files/items unless limit is set.
  • Comment redaction: get_code_smells redacts comment text by default; pass include_text: true to return snippets explicitly.

Requirements

  • Node.js 22+
  • tokei - Install via brew install tokei or cargo install tokei

Installation

Scopewalker is published to npm as scopewalker-mcp; no clone or build needed. Configure your MCP client to run it via npx (examples below), or install it globally with npm install -g scopewalker-mcp.

To build from source instead, see Development.

Configuration

Claude Code

bash
claude mcp add --scope user scopewalker-mcp -- npx -y scopewalker-mcp

Or add to ~/.claude.json:

json
{  "mcpServers": {    "scopewalker-mcp": {      "command": "npx",      "args": ["-y", "scopewalker-mcp"]    }  }}

See Claude Code MCP documentation for details.

Claude Desktop

Download scopewalker-mcp.mcpb from the latest release and open it with Claude Desktop (or drag it into Settings > Extensions) for one-click installation.

Cursor

Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):

json
{  "mcpServers": {    "scopewalker-mcp": {      "command": "npx",      "args": ["-y", "scopewalker-mcp"]    }  }}

Or configure via File > Preferences > Cursor Settings > MCP.

See Cursor MCP documentation for details.

VS Code (GitHub Copilot)

Add to .vscode/mcp.json in your workspace:

json
{  "servers": {    "scopewalker-mcp": {      "command": "npx",      "args": ["-y", "scopewalker-mcp"]    }  }}

Requires VS Code 1.102+ with Agent Mode enabled.

See VS Code MCP documentation for details.

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "scopewalker-mcp": {      "command": "npx",      "args": ["-y", "scopewalker-mcp"]    }  }}

Or configure via Windsurf Settings > Cascade > Manage MCPs.

See Windsurf MCP documentation for details.

Antigravity CLI

Add to ~/.gemini/config/mcp_config.json (global) or .agents/mcp_config.json (per project):

json
{  "mcpServers": {    "scopewalker-mcp": {      "command": "npx",      "args": ["-y", "scopewalker-mcp"]    }  }}

Use /mcp inside the prompt panel to check server status and reload the config.

See Antigravity CLI MCP documentation for details.

For Gemini CLI, add the same mcpServers configuration to ~/.gemini/settings.json. See Gemini CLI MCP documentation.

OpenAI Codex CLI

Add to ~/.codex/config.toml:

toml
[mcp_servers.scopewalker-mcp]command = "npx"args = ["-y", "scopewalker-mcp"]

Or use the CLI:

bash
codex mcp add scopewalker-mcp -- npx -y scopewalker-mcp

See Codex MCP documentation for details.

Usage

Once configured, the assistant calls Scopewalker's tools on its own; no special syntax needed. Ask things like:

  • "Check this repo against our size thresholds before I commit"
  • "Which functions in src/ have the highest cognitive complexity?"
  • "Find undocumented exports in src/auth"
  • "Are there any TODO/FIXME/HACK markers left in this module?"
  • "Show me functions that take more than 5 parameters"

It picks the right tool and parameters for the request.

This repo enforces shared quality requirements through its skills and agents:

Development

To run from source instead of npm:

bash
git clone https://github.com/timohaa/scopewalker-mcp.gitcd scopewalker-mcpnpm installnpm run build

Then point your MCP client at the build output, e.g. claude mcp add --scope user scopewalker-mcp -- node /path/to/scopewalker-mcp/dist/index.js.

bash
npm run build          # Build the projectnpm run check          # Version sync + lint + typechecknpm run test           # Run testsnpm run test:coverage  # Run tests with coverage

See CONTRIBUTING.md for contribution guidelines and docs/patterns.md for tool registration, error handling, and testing patterns.

Supported Languages

The AST-based tools (everything except get_line_counts) parse:

  • TypeScript/JavaScript (.ts, .tsx, .js, .jsx, .mjs, .cjs)
  • Python (.py)
  • Go (.go)
  • Rust (.rs)
  • Java (.java)
  • C/C++ (.c, .h, .cpp, .cc, .cxx, .hpp)
  • Ruby (.rb)

get_line_counts runs through tokei, so it reports on every language tokei recognizes. See docs/tools-overview.md for what is detected per language.

License

MIT

来源:README.md,提交 9835ffe

工具

9

get_line_counts

Line Counts

Returns file line counts (code/blank/comment). Use extensions to filter.

输入参数greppath必填limitsort_byextensionsinclude_hiddenignore_patterns

get_functions

Functions

Returns function/method info. Use detail=lines for line counts per function.

输入参数greppath必填limitdetailsort_bymax_depthmax_filesmin_linesextensionsinclude_hiddenignore_patterns

check_thresholds

Size Thresholds

Finds files/functions exceeding size thresholds. Use limit to control output.

输入参数path必填limitmax_depthmax_filesextensionsinclude_hiddenmax_file_linesignore_patternsmax_function_lines

get_code_inventory

Code Inventory

Lists classes, functions, methods, and exports. Use extensions to filter.

输入参数greppath必填limitmax_depthmax_filesextensionsinclude_hiddenignore_patternsinclude_private

get_code_smells

Code Smells

Finds TODO/FIXME/HACK/BUG markers and unsafe casts in code.

输入参数path必填limittypesmax_depthmax_filesextensionsinclude_textinclude_hiddenignore_patterns

get_complexity_metrics

Complexity Metrics

Returns complexity metrics (nesting, params, cognitive, per-function cyclomatic). Use limit/summary_only to control output.

输入参数path必填limitmax_depthmax_filesextensionssummary_onlyinclude_hiddenignore_patterns

get_documentation_coverage

Documentation Coverage

Finds undocumented functions/classes. Use limit/summary_only to control output.

输入参数path必填limitmax_depthmax_filesmin_linesextensionssummary_onlyinclude_hiddenignore_patterns

get_prop_drilling

Prop Drilling

Detects parameter threading (prop drilling) by finding parameter names passed through chains of functions. Use limit/summary_only to control output.

输入参数path必填limitmax_depthmax_filesextensionssummary_onlyexclude_commoninclude_hiddenignore_patternsmin_occurrences

find_dead_code

Dead Code

Finds declared symbols that nothing references. dead_code is proven unreachable within the scan; unreferenced_exports may be used outside it.

输入参数path必填limitmax_depthmax_filesextensionsinclude_hiddenignore_patterns

版本历史

6
  1. v1.4.2最新Oct 29, 2026
  2. v1.4.1Oct 23, 2026
  3. v1.4.0Oct 9, 2026
  4. v1.3.3Oct 8, 2026
  5. v1.3.2Sep 25, 2026
  6. v1.3.1Sep 16, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分