Context Kit
A CLI tool and MCP client, used to create spec files for AI coding agents with context baked in
Installation
npx context-kitAsk AI about Context Kit
Powered by Claude Β· Grounded in docs
I know everything about Context Kit. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
ContextKit
A CLI tool and MCP client for creating spec files for AI coding agents. ContextKit generates specs from reusable Jinja2-based templates, filling in context from various MCP sources and user input.
Note: While ContextKit is an MCP client, it doesn't use an AI model - it's a tool to harness the MCP ecosystem for context injection.
Demo

How it Works π
ContextKit utilizes the MCP (Model Context Protocol) ecosystem to inject context into spec files from various sources like ticketing systems, databases, document storage, and design tools. It works with spec templates - reusable Jinja2 template files containing context variables that define the common structure and requirements of development tasks.
Context variables are automatically fetched from MCP resources when possible, or collected interactively from the user when additional input is needed.
Installation π¦
Requirements
- Python 3.11 or higher
Install from source
git clone <repository-url>
cd context-kit
uv sync
Install in editable mode
pip3 install -e .
After editable installation, you can use the cxk command directly:
cxk --help
Alternatively, without editable installation:
python cxk.py --help
# or with uv:
uv run cxk.py --help
Quick Start π
1. Initialize a project
Run this in your project directory. It creates a .cxk/ directory to store config.
cxk init
2. Add MCP servers
# Add SSE server
cxk mcp add-sse ticket-server http://localhost:3000
# Add stdio server with environment
cxk mcp add-stdio local-tools --env API_KEY=secret -- python server.py
# Add HTTP server
cxk mcp add-http doc-service http://localhost:8000
3. Create a spec from template
cxk create-spec path/to/template.md
Usage Examples π»
Basic Template with a variable
Template (spec.md):
# Development Task
Please develop the task below. You should start by ...
## PRD
{{ prd }}
Generate spec:
cxk create-spec spec.md
This will prompt you to provide a value for prd either directly or by selecting an MCP tool to call.
Basic Template with MCP Tool Call
Template (spec.md):
# Development Task
Please develop the task below. You should start by ...
{% set ticket = call_tool('ticket-service', 'get_issue', {'cloudId': '1234', 'issueKey': ticket_id}) %}
## Task Description
{{ ticket.fields.description }}
## Acceptance Criteria
{{ ticket.fields.acceptance_criteria }}
Generate spec:
cxk create-spec spec.md --var ticket_id=ACME-123
Template with MCP Resource
Template (design-spec.md):
## Design Requirements
{{ get_resource('figma-service', 'designs://'+design_id) }}
Generate spec:
cxk create-spec design-spec.md --var design_id=fig-456
Advanced: Filtering and Processing Context
Filter sensitive information:
{% set support_ticket = call_tool('support', 'getTicket', ticket_id) %}
## Support Request
{{ support_ticket | regex_replace(r'\b[\w.+-]+@[\w.-]+\.\w+\b', '[EMAIL_REDACTED]') }}
Extract specific fields:
{% set ticket = call_tool('ticket-service', 'get_issue', {'issueKey': ticket_id}) %}
## Summary
{{ ticket.fields.summary }}
## Priority
{{ ticket.fields.priority.name }}
Interactive Variable Collection
When variables aren't provided via --var, ContextKit prompts interactively:
cxk create-spec template.md
# Prompts:
# ? How would you like to provide the value for 'ticket_id'?
# βΊ Provide value directly
# Use MCP tool to fetch value
# Read from file
Output to File
cxk create-spec template.md --output result.md --var ticket_id=ACME-123
Pipe Template Content
cat template.md | cxk create-spec --var ticket_id=ACME-123
CLI Commands π οΈ
Project Management
# Initialize new project (creates .cxk/ directory)
cxk init
MCP Server Management
# Add SSE MCP server
cxk mcp add-sse <server-name> <websocket-url>
# Add stdio MCP server
cxk mcp add-stdio <server-name> [--env KEY=value] -- <command> [args...]
# Add HTTP MCP server
cxk mcp add-http <server-name> <http-url> [--header KEY=value]
Spec Generation
# Generate spec from template
cxk create-spec <template-path> [--var KEY=value] [--output <file>]
# Generate with multiple variables
cxk create-spec template.md --var ticket_id=ACME-123 --var env=production
Template Language π
ContextKit uses Jinja2 as its template engine with additional global functions:
Available Functions
call_tool(server_name, tool_name, arguments)- Call MCP toolget_resource(server_name, resource_uri)- Get MCP resource- All standard Jinja2 filters and functions
Template Variables
Variables can be:
- Direct values:
--var ticket_id=ACME-123 - JSON objects:
--var ticket='{"id": 123, "status": "open"}' - Interactive input: Prompted when not provided
Configuration π
MCP Configuration Examples
# Development setup
cxk init
cxk mcp add-sse jira https://mcp.example.com/jira
cxk mcp add-stdio local-db --env DB_URL=postgresql://... -- python db_server.py
cxk mcp add-http docs http://localhost:8000 --header Authorization='Bearer token'
Why ContextKit? π€
Benefits
- π Speed: Pre-populate specs with relevant context automatically
- π° Cost reduction: AI agents don't need to make additional MCP calls
- π§Ή Clean codebase: Keep reusable spec templates in version control
- π Consistency: Standardized spec format across your team
- π Extensible: Leverage the growing MCP ecosystem
Development π¨
# Install development dependencies
uv sync
# Run tests
uv run pytest
# Run linting
uv run ruff check
uv run ruff format
