Foundry MCP
Deterministic project context management for AI coding assistants
An MCP (Model Context Protocol) server that enables AI assistants like Claude and Cursor to maintain persistent project context, specifications, and task lists across development sessions. Stores all context in ~/.foundry/
to keep your codebase clean.
Installation
Install from crates.io
Setup with AI Assistants
After installation, configure Foundry with your AI development environment:
# For Cursor
# For Claude Code
# Verify installation
That's it! Foundry MCP tools are now available in your AI assistant.
Installation includes helpful templates:
- Cursor: Gets
.cursor/rules/foundry.mdc
with edit_commands guidance and workflow examples - Claude Code: Gets
~/.claude/agents/foundry-mcp-agent.md
with edit_commands usage and intelligent defaults
Why Foundry?
- 🎯 Persistent Context: Never lose project context between AI sessions
- 🗂️ Clean Separation: Project specs stored outside your codebase in
~/.foundry/
- 📋 Structured Planning: Organized specifications with task breakdowns
- 🔄 Resume Work: Pick up complex development exactly where you left off
- 🛠️ Deterministic: Reliable file operations instead of error-prone AI prompting
Problem Statement
Current AI coding assistant workflows suffer from critical issues:
- Inconsistent file management: Prompt-driven systems create files in unpredictable locations
- Project directory pollution: Context management files clutter the actual codebase
- Context loss: No reliable way to pause/resume complex development tasks across sessions
- Error-prone prompting: Relying on natural language instructions for file system operations leads to inconsistent behavior
Solution Overview
Foundry MCP provides a set of MCP tools that enable deterministic project and specification management through a centralized file system outside of project directories.
Core Value Propositions
- Deterministic operations: MCP tools eliminate prompt-driven file system errors
- Clean project separation: Context files stored outside project directories
- Persistent context: Natural pause/resume functionality through structured file storage
- Hierarchical organization: Project-level context with individual specs and task lists
- Simplified installation: One-command setup with PATH-based reliability and automatic configuration
MCP Tools
Foundry provides 9 MCP tools that enable comprehensive project management for AI assistants:
Project Management
create_project
: Create new project with vision, tech stack, and summaryanalyze_project
: Create project structure by analyzing existing codebasesload_project
: Load complete project context for LLM sessionslist_projects
: List all available projects with metadata
Specification Management
create_spec
: Create timestamped specification with task breakdownload_spec
: Load specification content with project contextupdate_spec
: Edit spec files using intent-based edit commands with precise anchors and idempotent updatesdelete_spec
: Delete existing specification and all its files
Content & Workflow
validate_content
: Validate content against schema requirementsget_foundry_help
: Get comprehensive workflow guidance and examples
How It Works
Foundry stores structured project context in ~/.foundry/
:
~/.foundry/my-project/
├── vision.md # Product vision and goals
├── tech-stack.md # Technology decisions
├── summary.md # Quick context summary
└── specs/
└── 20250826_143052_user_auth/
├── spec.md # Feature requirements
├── task-list.md # Implementation checklist
└── notes.md # Design decisions
Benefits: Clean codebase separation • Persistent across git operations • Chronological feature tracking
AI Assistant Benefits
When you work with AI assistants like Claude or Cursor, Foundry provides:
🔄 Session Continuity
Day 1: "Build a task management app"
→ AI creates project with vision, tech stack, feature specs
Day 5: "Let's work on authentication"
→ AI loads complete context, knows exactly what you're building
📋 Structured Development
- Project-level context: Vision, tech decisions, and architecture choices persist
- Feature specifications: Detailed requirements with implementation task lists
- Progress tracking: Task lists update as AI completes work
🧠 Enhanced AI Performance
- No repeated explanations: AI loads full project context in seconds
- Consistent decisions: Technology choices and architecture preserved
- Better code quality: Specifications guide implementation details
- Reduced hallucination: Structured context prevents AI from making assumptions
✏️ Deterministic Edit Commands
- Intent-based commands:
set_task_status
,upsert_task
,append_to_section
only - Precise selectors:
task_text
(exact checkbox text) andsection
(case-insensitive headers) - Idempotent updates: Safe to re-run commands without duplication or side effects
- Smart error recovery: Candidate selector suggestions with exact match requirements
🤝 Collaborative User Experience
- Option-based guidance: All tools provide "You can..." suggestions instead of directive commands
- Content creation acknowledgment: Tools explicitly recognize AI assistant's role in content generation
- Workflow efficiency: Smart guidance for optimal tool selection and usage patterns
- User decision-making control: Preserves user agency while providing helpful guidance
MCP Tools Available
Once installed, AI assistants have access to these tools:
create_project
- Create new project with vision, tech stack, and summaryanalyze_project
- Create project from existing codebase analysisload_project
- Load complete project context for AI sessionslist_projects
- List all available projects with metadatacreate_spec
- Create timestamped specification with task breakdownload_spec
- Load specification content with project contextupdate_spec
- Edit spec files using intent-based commands:set_task_status
,upsert_task
,append_to_section
delete_spec
- Delete existing specification and all its filesvalidate_content
- Validate content against schema requirementsget_foundry_help
- Get workflow guidance and examples
Development
Building
Testing
Running the MCP Server
# Start MCP server
# With verbose logging for debugging
CLI Testing (Optional)
Test MCP tools from the command line:
# Basic workflow test
Contributing
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure
cargo test
passes - Submit a pull request