Ctags
A first run of optimizing python work w/ Claude
Installation
npx mcp-ctagsAsk AI about Ctags
Powered by Claude Β· Grounded in docs
I know everything about Ctags. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
MCP Ctags Server
A Model Context Protocol (MCP) server that transforms ctags from a command-line utility into a native code navigation system for Claude Code. Built with a functional programming approach and comprehensive type safety.
Quick Start
# Install the package
pip install ctags-mcp
# Generate tags for your project
ctags -R .
# Add to Claude Desktop config
{
"mcpServers": {
"ctags": {
"command": "ctags-mcp"
}
}
}
# Optional: Auto-regenerate tags when code changes
# Copy .claude/settings.json to your project root
π Full Installation Guide | π Auto-Regeneration Setup
β¨ Features
- π 20x Performance: Index-based symbol lookup vs reading entire files
- π Smart Search: Regex patterns, type filtering, scope-aware queries
- π Universal Support: Works with any ctags-supported language
- π― Precise Context: Get source code around symbols with configurable line counts
- π§ Auto-Detection: Finds tags files in current and parent directories
- β‘ Zero Configuration: Works out of the box with standard ctags files
π― What It Does
Transform code exploration from this:
# Traditional approach - slow, imprecise
find . -name "*.py" | xargs grep "async def"
grep -r "class.*Service" src/
To this:
# Natural language with Claude
"Find all async functions in this project"
"Show me service classes with their locations"
"Get the AsyncBatchProcessor definition with context"
π Performance Comparison
| Task | Traditional | MCP Ctags | Improvement |
|---|---|---|---|
| Find symbols | ~530ms | ~7ms | 79x faster |
| Files read | 53+ files | 0 files | βx better |
| Query accuracy | Manual parsing | Structured data | More reliable |
| Scalability | Linear O(n) | Constant O(1) | Scales infinitely |
π οΈ MCP Tools Available
ctags_detect
Auto-detects and validates ctags file in working directory.
ctags_find_symbol
Finds symbols by name or regex pattern with comprehensive filtering.
ctags_list_symbols
Lists all symbols of a specific type (functions, classes, methods, variables).
ctags_get_location
Gets source code context around a specific symbol.
ctags_search_in_files
Searches across multiple file patterns simultaneously.
π― Usage Examples
Once configured with Claude Desktop:
- "Find all async functions" β Instantly locates async functions across the codebase
- "Show me the AsyncBatchProcessor class" β Gets class definition with source context
- "List service classes in this project" β Finds all classes with "Service" in the name
- "Find authentication-related symbols" β Pattern-matches auth symbols across all types
π Project Structure
ctags-mcp/
βββ src/ctags_mcp/ # Main package
β βββ ctags_parser.py # Functional ctags file parsing
β βββ symbol_search.py # Search and filtering functions
β βββ ctags_server.py # FastMCP server with tool definitions
β βββ main.py # CLI entry point
βββ src/tests/ # Comprehensive test suite
βββ pyproject.toml # Package configuration
βββ LICENSE # MIT License
βββ README.md # This file
βββ INSTALL.md # Installation guide
π§ͺ Testing
The implementation includes comprehensive testing:
# Run all tests
pytest
# With coverage
pytest --cov=src/ctags_mcp
# Results: 31 tests passing, covering all functionality
ποΈ Architecture
Built with functional programming principles:
- Pure functions for parsing and searching
- Pydantic models for type safety
- Zero classes except for data models
- Comprehensive error handling for malformed files
- Performance optimized for large codebases
π§ Development
# Clone and setup
git clone <repository-url>
cd ctags-mcp
pip install -e ".[dev]"
# Code quality
black src/ # Format code
ruff check src/ # Lint code
mypy src/ # Type check
pytest # Run tests
π Performance Insights
Real-world testing with 1,050 symbols:
π Tags File Information:
Format: exuberant
Total entries: 1050
Functions: 304, Classes: 89, Methods: 512, Variables: 145
π Search Examples:
β’ Async functions: 4 found in ~7ms
β’ Service classes: 15 found in ~7ms
β’ Auth symbols: 23 found in ~7ms
β’ CLI symbols: 129 found in ~7ms
π Efficiency: 79x faster than traditional file scanning
π€ Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Make changes with tests:
pytest - Submit a pull request
π License
MIT License - see LICENSE for details.
π Acknowledgments
- Built with FastMCP from Anthropic
- Uses Universal Ctags for symbol indexing
- Inspired by the need for efficient code navigation in Claude Code
Transform your code navigation today! Install ctags-mcp and experience the power of index-based code exploration with Claude.
