Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Scantool - File Scanner MCPpreview_directory . depth=normal"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Scantool: Code Analysis MCP Server for Claude
MCP server for analyzing source code structure across 20+ languages. Works with Claude Code, Claude Desktop, and any Model Context Protocol client. Powered by tree-sitter. Extracts classes, functions, methods, imports, call graphs, and hot functions with precise line numbers.
Quick Start
Requires (provides the uvx command). Install it first if you don't have it — without it, scantool will silently fail to start:
Claude Code
That's it. Restart Claude Code and you're ready to go.
Claude Desktop
Add to config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Restart Claude Desktop after configuration.
Troubleshooting: uvx not found
uvx comes with uv, the Python package manager. Install it first:
After installing uv, restart your terminal (or open a new one) so uvx is on your PATH. Then re-run the setup command above.
If uvx still isn't found after restarting the terminal, add it to your PATH manually:
Alternative: Install from source
Share with your team (.mcp.json)
Add a .mcp.json file to your project root to share the config with your team:
Claude Code will prompt team members for approval on first use.
Features
Multi-language Support
Python, JavaScript, TypeScript, Rust, Go, C/C++, Java, PHP, C#, Ruby, Zig, Swift, SQL (PostgreSQL, MySQL, SQLite), HTML, CSS, SCSS, Markdown, Plain Text, Images
Structure Extraction
Classes, methods, functions, imports
Function signatures with type annotations
Decorators and attributes
Docstrings and JSDoc comments
Precise line numbers (from-to ranges)
Analysis Tools
preview_directory: Intelligent codebase analysis with entry points, import graph, call graph, and hot functions (5-10s)
scan_file: Detailed file structure with signatures and metadata
scan_directory: Compact directory tree with inline function/class names
search_structures: Filter by type, name pattern, decorator, or complexity
list_directories: Directory tree (folders only)
Output Formats
Tree format with box-drawing characters
JSON format for programmatic use
Configurable display options
Usage
preview_directory - Code analysis (primary tool)
Analyzes codebase structure including entry points, import graph, call graph, and hot functions.
Depth levels:
"quick": Metadata only (0.5s) - file counts, sizes, types"normal": Architecture analysis (2-5s) - imports, entry points, clusters"deep": Full analysis (5-10s) - includes hot functions and call graph (default)
Example output (depth="deep"):
Use cases:
First-time codebase exploration
Understanding multi-modality projects (frontend/backend/database)
Finding critical functions (hot spots)
Identifying entry points
scan_file - Detailed file analysis
Example output:
scan_file_content - Analyze content directly
Scan content without requiring a file path. Works with remote files, APIs, or in-memory content.
scan_directory - Compact overview
Shows directory tree with inline class/function names.
Example output:
Pattern examples:
search_structures - Find and filter
list_directories - Folder structure
Shows directory tree without files.
Example output:
Supported Languages
Extension | Language | Extracted Elements |
| Python | classes, methods, functions, imports, decorators, docstrings |
| JavaScript | classes, methods, functions, imports, JSDoc comments |
| TypeScript | classes, methods, functions, imports, type annotations, JSDoc |
| Rust | structs, enums, traits, impl blocks, functions, use statements |
| Go | types, structs, interfaces, functions, methods, imports |
| C | functions, structs, enums, includes |
| C++ | classes, functions, namespaces, templates, includes |
| Java | classes, methods, interfaces, enums, annotations, imports |
| PHP | classes, methods, functions, traits, interfaces, namespaces |
| C# | classes, methods, properties, structs, enums, namespaces |
| Ruby | modules, classes, methods, singleton methods |
| Zig | functions, structs, enums, unions, tests |
| Swift | classes, structs, enums, protocols, functions, extensions |
| SQL | tables, views, functions, procedures, indexes, columns |
| HTML | document structure, elements, attributes |
| CSS | selectors, properties, media queries |
| SCSS | selectors, mixins, variables, nesting |
| Markdown | headings (h1-h6), code blocks with hierarchy |
| Plain Text | sections, paragraphs |
| Images | format, dimensions, colors, content type |
All files include metadata (size, modified date, permissions) automatically.
Use Cases
Code Navigation
Structural overview of unfamiliar codebases
File organization understanding
Navigation using precise line ranges
Refactoring
Identify class and function boundaries for safe splitting
Find implementations of specific patterns
Locate functions above complexity thresholds
Code Review
Generate structural diffs
Find functions with specific decorators
Identify test coverage gaps
Documentation
Auto-generate table of contents with line numbers
Extract API signatures
Feed structured data to analysis tools (JSON output)
AI Code Assistance
Primary exploration tool (replaces ls/grep/find workflows)
Partition large files intelligently for LLM context windows
Extract code sections with exact boundaries
Search patterns across codebases
Reduce token usage: get structure first, read content only when needed
Architecture
HTTP Transport (advanced)
For environments where stdio doesn't work, or when sharing a server across multiple clients:
Note: The HTTP server must be started separately and kept running. For most users, the stdio transport (default) is simpler and recommended.
Testing
Contributing
See CONTRIBUTING.md for details on adding language support.
License
MIT License - see LICENSE file for details.
Dependencies
FastMCP - MCP server framework
tree-sitter - Parsing library
uv - Python package installer
Known Limitations
MCP Tool Response Size Limit
Claude Desktop enforces a 25,000 token limit on MCP tool responses. Claude Code has a configurable limit (set MAX_MCP_OUTPUT_TOKENS env var to adjust).
Built-in mitigations:
scan_directory()uses compact inline formatRespects
.gitignoreby default (excludes node_modules, .venv, etc.)Shows file metadata with relative timestamps
Manual controls:
Use
patternto limit scope:"**/*.py"vs"*/*"(shallow)Use
max_filesto cap number of files processedUse
exclude_patternsfor additional exclusionsScan specific subdirectories instead of entire codebase
For large codebases:
Agent Delegation
When using Claude Code, asking to "explore the codebase" may delegate to the Explore agent which doesn't have access to MCP tools. Be explicit: "use scantool to scan the codebase" to ensure the MCP tool is used directly.