Automatically builds and serves context files from codebases for AI assistants like Claude.
CTX is a tool made to solve a big problem when chatting with LLMs like ChatGPT or Claude: giving them enough context about your project.
There is an article about Context Generator on Medium that explains the motivation behind the project and the problem it solves.
When you're using AI in development, context isn't just helpful — it's everything. Instead of manually copying or explaining your entire codebase each time, ctx automatically builds neat, organized context files from:
It was created to solve a common problem: efficiently providing AI language models like Claude with necessary context about your codebase.
Getting started with CTX is straightforward. Follow these simple steps to create your first context file.
Download and install the tool using our installation script:
curl -sSL https://raw.githubusercontent.com/context-hub/generator/main/download-latest.sh | sh
This installs the ctx
command to your system (typically in /usr/local/bin
).
Want more options? See the complete Installation Guide for alternative installation methods.
Create a new configuration file in your project directory:
ctx init
This generates a context.yaml
file with a basic structure to get you started.
Check the Command Reference for all available commands and options.
Edit the generated context.yaml
file to specify what code or content you want to include.
For example:
$schema: 'https://raw.githubusercontent.com/context-hub/generator/refs/heads/main/json-schema.json'
documents:
- description: "User Authentication System"
outputPath: "auth-context.md"
sources:
- type: file
description: "Authentication Controllers"
sourcePaths:
- src/Auth
filePattern: "*.php"
- type: file
description: "Authentication Models"
sourcePaths:
- src/Models
filePattern: "*User*.php"
This configuration will gather all PHP files from the src/Auth
directory and any PHP files containing "User" in their
name from the src/Models
directory.
Generate your context file by running:
ctx
CTX will process your configuration and create the specified output file (auth-context.md
in our example).
Tip: Configure Logging with
-v
,-vv
, or-vvv
for detailed output
Upload or paste the generated context file to your favorite LLM (like ChatGPT or Claude). Now you can ask specific questions about your codebase, and the LLM will have the necessary context to provide accurate assistance.
Example prompt:
I've shared my authentication system code with you. Can you help me identify potential security vulnerabilities in the user registration process?
Next steps: Check out Development with Context Generator for best practices on integrating context generation into your AI-powered development workflow.
That's it! You're now ready to leverage LLMs with proper context about your codebase.
For a more seamless experience, you can connect Context Generator directly to Claude AI using the MCP server:
There is a built-in MCP server that allows you to connect Claude AI directly to your codebase.
Point the MCP client to the Context Generator server:
{
"mcpServers": {
"ctx": {
"command": "ctx server -c /path/to/your/project"
}
}
}
Note: Read more about MCP Server for detailed setup instructions.
Now you can ask Claude questions about your codebase without manually uploading context files!
For complete documentation, including all available features and configuration options, please visit:
This project is licensed under the MIT License.
Generate images using Baidu's iRAG API through a standardized MCP interface.
Interact with Homebrew (the package manager for macOS and Linux) using natural language commands.
A Model Context Protocol (MCP) server for CODESYS V3 programming environments.
Up-to-date documentation for your coding agent. Covers 1000s of public repos and sites. Built by ref.tools
Enable your code gen agents to create & run 0-config end-to-end tests against new code changes in remote browsers via the Debugg AI testing platform.
Server for advanced AI-driven video editing, semantic search, multilingual transcription, generative media, voice cloning, and content moderation.
APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.
Seamlessly bring real-time production context—logs, metrics, and traces—into your local environment to auto-fix code faster.
Search dashboards, investigate incidents and query datasources in your Grafana instance
Set up MCP servers in Claude Desktop