context-foundry — Claude Code MCP server: install and use
An autonomous execution pipeline that works through TASKS.md with isolated agents and verification checks. Best for testable code changes.
claude mcp add context-foundry -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- uvx context-foundryWhat context-foundry does
This MCP harness drives a multi-stage software delivery loop based on your TASKS.md file. Each role — investigation, planning, coding, and auditing — runs as a fresh Claude Code process. No conversation history passes between stages. Agents exchange only curated markdown outputs inside the .buildloop folder.
A separate verification pass audits new edits from a clean slate. It executes tests, resolves flagged issues, and writes a git commit: feat(task_id) on success or WIP(task_id) when problems remain. Reusable engineering lessons are cataloged under ~/.foundry/patterns/ as JSON. Without an ANTHROPIC_API_KEY environment variable, the process will not start.
Running this loop on unstructured prose or documentation updates wastes tokens. Verification cannot validate freeform text, so save the pipeline for code backed by concrete tests.
What it helps with
- execute engineering items from
TASKS.mdautomatically - audit generated patches using a clean agent context
- store discovered project patterns in
~/.foundry/patterns/ - commit progress to git with per-task status indicators
Example prompts for the agent
- Run the pending task queue from
TASKS.mdin sprint mode - Audit recent changes with a clean verification agent
- Extract reusable codebase patterns into
.foundry
How to install context-foundry
Platform CLI
claude mcp add context-foundry -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- uvx context-foundryReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from context-foundry <command>
Platform CLI
codex mcp add context-foundry --env ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- uvx context-foundryReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from context-foundry <command>
Config file
{
"mcpServers": {
"context-foundry": {
"command": "uvx",
"args": [
"context-foundry"
],
"env": {
"ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from context-foundry <command>
Config file
{
"servers": {
"context-foundry": {
"type": "stdio",
"command": "uvx",
"args": [
"context-foundry"
],
"env": {
"ANTHROPIC_API_KEY": "<ANTHROPIC_API_KEY>"
}
}
}
}Replace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from context-foundry <command>
Platform CLI
gemini mcp add -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> context-foundry uvx context-foundryReplace <…> with your own values. uvx runs the command named after the package; if the README names another one, use uvx --from context-foundry <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about context-foundry
How to install context-foundry in Claude Code?
Run claude mcp add context-foundry -e ANTHROPIC_API_KEY=<ANTHROPIC_API_KEY> -- uvx context-foundry in your shell.
Why does context-foundry isolate context across stages?
Wiping memory between steps keeps agents objective. The auditor inspects fresh files without inheriting the author's assumptions, preventing blind spots from compounding.
When should context-foundry be avoided?
Skip it for documentation, README edits, and brainstorming. The audit gate requires deterministic tests or code assertions, making the pipeline inefficient for pure text.