Tuya Integration
Manage Tuya list devices, get device, get device status, send device commands, list scenes
The Tuya integration provides access to manage Tuya list devices, get device, get device status, send device commands, list scenes through the Integrate MCP server.
Installation
The Tuya integration is included with the SDK:
import { tuyaIntegration } from "integrate-sdk/server";Setup
1. Create a Tuya OAuth App
- Create an OAuth application for Tuya
- Configure your redirect URI
- Note your Client ID and Client Secret
2. Configure the Integration on Your Server
Add the Tuya integration to your server configuration. The integration automatically reads TUYA_CLIENT_ID and TUYA_CLIENT_SECRET from your environment variables:
import { createMCPServer, tuyaIntegration } from "integrate-sdk/server";
export const { client: serverClient } = createMCPServer({
apiKey: process.env.INTEGRATE_API_KEY,
integrations: [
tuyaIntegration({
scopes: ["device:read", "device:write", "home:read", "scene:read", "scene:write"], // Optional
}),
],
});You can override the environment variables by passing explicit values:
tuyaIntegration({
clientId: process.env.CUSTOM_TUYA_ID,
clientSecret: process.env.CUSTOM_TUYA_SECRET,
scopes: ["device:read", "device:write", "home:read", "scene:read", "scene:write"], // Optional
});3. Client-Side Usage
The default client automatically includes all integrations. You can use it directly:
import { client } from "integrate-sdk";
await client.authorize("tuya");
const result = await client.tuya.listDevices({
user_id: "value",
});
console.log(result);If you're using a custom client, add the integration to the integrations array:
import { createMCPClient, tuyaIntegration } from "integrate-sdk";
const customClient = createMCPClient({
integrations: [tuyaIntegration()],
});Configuration Options
export interface TuyaIntegrationConfig {
clientId?: string;
Default Scopes
These defaults are applied unless you override scopes in the integration config:
device:readdevice:writehome:readscene:readscene:write
Tools
tuya_list_devices
List devices
export interface TuyaListDevicesParams { user_id: string }
tuya_get_device
Get device
export interface TuyaGetDeviceParams { device_id: string }
tuya_get_device_status
Get device status
export interface TuyaGetDeviceStatusParams { device_id: string }
tuya_send_device_commands
Send device commands
export interface TuyaSendDeviceCommandsParams { device_id: string;
tuya_list_scenes
List scenes
export interface TuyaListScenesParams { home_id: string }
Notes
- Category: Lifestyle
- Authentication mode: OAuth