Development Setup¶
Guide to setting up a development environment.
Prerequisites¶
- Python 3.10+
- uv
- Git
- FL Studio (optional, for testing FL Studio features)
- loopMIDI (optional, for testing MIDI features)
Setup¶
# Clone repository
git clone https://github.com/quinnjr/fruityloops-mcp.git
cd fruityloops-mcp
# Install dependencies
uv sync --all-extras
# Install git hooks
./install-hooks.sh # Unix/Linux/macOS
./install-hooks.ps1 # Windows
Project Structure¶
fruityloops-mcp/
├── src/fruityloops_mcp/ # Source code
│ ├── server.py # MCP server
│ ├── midi_interface.py # MIDI interface
│ ├── __init__.py
│ └── __main__.py
├── tests/ # Test files
├── docs/ # Documentation
├── .github/ # GitHub config
│ └── workflows/ # CI/CD
├── .githooks/ # Git hooks
└── pyproject.toml # Project config
Development Workflow¶
Running Locally¶
Testing¶
# Run all tests
uv run pytest
# Run specific test
uv run pytest tests/test_midi.py
# With coverage
uv run pytest --cov
# Watch mode (requires pytest-watch)
uv run ptw
Linting¶
# Check code
uv run ruff check .
# Fix issues
uv run ruff check --fix .
# Format code
uv run ruff format .
Documentation¶
# Install docs dependencies
uv sync --extra docs
# Serve docs locally
uv run mkdocs serve
# Visit http://localhost:8000
# Build docs
uv run mkdocs build
Docker Development¶
# Build container
docker-compose build
# Run tests
docker-compose run ci
# Interactive shell
docker-compose run test
Making Changes¶
- Create a branch:
git checkout -b feature/your-feature - Make changes
- Run tests:
uv run pytest - Lint code:
uv run ruff check . - Commit:
git commit -m "feat: your feature" - Push:
git push origin feature/your-feature - Create Pull Request
Debugging¶
Server Debugging¶
MIDI Debugging¶
# List ports
from fruityloops_mcp.midi_interface import MIDIInterface
midi = MIDIInterface()
print(midi.list_ports())
Common Tasks¶
Adding a New Tool¶
- Add tool definition in
server.pylist_tools() - Add handler in
_execute_tool() - Add tests in
tests/test_server.py - Update documentation
Adding Dependencies¶
# Runtime dependency
uv add package-name
# Dev dependency
uv add --dev package-name
# Docs dependency
uv add --group docs package-name