Skip to content

A comprehensive SDK that empowers developers to integrate their custom capabilities with Tuya Cloud through the standardized Model Context Protocol (MCP), ensuring seamless connectivity and interoperability.

License

Notifications You must be signed in to change notification settings

adwuard/tuya-mcp-sdk

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tuya MCP SDK

License Go Python MCP

A comprehensive SDK that empowers developers to integrate their custom capabilities with Tuya Cloud through the standardized Model Context Protocol (MCP), ensuring seamless connectivity and interoperability.

🚀 Quick Start📖 Documentation🛠️ Examples

✨ Features

  • 🔌 Easy Integration: Simple SDK for connecting Tuya Developer Platform to MCP servers
  • 🐍 Multi-Language Support: Available in Python and Go
  • 🔒 Secure Authentication: Robust authentication with Tuya Cloud
  • 📱 Real-time Communication: WebSocket-based real-time interaction
  • 🎯 Production Ready: Comprehensive error handling and retry mechanisms

🏗️ Architecture

The Tuya MCP SDK bridges the gap between Custom MCP Server and Tuya Developer Platform by implementing the Model Context Protocol standard:

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   Your App      │───▶│    MCP SDK       │───▶│  MCP Gateway    │
└─────────────────┘    └──────────────────┘    └─────────────────┘
                              │
                              ▼
                       ┌──────────────────┐
                       │   MCP Server     │
                       └──────────────────┘

🚀 Quick Start

Prerequisites

  • Tuya Developer Account with MCP service enabled
  • Python >= 3.10 and pip >= 21.3, or Go >= 1.24
  • Access credentials (Access ID, Access Secret, Endpoint)

1. Setup Tuya Developer Platform

  1. Visit Tuya Developer Platform
  2. Navigate to MCP ManagementCustom MCP Service
  3. Create a new MCP service and note down your credentials
  4. Follow the detailed setup instructions

2. Choose Your SDK

🐍 Python SDK Example

# Clone the repository
git clone https://github.com/tuya/tuya-mcp-sdk.git
cd tuya-mcp-sdk/mcp-python

# Install dependencies
pip install -e .

# Run the example
python examples/quick_start.py

Python SDK Usage:

from mcp_sdk import create_mcpsdk

# Initialize SDK
async with create_mcpsdk(
    endpoint="your-endpoint",
    access_id="your-access-id", 
    access_secret="your-access-secret",
    custom_mcp_server_endpoint="http://localhost:8765/mcp"
) as sdk:
    # Your MCP server is now connected to Tuya Cloud!
    await sdk.run()

🐹 Go SDK Example

# Navigate to Go SDK
cd tuya-mcp-sdk/mcp-golang

# Install dependencies
go mod tidy

# Run the example
go run examples/main.go

Go SDK Usage:

import "mcp-sdk/pkg/mcpsdk"

// Initialize SDK
mcpsdk, err := sdk.NewMCPSdk(
    sdk.WithMCPServerEndpoint("http://localhost:8765/mcp"),
    sdk.WithAccessParams("access-id", "access-secret", "endpoint"),
)
if err != nil {
    log.Fatal(err)
}

// Start the SDK
err = mcpsdk.Run()

📖 Documentation

Resource Description
📋 Setup Instructions Complete setup guide for Tuya Developer Platform
🐍 Python SDK Docs Python SDK documentation and examples
🐹 Go SDK Docs Go SDK documentation and examples
🏗️ Architecture System architecture diagrams

📁 Project Structure

tuya-mcp-sdk/
├── 📄 README.md                 # This file
├── 📄 License                   # Apache 2.0 License
├── 📁 docs/                     # Documentation
│   ├── instructions.md          # Setup instructions
│   └── architecture_diagram/    # Architecture diagrams
├── 📁 mcp-python/              # Python SDK
│   ├── src/mcp_sdk/            # Core SDK modules
│   ├── examples/               # Python examples
│   └── README.md               # Python-specific docs
└── 📁 mcp-golang/              # Go SDK
    ├── pkg/                    # Go packages
    ├── examples/               # Go examples
    └── README.md               # Go-specific docs

🛠️ Examples

📜 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

🆘 Support

About

A comprehensive SDK that empowers developers to integrate their custom capabilities with Tuya Cloud through the standardized Model Context Protocol (MCP), ensuring seamless connectivity and interoperability.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 73.5%
  • Go 26.5%