Skip to main content
Glama

code-index-mcp

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault

No arguments

Schema

Prompts

Interactive templates invoked by user choice

NameDescription
analyze_codePrompt for analyzing code in the project.
code_searchPrompt for searching code in the project.
set_projectPrompt for setting the project path.

Resources

Contextual data attached and managed by the client

NameDescription
config://code-indexer
structure://project

Tools

Functions exposed to the LLM to take actions

NameDescription
set_project_path

Set the base project path for indexing.

search_code_advanced
Search for a code pattern in the project using an advanced, fast tool.

This tool automatically selects the best available command-line search tool
(like ugrep, ripgrep, ag, or grep) for maximum performance.

Args:
    pattern: The search pattern. Can be literal text or regex (see regex parameter).
    case_sensitive: Whether the search should be case-sensitive.
    context_lines: Number of lines to show before and after the match.
    file_pattern: A glob pattern to filter files to search in
                 (e.g., "*.py", "*.js", "test_*.py").
                 All search tools now handle glob patterns consistently:
                 - ugrep: Uses glob patterns (*.py, *.{js,ts})
                 - ripgrep: Uses glob patterns (*.py, *.{js,ts})
                 - ag (Silver Searcher): Automatically converts globs to regex patterns
                 - grep: Basic glob pattern matching
                 All common glob patterns like "*.py", "test_*.js", "src/*.ts" are supported.
    fuzzy: If True, enables fuzzy/partial matching behavior varies by search tool:
           - ugrep: Native fuzzy search with --fuzzy flag (true edit-distance fuzzy search)
           - ripgrep, ag, grep, basic: Word boundary pattern matching (not true fuzzy search)
           IMPORTANT: Only ugrep provides true fuzzy search. Other tools use word boundary
           matching which allows partial matches at word boundaries.
           For exact literal matches, set fuzzy=False (default and recommended).
    regex: Controls regex pattern matching behavior:
           - If True, enables regex pattern matching
           - If False, forces literal string search
           - If None (default), automatically detects regex patterns and enables regex for patterns like "ERROR|WARN"
           The pattern will always be validated for safety to prevent ReDoS attacks.

Returns:
    A dictionary containing the search results or an error message.
find_files
Find files matching a glob pattern using pre-built file index.

Use when:
- Looking for files by pattern (e.g., "*.py", "test_*.js")
- Searching by filename only (e.g., "README.md" finds all README files)
- Checking if specific files exist in the project
- Getting file lists for further analysis

Pattern matching:
- Supports both full path and filename-only matching
- Uses standard glob patterns (*, ?, [])
- Fast lookup using in-memory file index
- Uses forward slashes consistently across all platforms

Args:
    pattern: Glob pattern to match files (e.g., "*.py", "test_*.js", "README.md")

Returns:
    List of file paths matching the pattern
get_file_summary
Get a summary of a specific file, including:
- Line count
- Function/class definitions (for supported languages)
- Import statements
- Basic complexity metrics
refresh_index
Manually refresh the project index when files have been added/removed/moved.

Use when:
- File watcher is disabled or unavailable
- After large-scale operations (git checkout, merge, pull) that change many files
- When you want immediate index rebuild without waiting for file watcher debounce
- When find_files results seem incomplete or outdated
- For troubleshooting suspected index synchronization issues

Important notes for LLMs:
- Always available as backup when file watcher is not working
- Performs full project re-indexing for complete accuracy
- Use when you suspect the index is stale after file system changes
- **Call this after programmatic file modifications if file watcher seems unresponsive**
- Complements the automatic file watcher system

Returns:
    Success message with total file count
get_settings_info

Get information about the project settings.

create_temp_directory

Create the temporary directory used for storing index data.

check_temp_directory

Check the temporary directory used for storing index data.

clear_settings

Clear all settings and cached data.

refresh_search_tools
Manually re-detect the available command-line search tools on the system.
This is useful if you have installed a new tool (like ripgrep) after starting the server.
get_file_watcher_status

Get file watcher service status and statistics.

configure_file_watcher

Configure file watcher service settings.

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/johnhuang316/code-index-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server