Cognitive Middleware for Architecture-Aware AI Coding Agents
Project description
archai-mcp
Cognitive Middleware for Architecture-Aware AI Coding Agents.
Overview
ArchAI is a middleware layer that governs how AI coding agents perceive and reason about software systems. It provides architecture-aware context to agents, reducing context pollution and architectural drift.
Installation
# Install from PyPI
pip install archai-mcp
# Or install with uv
uv tool install archai-mcp
After installation, the archai CLI is available globally.
For MCP integration, add uvx archai-mcp mcp to your .opencode/mcp.json (see MCP Integration).
Quick Start
# Install
uv sync
# Process a repository
uv run archai start .
# Ask about the architecture
uv run archai ask "how does the login work"
CLI Commands
| Command | Description |
|---|---|
archai start [repo_path] |
Process a repository (bootstrap + inference pipeline) |
archai ask "query" |
Ask a question about the architecture |
archai mcp |
Start MCP server (stdio, for agent integration) |
Examples
# Process current directory
archai start
# Process another repo
archai start /path/to/repo
# Ask questions
archai ask "how does the orchestrator work"
archai ask "what constraints does the auth module have"
# JSON output for scripting
archai ask "orchestrator" --json | jq '.focus'
Auto-Cache
archai ask automatically runs archai start if no cache exists. You never need to run archai start manually — but can if you want to pre-process.
MCP Integration (Agents)
ArchAI exposes 3 MCP tools for AI agents:
| Tool | Description |
|---|---|
get_architecture_context |
Get context packet for a query |
validate_code_change |
Validate changes against constraints |
get_blast_radius |
Analyze impact of changing a file |
Agent Configuration
// .opencode/mcp.json
{
"mcpServers": {
"archai": {
"command": "uvx",
"args": ["archai-mcp", "mcp"],
"description": "Architecture-aware context for AI coding agents"
}
}
}
Development
# Run tests
uv run pytest
# Run with coverage
uv run pytest --cov=src --cov-report=html
# Format code
uv run black src/
uv run ruff check src/
Architecture
See docs/002-sdd-cli-mcp-architecture.md for the current architecture spec.
See docs/001-sdd-mvp-architecture.md for the original MVP spec (superseded by 002 for CLI/MCP sections).
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file archai_mcp-0.3.0.tar.gz.
File metadata
- Download URL: archai_mcp-0.3.0.tar.gz
- Upload date:
- Size: 32.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae533b04898d911e9312a23632b461173887027e898698f69ba766b1c4303bfe
|
|
| MD5 |
30366c71c94f47280f722b81b05c9808
|
|
| BLAKE2b-256 |
87309097405a7e3098f569e192a0e7f687c657ca8a8dce02cd6663a044f16238
|
File details
Details for the file archai_mcp-0.3.0-py3-none-any.whl.
File metadata
- Download URL: archai_mcp-0.3.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca3f8f721bfd2b95d74ec4ce814da9719d28273e4fbf8a18e0aac6bc132e340b
|
|
| MD5 |
087485774794e12a8033ea978cdef519
|
|
| BLAKE2b-256 |
017e44c054e17cb348383e3d39eb5aefc20a8eeab1ef374ae35d8baa6168d6bc
|