Claude.md - AI Assistant Context for Ardour MCP
This file provides context for AI assistants (like Claude) when working with the Ardour MCP codebase.
Project Overview
Ardour MCP is a Model Context Protocol (MCP) server that enables AI assistants to control Ardour, a professional open-source Digital Audio Workstation (DAW). This is the first MCP integration for a major open-source DAW.
Core Concepts
What is Ardour?
Ardour is a professional, open-source DAW for recording, editing, and mixing audio. It’s used by musicians, audio engineers, and producers worldwide.
What is MCP?
The Model Context Protocol is a standardized way for AI assistants to interact with external tools and services. It defines how tools are exposed and called.
What is OSC?
Open Sound Control (OSC) is a network protocol for communication between computers, sound synthesizers, and multimedia devices. Ardour uses OSC for remote control.
Architecture
The system has three main layers:
-
MCP Server Layer (
server.py)- Exposes tools to AI assistants via MCP protocol
- Handles tool registration and execution
- Manages error handling and responses
-
OSC Bridge Layer (
osc_bridge.py)- Sends OSC commands to Ardour
- Receives OSC feedback from Ardour
- Manages bidirectional communication
-
State Management Layer (
ardour_state.py)- Caches Ardour’s current state from OSC feedback
- Provides quick access to session information
- Reduces need for round-trip queries
Key Files and Their Purpose
Source Code (src/ardour_mcp/)
server.py: Main MCP server, tool registrationosc_bridge.py: OSC communication with Ardour (TODO)ardour_state.py: State caching and management (TODO)tools/: Individual MCP tool implementationstransport.py: Play, stop, record, navigation (TODO)tracks.py: Track creation, selection, management (TODO)session.py: Session info queries (TODO)recording.py: Recording controls (TODO)
Documentation (docs/)
ARCHITECTURE.md: Detailed system designDEVELOPMENT.md: Developer setup and workflowOSC_API.md: Complete Ardour OSC command referenceROADMAP.md: Feature timeline and milestones
Configuration
pyproject.toml: Python project configuration, dependencies.gitignore: Git ignore patternsCHANGELOG.md: Version history
Development Workflow
Setting Up
# Install dependencies
uv sync --all-extras
# Run tests
uv run pytest
# Format code
uv run ruff format src/ tests/
# Lint code
uv run ruff check src/ tests/Testing Philosophy
- Unit tests: Test individual components in isolation
- Mock external dependencies: Use mocks for OSC, network calls
- Test success and error cases: Ensure robust error handling
- Aim for >80% coverage: Maintain high test quality
Code Style
- Follow PEP 8
- Use type hints for all function signatures
- Maximum line length: 100 characters
- Add docstrings to all public functions/classes
- Use descriptive names
Current Development Phase
Phase 1 (MVP) - January-February 2025
Focus areas:
- OSC communication bridge (Issue #1)
- State management system (Issue #2)
- Core MCP tools (Issues 3-5)
- Basic testing infrastructure
Common Tasks
Adding a New MCP Tool
- Create module in
src/ardour_mcp/tools/ - Implement tool function with proper typing
- Add docstring with MCP tool description
- Register tool in
server.py - Write unit tests
- Update documentation
Working with OSC
Key OSC concepts:
- Commands: Sent to Ardour (e.g.,
/transport_play) - Feedback: Received from Ardour (e.g.,
/transport_frame) - Address patterns: OSC paths like
/strip/1/gain - Type tags: OSC data types (i=int, f=float, s=string)
Testing OSC Code
from unittest.mock import Mock, patch
def test_transport_play():
# Mock the OSC bridge
with patch('ardour_mcp.osc_bridge.ArdourOSCBridge') as mock_bridge:
# Set up mock behavior
mock_bridge.send_command.return_value = True
# Test the tool
result = transport_play()
# Verify OSC command was sent
mock_bridge.send_command.assert_called_with('/transport_play')Important Considerations
Error Handling
- Always validate inputs before sending OSC commands
- Handle network failures gracefully
- Provide clear error messages to users
- Log errors for debugging
Performance
- Use state cache to avoid unnecessary OSC queries
- Batch multiple operations when possible
- Handle OSC feedback asynchronously
- Don’t block on network operations
Compatibility
- Support Ardour 8.x (latest stable)
- Test with different Ardour configurations
- Handle missing or disabled features gracefully
- Document version-specific behavior
Resources for Development
Ardour
MCP
Python/OSC
Tips for AI Assistants
When helping with this codebase:
- Check existing documentation first: Most design decisions are documented
- Follow the architecture: Don’t bypass layers (e.g., tools → state → OSC bridge → Ardour)
- Maintain consistency: Follow existing patterns for new features
- Test thoroughly: Audio software requires reliability
- Consider latency: Real-time audio requires responsive controls
- Document assumptions: Audio engineering context may not be obvious
Questions to Ask
If uncertain about implementation:
- What is the expected latency for this operation?
- Does this need to be synchronous or can it be async?
- How should we handle Ardour being unavailable?
- What feedback should the user receive?
- Are there version-specific considerations?
Project Goals
- Accessibility: Make professional audio production more accessible through AI assistance
- Reliability: Build a robust, production-ready tool
- Community: Foster collaboration between audio and AI communities
- Innovation: Pioneer AI integration in open-source audio software
- Education: Help people learn audio production through AI assistance
This context should help AI assistants understand the project structure, development workflow, and key considerations when working with the Ardour MCP codebase.