CTX: A tool for generating structured documentation from files, repositories, diffs, and URLs through a modular architecture with powerful configuration options for AI-assisted development workflows. The missing link between your codebase and your LLM. Context as Code (CaC) tool with MCP server inside.

What is context hub generator

ctx: The missing link between your codebase and your LLM. Context as Code (CaC) tool with MCP server inside.

Good morning, LLM

Table of Contents

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:

  • Code files,
  • GitHub and Gitlab repositories,
  • Git commits and diffs
  • Web pages (URLs) with CSS selectors,
  • MCP servers
  • and plain text.

It was created to solve a common problem: efficiently providing AI language models like Claude with necessary context about your codebase.

How it works

  1. Gathers code from files, directories, GitHub or Gitlab repositories, web pages, or plain text.
  2. Targets specific files through pattern matching, content search, size, or date filters
  3. Applies optional modifiers (like extracting PHP signatures without implementation details)
  4. Organizes content into well-structured markdown documents
  5. Saves context files ready to be shared with LLMs
  6. Optionally serves context through an MCP server, allowing AI assistants like Claude to directly access project information

Quick Start

Getting started with CTX is straightforward. Follow these simple steps to create your first context file.

1. Install CTX

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.

2. Initialize a Configuration File

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.

3. Describe Your Project Structure

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.

Need more advanced configuration?

4. Build the Context

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

5. Share with an LLM

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.

6. Connect to Claude AI (Optional)

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!

Full Documentation

For complete documentation, including all available features and configuration options, please visit:

https://docs.ctxgithub.com


License

This project is licensed under the MIT License.

Leave a Comment

Frequently Asked Questions

What is MCP?

MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.

What are MCP Servers?

MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.

How do MCP Servers work?

MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.

Are MCP Servers secure?

Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.

Related MCP Servers

chrisdoc hevy mcp avatar

chrisdoc hevy mcp

mcp
sylphlab pdf reader mcp avatar

sylphlab pdf reader mcp

An MCP server built with Node.js/TypeScript that allows AI agents to securely read PDF files (local or URL) and extract text, metadata, or page counts. Uses pdf-parse.

pdf-parsetypescriptnodejs
aashari mcp server atlassian bitbucket avatar

aashari mcp server atlassian bitbucket

Node.js/TypeScript MCP server for Atlassian Bitbucket. Enables AI systems (LLMs) to interact with workspaces, repositories, and pull requests via tools (list, get, comment, search). Connects AI directly to version control workflows through the standard MCP interface.

atlassianrepositorymcp
aashari mcp server atlassian confluence avatar

aashari mcp server atlassian confluence

Node.js/TypeScript MCP server for Atlassian Confluence. Provides tools enabling AI systems (LLMs) to list/get spaces & pages (content formatted as Markdown) and search via CQL. Connects AI seamlessly to Confluence knowledge bases using the standard MCP interface.

atlassianmcpconfluence
prisma prisma avatar

prisma prisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

cockroachdbgomcp
Zzzccs123 mcp sentry avatar

Zzzccs123 mcp sentry

mcp sentry for typescript sdk

mcptypescript
zhuzhoulin dify mcp server avatar

zhuzhoulin dify mcp server

mcp
zhongmingyuan mcp my mac avatar

zhongmingyuan mcp my mac

mcp
zhixiaoqiang desktop image manager mcp avatar

zhixiaoqiang desktop image manager mcp

MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)

mcp
zhixiaoqiang antd components mcp avatar

zhixiaoqiang antd components mcp

An MCP service for Ant Design components query | 一个减少 Ant Design 组件代码生成幻觉的 MCP 服务,包含系统提示词、组件文档、API 文档、代码示例和更新日志查询

designantdapi

Submit Your MCP Server

Share your MCP server with the community

Submit Now