Command Reference
Generate Context Files
Generates context files according to your configuration. This is the default command that runs when no command is specified.
ctxYou can also explicitly call:
ctx generate
# or
ctx build
# or
ctx compileOptions
| Option | Description |
|---|---|
--inline, -i | Inline JSON configuration string. If provided, file-based configuration will be ignored. |
--config-file, -c | Path to a specific configuration file or directory. If not provided, will look for standard config files in the root path. |
--env, -e | Path to .env (like .env.local) file. If not provided, will ignore any .env files. |
Examples of using the --env option:
# Load variables from a specific file
ctx --env=.env.local
# Do not load any environment variables (default behavior)
ctxExamples of specifying configuration:
# Use a specific configuration file
ctx -c src/custom-config.yaml
# Look for standard config files (context.json, context.yaml, etc.) in a specific directory
ctx -c src/configs
# Use inline JSON configuration
ctx -i '{"documents":[{"description":"Quick Context","outputPath":"output.md","sources":[{"type":"text","content":"Sample content"}]}]}'Display Configuration
Displays the context configuration in a human-readable format.
ctx displayOptions
| Option | Description |
|---|---|
--inline, -i | Inline JSON configuration string. If provided, file-based configuration will be ignored. |
--config-file, -c | Path to a specific configuration file or directory. If not provided, will look for standard config files in the root path. |
Initialize a Configuration File
Creates a new configuration file in the current directory. The default filename is context.yaml if not specified.
ctx initYou can also specify a different filename:
ctx init --config-file=context.json
# or
ctx init -c context.jsonNote: Only
jsonandyamlformats are supported for the configuration file.
Generate MCP Configuration
Generates MCP configuration snippets for connecting CTX to Claude Desktop or other MCP clients. This command automatically detects your operating system and generates the appropriate configuration format.
ctx mcp:configOptions
| Option | Description |
|---|---|
--explain | Show detailed setup instructions |
--interactive, -i | Interactive mode with guided questions |
--client, -c | MCP client type (claude, generic). Default: claude |
--global, -g | Use global project registry (no -c option) |
Examples
Auto-detect and generate global registry configuration:
ctx mcp:configInteractive mode with guided questions:
ctx mcp:config --interactive
# or
ctx mcp:config -iGlobal registry mode (default):
ctx mcp:config --global
# or
ctx mcp:config -gGenerate for different MCP clients:
ctx mcp:config --client=generic
# or
ctx mcp:config -c genericSample Output
Global Registry Mode:
{
"mcpServers": {
"ctx": {
"command": "ctx",
"args": [
"server"
]
}
}
}Project-Specific Mode:
{
"mcpServers": {
"ctx": {
"command": "ctx",
"args": [
"server",
"-c",
"/path/to/project"
]
}
}
}WSL Configuration:
{
"mcpServers": {
"ctx": {
"command": "bash.exe",
"args": [
"-c",
"ctx server -c /path/to/project"
]
}
}
}MCP Server
Starts the Model Control Protocol (MCP) server to enable direct integration with Claude AI. This server acts as a bridge between your codebase and AI assistants, allowing Claude to access project context in real-time.
Note: To enable Claude to access your project context through the MCP server read the MCP documentation.
ctx serverOptions
| Option | Description |
|---|---|
--config-file, -c | Path to configuration file (absolute or relative to current directory). |
--env, -e | Path to .env (like .env.local) file. If not provided, will ignore any .env files. |
Examples
Starting the server with default settings:
ctx serverUsing a specific configuration file:
ctx server --config-file=path/to/custom-context.yaml
# or
ctx server -c path/to/custom-context.yamlLoading environment variables from a specific file:
ctx server --env=.env.development
# or
ctx server -e .env.developmentCombining configuration and environment options:
ctx server -c path/to/project/context.yaml -e .env.localPointing to a project directory (will use default config file in that directory):
ctx server -c /path/to/project/Log Verbosity
The MCP server logs its activities to a mcp.log file in the project root directory. The log level is determined by the verbosity level of the command:
- Default: Warning level logs
--verboseor-v: Info level logs--very-verboseor-vv: Debug level logs--quietor-q: Error level logs only
# Get more detailed logs
ctx server -c /path/to/project -vvGet JSON Schema
Shows the URL where the JSON schema for IDE integration is hosted.
ctx schema
# or
ctx json-schemaOptions
| Option | Description |
|---|---|
--download, -d | Download the schema to the current directory |
--output, -o | The file path where the schema should be saved |
ctx schema --download
# or
ctx schema -dDownloads the JSON schema to the current directory with the default filename (json-schema.json).
ctx schema --download --output=custom-name.json
# or
ctx schema -d -o custom-name.jsonSelf-Update
Updates the CTX to the latest version.
ctx self-update
# or
ctx updateOptions
| Option | Description |
|---|---|
--path, -p | Path where to store the binary |
--name, -b | Name of the binary file. Default is [ctx] |
--type, -t | Binary type (phar or bin) |
--repository | GitHub repository to update from |
If you installed ctx in a non-standard location, you can specify the path:
ctx self-update --path=/usr/local/bin/ctx
# or
ctx self-update -p /usr/local/bin/ctxCheck Version
Displays the current version of CTX.
ctx versionOptions
| Option | Description |
|---|---|
--check-updates, -c | Check for updates |
To check for available updates:
ctx version --check-updates
# or
ctx version -cInline Configuration
You can provide a JSON configuration directly on the command line without needing a config file:
ctx --inline='{"documents":[{"description":"Quick Context","outputPath":"output.md","sources":[{"type":"text","content":"Sample content"}]}]}'
# or
ctx -i '{"documents":[{"description":"Quick Context","outputPath":"output.md","sources":[{"type":"text","content":"Sample content"}]}]}'This is useful for:
- One-off context generation without creating config files
- CI/CD pipelines or automated workflows
- Testing configurations quickly
- Scripting and integration with other tools
The JSON configuration structure follows the same schema as config files. For complex configurations, consider using a heredoc in your shell scripts:
ctx --inline='
{
"documents": [
{
"description": "API Documentation",
"outputPath": "api-docs.md",
"sources": [
{
"type": "file",
"sourcePaths": ["src/Api"],
"filePattern": "*.php"
}
]
}
]
}
'List Available Prompts
Lists all available prompts with their IDs, types, descriptions, tags, and arguments.
ctx prompts:list
# or
ctx promptsOptions
| Option | Description |
|---|---|
--config-file, -c | Path to configuration file (absolute or relative to current directory). |
--tag, -t | Filter prompts by tag (can be used multiple times). |
--exclude-tag, -x | Exclude prompts with specific tag (can be used multiple times). |
--id, -p | Filter prompts by ID (can be used multiple times). |
--detailed, -d | Show detailed information including arguments. |
Examples
List all prompts in table format:
ctx prompts:listShow detailed information with arguments:
ctx prompts:list --detailed
# or
ctx prompts -dFilter prompts by tags:
ctx prompts:list --tag api --tag documentation
# or
ctx prompts -t api -t documentationExclude prompts with specific tags:
ctx prompts:list --exclude-tag experimental
# or
ctx prompts -x experimentalFilter prompts by ID:
ctx prompts:list --id system-prompt --id user-query
# or
ctx prompts -p system-prompt -p user-queryThis command helps you discover and explore available prompts in your configuration, making it easier to understand what prompts are available for use with the MCP server.
List Available Tools
Lists all available MCP tools with their IDs, types, descriptions, and schema information.
ctx tool:list
# or
ctx toolsOptions
| Option | Description |
|---|---|
--config-file, -c | Path to configuration file (absolute or relative to current directory). |
--type, -t | Filter tools by type (e.g., run, http). |
--id, -i | Filter tools by ID (can be used multiple times). |
--detailed, -d | Show detailed information including commands. |
Examples
List all tools in table format:
ctx tool:listShow detailed information with commands:
ctx tool:list --detailed
# or
ctx tools -dFilter tools by type:
ctx tool:list --type run
# or
ctx tools -t httpFilter tools by ID:
ctx tool:list --id git-status --id lint-code
# or
ctx tools -i git-status -i lint-codeExecute a Tool
Executes an MCP tool with interactive prompts for arguments based on the tool's schema.
ctx tool:run <tool-id>Options
| Option | Description |
|---|---|
--config-file, -c | Path to configuration file (absolute or relative to current directory). |
--arg, -a | Tool arguments in format name=value (can be used multiple times). |
--no-interaction, -n | Do not ask any interactive questions. |
Examples
Execute a tool with interactive prompts:
ctx tool:run git-statusExecute a tool with arguments provided on command line:
ctx tool:run lint-code --arg path=src/MyClass.php --arg fix=true
# or
ctx tool:run lint-code -a path=src/MyClass.php -a fix=trueExecute in non-interactive mode (requires all necessary arguments):
ctx tool:run build-assets --arg env=production --no-interaction
# or
ctx tool:run build-assets -a env=production -nSelect a tool interactively:
ctx tool:runUse a specific configuration file:
ctx tool:run deploy-app --config-file=tools-config.yaml
# or
ctx tool:run deploy-app -c tools-config.yamlThis command simplifies testing and executing MCP tools during development without requiring code changes or application redeployment.