Code Context Manager

Provides semantic indexing and natural language search over codebases to support context-aware development.
  • python

0

GitHub Stars

python

Language

5 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "theraaz-code-context-manager-mcp": {
      "command": "python",
      "args": [
        "/full/path/to/code_context_mcp.py"
      ],
      "env": {
        "REDIS_URL": "redis://localhost:6379"
      }
    }
  }
}

Code Context Manager MCP Server provides semantic, code-aware indexing and natural language search across Python, JavaScript, and TypeScript projects. It enables you to discover relevant functions, classes, imports, and dependencies quickly, helping you understand large codebases and accelerate development.

How to use

You interact with this MCP server through an MCP client. Start the server and connect your client to index your codebase, then perform natural language searches to locate code entities and files. You can index either a single file or an entire directory, then query for context like specific functionality, patterns, or API usage. Use the results to navigate code, understand dependencies, and guide feature implementation.

How to install

Prerequisites are Python 3.9+ and a running Redis instance with RediSearch support. You also need an MCP client that can connect via the Stdio protocol to the Python server.

# 1) Create and activate a Python virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# 2) Install Python dependencies
pip install -r requirements.txt
pip install esprima sqlparse  # optional: for JS/TS and SQL support

# 3) Start Redis (with RediSearch enabled)
# Docker example
docker run -d --name redis-stack -p 6379:6379 redis/redis-stack:latest

# Or ensure local Redis has RediSearch loaded
redis-server --loadmodule /path/to/redisearch.so

# 4) Run the MCP server (example invocation)
# This assumes the server script is accessible at the specified path
python /full/path/to/code_context_mcp.py

Additional setup and configuration

Configure the MCP client to connect to the local server. The server expects the client to use stdio with Python as the command and the path to the server script as an argument, along with the Redis URL in the environment.

{
  "mcpServers": {
    "code-context-manager": {
      "command": "python",
      "args": ["/full/path/to/code_context_mcp.py"],
      "env": {
        "REDIS_URL": "redis://localhost:6379"
      }
    }
  }
}

Notes on indexing and usage

Indexing does not happen automatically. You must run explicit commands to index files or directories, then search. After making changes to your codebase, re-index the affected files to refresh the context available to searches.

Key behavior includes: semantic search with natural language queries, entity-level extraction (functions, classes, imports/exports), and incremental updates when you re-index. Store and manage metadata in SQLite and embeddings in Redis for fast retrieval.

Security, maintenance, and troubleshooting

Security: the server reads code for indexing but does not execute it. Ensure Redis is secured in production, and isolate the server from untrusted networks.

Maintenance: regularly re-index active areas of your codebase and monitor Redis memory usage. Use ignore patterns to limit indexing to relevant files and directories.

Troubleshooting tips: verify the MCP client can reach the server, confirm Redis connectivity, and ensure the indexing commands have completed before performing searches.

Example workflows

Initial setup and indexing: Configure the MCP client, index your project directory, then start searching for code patterns and related entities.

Development workflow: Search for a specific feature description (for example, how to implement user authentication) to surface relevant functions, classes, and files, then use those references to implement the feature.

Available tools

index_directory

Index all supported files in a directory tree for semantic search by analyzing code with language-specific parsers and generating embeddings.

index_file

Index a single file for semantic search, producing embeddings and metadata for quick retrieval.

search_code_context

Perform semantic search across indexed code using natural language queries and return ranked files and entities with similarity scores.

read_file

Read the complete content of a specified file to inspect source code directly.

list_directory_contents

List files and subdirectories within a given path, with optional recursion to explore nested structures.

get_file_dependencies

Retrieve import dependencies and metadata for an indexed file to understand its projections and relationships.

remove_indexed_file

Remove the indexing data for a specific file from both the vector store and metadata store.

clear_all_indexed_data

Clear all indexed data from the vector store and metadata store to reset the context.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational