Development Environment Setup
This guide will help you set up your development environment for the Home Assistant MCP Server.
Prerequisites
Required Software
- Python 3.10 or higher
- pip (Python package manager)
- git
- Docker (optional, for containerized development)
- Node.js 18+ (for frontend development)
System Requirements
- 4GB RAM minimum
- 2 CPU cores minimum
- 10GB free disk space
Initial Setup
-
Clone the Repository
-
Create Virtual Environment
-
Install Dependencies
Development Tools
Code Editor Setup
We recommend using Visual Studio Code with these extensions: - Python - Docker - YAML - ESLint - Prettier
VS Code Settings
{
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.formatting.provider": "black",
"editor.formatOnSave": true
}
Configuration
-
Create Local Config
-
Set Environment Variables
Running Tests
Unit Tests
Integration Tests
Coverage Report
Docker Development
Build Container
Run Development Container
Database Setup
Local Development Database
docker run -d \
-p 5432:5432 \
-e POSTGRES_USER=mcp \
-e POSTGRES_PASSWORD=development \
-e POSTGRES_DB=mcp_dev \
postgres:14
Run Migrations
Frontend Development
-
Install Node.js Dependencies
-
Start Development Server
Documentation
Build Documentation
View Documentation
Open http://localhost:8000 in your browser
Debugging
VS Code Launch Configuration
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: MCP Server",
"type": "python",
"request": "launch",
"program": "src/main.py",
"console": "integratedTerminal"
}
]
}
Git Hooks
Install Pre-commit
Available Hooks
- black (code formatting)
- flake8 (linting)
- isort (import sorting)
- mypy (type checking)
Troubleshooting
Common Issues: 1. Port already in use - Check for running processes: lsof -i :8123
- Kill process if needed: kill -9 PID
- Database connection issues
- Verify PostgreSQL is running
-
Check connection settings in .env
-
Virtual environment problems
- Delete and recreate:
rm -rf .venv && python -m venv .venv
- Reinstall dependencies
Next Steps
- Review the Architecture Guide
- Check Contributing Guidelines
- Start with Simple Issues