get_line_counts
Line Counts
Returns file line counts (code/blank/comment). Use extensions to filter.
greppath必填limitsort_byextensionsinclude_hiddenignore_patterns
io.github.timohaa由 GitHub 帳號 timohaa 發布v1.4.2更新於 Nov 3, 2026
Codebase analysis tools for AI agents: complexity, prop drilling, doc coverage, code smells.
本機唯讀 MCP 伺服器,用來分析程式碼庫的規模、複雜度、文件覆蓋率、程式碼異味、prop drilling 與死碼。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
參照 儲存庫 中的啟動說明。
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 totalsget_functions - function and method detection; per-file counts, or per-function line metrics via detail=lines with a min_lines filter for hunting oversized functionsget_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 functionscheck_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 defaultget_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 TypeScriptget_prop_drilling - parameter names threaded through many functions and files, with forwarding evidence and a high/medium/low risk ratingfind_dead_code - unreferenced top-level symbols and private methods, split into certain dead_code and human-judgment unreferenced_exportsIt'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.
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.max_files caps at 10000, max_depth at 64, limit at 5000.limit is set.get_code_smells redacts comment text by default; pass include_text: true to return snippets explicitly.brew install tokei or cargo install tokeiScopewalker 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.
Or add to ~/.claude.json:
See Claude Code MCP documentation for details.
Download scopewalker-mcp.mcpb from the latest release and open it with Claude Desktop (or drag it into Settings > Extensions) for one-click installation.
Add to ~/.cursor/mcp.json (global) or .cursor/mcp.json (project):
Or configure via File > Preferences > Cursor Settings > MCP.
See Cursor MCP documentation for details.
Add to .vscode/mcp.json in your workspace:
Requires VS Code 1.102+ with Agent Mode enabled.
See VS Code MCP documentation for details.
Add to ~/.codeium/windsurf/mcp_config.json:
Or configure via Windsurf Settings > Cascade > Manage MCPs.
See Windsurf MCP documentation for details.
Add to ~/.gemini/config/mcp_config.json (global) or
.agents/mcp_config.json (per project):
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.
Add to ~/.codex/config.toml:
Or use the CLI:
See Codex MCP documentation for details.
Once configured, the assistant calls Scopewalker's tools on its own; no special syntax needed. Ask things like:
src/ have the highest cognitive complexity?"src/auth"It picks the right tool and parameters for the request.
This repo enforces shared quality requirements through its skills and agents:
.claude/skills/review-changes/SKILL.md: fails reviews on unresolved size, complexity, smell, prop-drilling, or dead-code findings.claude/agents/standards-enforcer.md: fixes actionable findings and verifies them with rescans and tests.claude/skills/polish/SKILL.md: carries unresolved findings through the pipeline and verifies the final state.claude/agents/docs-reality-sync.md: uses get_code_inventory and get_functions to keep docs in sync with codeTo run from source instead of npm:
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.
See CONTRIBUTING.md for contribution guidelines and docs/patterns.md for tool registration, error handling, and testing patterns.
The AST-based tools (everything except get_line_counts) parse:
.ts, .tsx, .js, .jsx, .mjs, .cjs).py).go).rs).java).c, .h, .cpp, .cc, .cxx, .hpp).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.
MIT
來源:README.md,提交 9835ffe
Line Counts
Returns file line counts (code/blank/comment). Use extensions to filter.
greppath必填limitsort_byextensionsinclude_hiddenignore_patternsFunctions
Returns function/method info. Use detail=lines for line counts per function.
greppath必填limitdetailsort_bymax_depthmax_filesmin_linesextensionsinclude_hiddenignore_patternsSize Thresholds
Finds files/functions exceeding size thresholds. Use limit to control output.
path必填limitmax_depthmax_filesextensionsinclude_hiddenmax_file_linesignore_patternsmax_function_linesCode Inventory
Lists classes, functions, methods, and exports. Use extensions to filter.
greppath必填limitmax_depthmax_filesextensionsinclude_hiddenignore_patternsinclude_privateCode Smells
Finds TODO/FIXME/HACK/BUG markers and unsafe casts in code.
path必填limittypesmax_depthmax_filesextensionsinclude_textinclude_hiddenignore_patternsComplexity Metrics
Returns complexity metrics (nesting, params, cognitive, per-function cyclomatic). Use limit/summary_only to control output.
path必填limitmax_depthmax_filesextensionssummary_onlyinclude_hiddenignore_patternsDocumentation Coverage
Finds undocumented functions/classes. Use limit/summary_only to control output.
path必填limitmax_depthmax_filesmin_linesextensionssummary_onlyinclude_hiddenignore_patternsProp 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_occurrencesDead 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已滿足適用檢查項的 90%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
claude mcp add --scope user scopewalker-mcp -- npx -y scopewalker-mcp{ "mcpServers": { "scopewalker-mcp": { "command": "npx", "args": ["-y", "scopewalker-mcp"] } }}{ "mcpServers": { "scopewalker-mcp": { "command": "npx", "args": ["-y", "scopewalker-mcp"] } }}{ "servers": { "scopewalker-mcp": { "command": "npx", "args": ["-y", "scopewalker-mcp"] } }}{ "mcpServers": { "scopewalker-mcp": { "command": "npx", "args": ["-y", "scopewalker-mcp"] } }}{ "mcpServers": { "scopewalker-mcp": { "command": "npx", "args": ["-y", "scopewalker-mcp"] } }}[mcp_servers.scopewalker-mcp]command = "npx"args = ["-y", "scopewalker-mcp"]codex mcp add scopewalker-mcp -- npx -y scopewalker-mcpgit clone https://github.com/timohaa/scopewalker-mcp.gitcd scopewalker-mcpnpm installnpm run buildnpm run build # Build the projectnpm run check # Version sync + lint + typechecknpm run test # Run testsnpm run test:coverage # Run tests with coverage