Google Home MCP Server
by jmagar
Verified
Google Home MCP Server
An MCP server implementation for controlling Google Home smart plugs through the Smart Home API.
Features
- List all available smart plugs and their states
- Control smart plugs (turn on/off)
- Get real-time state of specific smart plugs
- Automatic device state refresh
- OAuth2 authentication with Smart Home API
Prerequisites
- Google Cloud Project with Smart Home API enabled
- Actions on Google Smart Home Action project
- OAuth 2.0 Client credentials for Smart Home Action
- Node.js 18 or higher
- Access to Google Home smart plugs
Setup
- Create a Smart Home Action:
- Go to Actions on Google Console
- Create a new project
- Choose "Smart Home" as the project type
- Configure Account Linking:
- OAuth Client ID
- OAuth Client Secret
- Authorization URL
- Token URL
- Set up OAuth 2.0:
- Configure your OAuth server endpoints
- Set up user authentication flow
- Implement token generation/validation
- Install dependencies:
Copy
- Configure the server:
- Copy
config.json.example
toconfig.json
- Fill in your:
- OAuth Client ID
- OAuth Client Secret
- Copy
- Build the server:
Copy
- Start the server:
Copy
Available Tools
1. List Smart Plugs
Copy
2. Control Smart Plug
Copy
3. Get Smart Plug State
Copy
API Details
The server implements the Smart Home API intents:
- SYNC Intent
- Called when users link their account
- Reports available devices and capabilities
- Handles device discovery
- QUERY Intent
- Reports current state of devices
- Handles state queries from Google Assistant
- Returns online/offline status
- EXECUTE Intent
- Handles device control commands
- Executes on/off operations
- Reports command success/failure
Error Handling
The server implements comprehensive error handling with specific error codes:
CONFIG_ERROR
: Configuration loading or validation errorsAPI_ERROR
: Errors from Smart Home APIDEVICE_NOT_FOUND
: Device ID not found in available devicesCOMMAND_ERROR
: Error executing device command
Each error includes:
- Error message
- Error code
- Detailed error information when available
Security
- OAuth 2.0 authentication flow
- Secure token handling
- Request validation
- Command authorization
- HTTPS communication
- Input sanitization
Development
- Start in development mode:
Copy
- Run tests:
Copy
- Debug logs:
- All API calls are logged
- Error details are captured
- Device state changes are tracked
Contributing
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request
License
MIT
ghome-mcp-server
This server cannot be installed
Enables users to control Google Home smart plugs using the Smart Home API with OAuth2 authentication, offering real-time device state management and control operations.