Spruthub MCP Server
Enables control of Sprut.hub smart home devices through dynamic API discovery and schema validation.
README
Spruthub MCP Server
A Model Context Protocol (MCP) server for controlling Sprut.hub smart home devices. This server provides Claude and other MCP-compatible clients with dynamic access to the complete Sprut.hub JSON-RPC API through schema autodiscovery.
Features
- Dynamic API Discovery - Automatically discovers and exposes all available Spruthub JSON-RPC methods
- Schema Validation - Built-in parameter validation and documentation for all API methods
- Full API Coverage - Access to all Spruthub functionality including devices, rooms, scenarios, and system administration
- WebSocket Connection - Secure connection to Spruthub server with authentication
- Method Categories - Organized API methods by category (hub, accessory, scenario, room, system)
- Real-time Schema Updates - Schema information updated with spruthub-client library versions
- Structured Responses - JSON-formatted responses optimized for AI integration
Installation
Using npx (Recommended)
Run the MCP server directly using npx:
npx spruthub-mcp-server
Using Claude Desktop
Add to your Claude Desktop MCP settings:
{
"mcpServers": {
"spruthub": {
"command": "npx",
"args": ["spruthub-mcp-server"],
"env": {
"SPRUTHUB_WS_URL": "wss://your-spruthub-server.com/ws",
"SPRUTHUB_EMAIL": "your-email@example.com",
"SPRUTHUB_PASSWORD": "your-password",
"SPRUTHUB_SERIAL": "your-device-serial"
}
}
}
}
Development
For development or local modifications:
git clone https://github.com/shady2k/spruthub-mcp-server.git
cd spruthub-mcp-server
npm install
Usage
As an MCP Server
Add this server to your MCP client configuration. For Claude Desktop, add to your claude_desktop_config.json:
Using npm package (recommended):
{
"mcpServers": {
"spruthub-mcp-server": {
"command": "npx",
"args": [
"spruthub-mcp-server@1.3.9"
],
"env": {
"SPRUTHUB_WS_URL": "ws://192.168.0.100/spruthub",
"SPRUTHUB_EMAIL": "your_email@example.com",
"SPRUTHUB_PASSWORD": "your_password",
"SPRUTHUB_SERIAL": "AAABBBCCCDDDEEEF"
}
}
}
}
For local development:
{
"mcpServers": {
"spruthub-mcp-server": {
"command": "node",
"args": ["/path/to/spruthub-mcp-server/src/index.js"],
"env": {
"SPRUTHUB_WS_URL": "ws://192.168.0.100/spruthub",
"SPRUTHUB_EMAIL": "your_email@example.com",
"SPRUTHUB_PASSWORD": "your_password",
"SPRUTHUB_SERIAL": "AAABBBCCCDDDEEEF"
}
}
}
}
Note: Replace the environment variables with your actual Spruthub server details:
SPRUTHUB_WS_URL: WebSocket URL of your Spruthub serverSPRUTHUB_EMAIL: Your Spruthub account emailSPRUTHUB_PASSWORD: Your Spruthub account passwordSPRUTHUB_SERIAL: Your Spruthub hub serial number
Security Best Practice: For sensitive values like SPRUTHUB_PASSWORD, consider using your system's environment variables instead of hardcoding them in the config file:
{
"mcpServers": {
"spruthub-mcp-server": {
"command": "npx",
"args": ["spruthub-mcp-server@1.3.9"],
"env": {
"SPRUTHUB_WS_URL": "ws://192.168.0.100/spruthub",
"SPRUTHUB_EMAIL": "your_email@example.com",
"SPRUTHUB_PASSWORD": "$SPRUTHUB_PASSWORD",
"SPRUTHUB_SERIAL": "AAABBBCCCDDDEEEF"
}
}
}
}
Then set the password in your system environment:
export SPRUTHUB_PASSWORD="your_actual_password"
Available Tools
This server provides three core tools that give you access to the complete Spruthub JSON-RPC API:
spruthub_list_methods
Discover all available Spruthub API methods with their descriptions and categories.
Parameters:
category(optional): Filter methods by category (hub,accessory,scenario,room,system)
Example usage: Start here to explore what's available in your Spruthub system.
spruthub_get_method_schema
Get detailed schema information for any API method, including parameters, return types, and examples.
Parameters:
methodName(required): The method name to get schema for (e.g.,accessory.search,characteristic.update)
Important: Always call this tool before using spruthub_call_method to understand the exact parameter structure required.
spruthub_call_method
Execute any Spruthub JSON-RPC API method with the provided parameters.
Parameters:
methodName(required): The API method to callparameters(optional): Method parameters as defined in the method's schema
Critical: You MUST call spruthub_get_method_schema first to understand the parameter structure. Never guess parameters.
Common Workflows
-
Explore your system:
spruthub_list_methods → spruthub_get_method_schema → spruthub_call_method -
Control devices:
spruthub_get_method_schema(methodName: "characteristic.update") → spruthub_call_method(methodName: "characteristic.update", parameters: {...}) -
Browse by category:
spruthub_list_methods(category: "accessory") → Get device-related methods spruthub_list_methods(category: "scenario") → Get automation methods
Efficient API Usage
The schema-based approach provides efficient access to Spruthub functionality:
Recommended Workflow
- Discovery Phase: Use
spruthub_list_methodsto explore available functionality - Schema Phase: Use
spruthub_get_method_schemato understand method requirements - Execution Phase: Use
spruthub_call_methodwith proper parameters
Best Practices
- Filter by category when exploring: Use
categoryparameter inspruthub_list_methods - Always get schema first: Never guess API parameters - use
spruthub_get_method_schema - Use specific methods: The API provides targeted methods for efficient operations
- Check method categories:
hub- Hub management and statusaccessory- Device discovery and controlscenario- Automation and scenesroom- Room managementsystem- System administration
Schema-Driven Development
Each API method includes:
- Complete parameter specifications
- Return type definitions
- Usage examples
- REST API mapping (where available)
- Category classification
Development
# Install dependencies
npm install
# Run in development mode with auto-reload
npm run dev
# Run linting
npm run lint
# Fix linting issues
npm run lint:fix
Environment Variables
Connection Settings
LOG_LEVEL: Set logging level (default: 'info')SPRUTHUB_WS_URL: WebSocket URL for Spruthub server (required if auto-connecting)SPRUTHUB_EMAIL: Email for authentication (required if auto-connecting)SPRUTHUB_PASSWORD: Password for authentication (required if auto-connecting)SPRUTHUB_SERIAL: Device serial number (required if auto-connecting)
Logging Settings
LOG_LEVEL: Set logging level (info,debug,warn,error) (default: 'info')
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。