Aller au contenu

Installation

Ce contenu n’est pas encore disponible dans votre langue.

Contextia can be installed as a standalone CLI tool, as a Python package, or run directly with uvx without permanent installation. This guide covers all methods and shows how to configure the MCP server for your editor.

  • Python 3.12 or later — Contextia uses modern Python features including type parameter syntax and typing improvements introduced in 3.12
  • uv (recommended) — a fast Python package manager. Install it from docs.astral.sh/uv

The fastest way to use Contextia is with uvx, which runs the tool directly without installing it into your environment:

Terminal window
uvx contextia --version

This downloads Contextia on first run and caches it. No virtual environment management needed.

To install it permanently so the contextia command is always available:

Terminal window
uv tool install contextia

If you prefer traditional pip installation:

Terminal window
pip install contextia

Contextia can parse code annotations (@spec, @decision, etc.) using regex by default. For more accurate parsing with tree-sitter grammars, install with the languages extra:

Terminal window
pip install contextia[languages]

Or with uv:

Terminal window
uv tool install contextia[languages]

This installs tree-sitter grammars for Python, TypeScript, JavaScript, Go, Rust, and Java. Tree-sitter provides AST-level parsing, which means Contextia can reliably detect the function or class containing an annotation, not just the line it appears on.

After installing, verify that Contextia is available:

Terminal window
contextia --version

You should see output like:

contextia 0.1.0

You can also check that the CLI is working by running the help command:

Terminal window
contextia --help

This displays all available commands with brief descriptions.

The MCP server (contextia-mcp) allows AI agents to access your project’s context architecture directly through the Model Context Protocol. The server runs as a local stdio process — no HTTP, no authentication, no external network access.

The server automatically discovers your project by walking up from the working directory looking for .contextia/config.yaml, just like git discovers .git/. No per-project configuration is needed in your editor.

Register the MCP server with Claude Code using a single command:

Terminal window
claude mcp add contextia -- uvx contextia-mcp

This tells Claude Code to start the Contextia MCP server when needed. The server inherits the working directory from Claude Code, so it automatically finds your project root.

To verify the server is registered:

Terminal window
claude mcp list

You should see contextia in the list of configured servers.

Create or edit .cursor/mcp.json in your project root:

.cursor/mcp.json
{
"mcpServers": {
"contextia": {
"command": "uvx",
"args": ["contextia-mcp"]
}
}
}

Restart Cursor after adding this configuration. The MCP server will be available to the AI agent in all files within the project.

Create or edit .vscode/mcp.json in your project root:

.vscode/mcp.json
{
"servers": {
"contextia": {
"type": "stdio",
"command": "uvx",
"args": ["contextia-mcp"]
}
}
}

You can test the MCP server directly from the command line:

Terminal window
uvx contextia-mcp

The server starts and waits for JSON-RPC messages on stdin. In normal use, your editor manages this process automatically. Press Ctrl+C to stop.

To verify it works with your project, navigate to a directory containing a .contextia/ folder and check that the server starts without errors.

Contextia does not require any editor-specific project configuration beyond the MCP server setup above. All project settings live in .contextia/config.yaml, which is created when you run contextia init.

A minimal configuration looks like this:

.contextia/config.yaml
version: "1.0"
project:
name: my-project
languages:
- python
annotations:
prefix: "@"
comment_syntax:
python: "#"

See the Quickstart guide for a walkthrough of initializing your first project.

Terminal window
uv tool upgrade contextia
Terminal window
pip install --upgrade contextia
Terminal window
contextia --version

Compare the output with the latest release on PyPI.

With Contextia installed and your MCP server configured, head to the Quickstart tutorial to initialize your first project and create your first spec.