ddellecasedata/things5-mcp-server
If you are the rightful owner of things5-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Things5 MCP Server is designed to manage OAuth2 authentication, integrate with the Things5 API, and provide modular tools for efficient deployment using Docker.
Things5 MCP Server - OpenAI Compatible
A Model Context Protocol (MCP) server for the Things5 IoT platform, fully compatible with OpenAI MCP specifications. Provides comprehensive device management and data access capabilities through both Streamable HTTP and HTTP/SSE transport protocols.
OpenAI MCP Integration
This server is fully compatible with OpenAI's MCP specifications and can be used directly with the OpenAI Responses API. It supports:
- Streamable HTTP Transport (
POST /mcp) - HTTP/SSE Transport (
GET /sse) - OAuth 2.0 Authentication
- Dynamic Client Registration
- Session Management
- Tool Approval Workflows
Quick OpenAI Integration
from openai import OpenAI
client = OpenAI()
resp = client.responses.create(
model="gpt-5",
tools=[
{
"type": "mcp",
"server_label": "things5",
"server_description": "Things5 IoT platform for device management and data access",
"server_url": "https://your-server.com/sse",
"authorization": "Bearer YOUR_ACCESS_TOKEN",
"require_approval": "never",
},
],
input="Show me all my IoT devices and their current status",
)
Features
- Device Management: List, create, update, and manage IoT devices
- Data Access: Read parameters, states, metrics, and events from devices
- Machine Commands: Execute commands on connected machines
- User Management: Manage users and permissions
- Firmware Management: Handle device firmware updates
- OAuth 2.0 Authentication: Secure access via Keycloak integration
- OpenAI MCP Compatible: Direct integration with OpenAI Responses API
Installation
npm install
Configuration
Environment Variables
Create .env.local with the following OpenAI-compatible configuration:
NODE_ENV=production
PORT=3000
KEYCLOAK_BASE_URL=https://auth.things5.digital
KEYCLOAK_CLIENT_ID=mcp-server
THINGS5_BASE_URL=http://api.things5.digital/v1
THINGS5_RECIPES_BASE_URL=https://api.things5.digital/v1/recipes
For Development
Copy .env.example to .env.local and modify as needed:
cp .env.example .env.local
Usage
Development
npm run watch
Production
npm run build
npm start
Streamable HTTP Server (Recommended for OpenAI)
npm run start:streamableHttp
API Endpoints
MCP Protocol Endpoints
POST /mcp- Streamable HTTP transport (MCP standard)GET /sse- HTTP/SSE transport (OpenAI compatible)DELETE /mcp- Session termination
OAuth & Management
GET /health- Health checkGET /.well-known/oauth-authorization-server- OAuth metadataPOST /register- Dynamic client registrationGET /authorize- OAuth authorizationPOST /token- Token endpoint
Available Tools
Device Management
devicesList- List all devices with filtering optionsdeviceDetails- Get detailed information about a specific devicedeviceCreate- Create a new devicedeviceUpdate- Update device informationdevicesGroupsList- List device groupsshowDeviceGroup- Show specific device groupcreateDeviceGroupUser- Create device group user
Data Access
readParameters- Read device parametersreadSingleParameter- Read a specific parameterstatesRead- Read device statesstateReadLastValue- Read last state valuemetricsRead- Read device metricsaggregatedMetrics- Read aggregated metricseventsRead- Read device events
Machine Commands
machineCommandCreate- Create machine commandsmachineCommandExecute- Execute commands on machinesmachineCommandUpdate- Update existing commandsmachineCommandDelete- Delete commands
Overview & Monitoring
overviewEvents- Get overview of eventsoverviewAlarms- Get overview of alarms
User Management
usersList- List usersusersDetail- Get user detailsuserCreate- Create new usersrolesList- List available roles
Firmware Management
deviceFirmwareDetail- Get firmware informationdeviceFirmwareUpdateRequest- Request firmware updatesdeviceFirmwareUpdateStatus- Check update statusdeviceFirmwareUpdateCancel- Cancel firmware updates
Actions & Recipes
performAction- Perform actions on devicesstartRecipe- Start recipe execution
Authentication
OAuth 2.0 (Recommended for Production)
Include your access token in the Authorization header:
Authorization: Bearer <your-access-token>
Development Mode
For development/testing, bypass authentication:
curl "https://your-server.com/sse?no_auth=true"
OpenAI MCP Usage Examples
Basic Device Listing
resp = client.responses.create(
model="gpt-5",
tools=[{
"type": "mcp",
"server_label": "things5",
"server_url": "https://your-server.com/sse",
"authorization": "Bearer YOUR_TOKEN",
"require_approval": "never",
"allowed_tools": ["devicesList", "deviceDetails"]
}],
input="List all my connected IoT devices"
)
With Selective Approvals
resp = client.responses.create(
model="gpt-5",
tools=[{
"type": "mcp",
"server_label": "things5",
"server_url": "https://your-server.com/sse",
"authorization": "Bearer YOUR_TOKEN",
"require_approval": {
"never": {
"tool_names": ["devicesList", "overviewEvents", "readParameters"]
}
}
}],
input="Show me device status and recent events"
)
Testing
Run All Tests
npm test
Run OpenAI Compatibility Tests
npm run test src/tests/openai-mcp.test.ts
Security & Best Practices
- Always use HTTPS in production
- Configure tool approvals for sensitive operations
- Use
allowed_toolsto limit exposed functionality - Monitor authentication logs
- Validate OAuth tokens regularly
Troubleshooting
Common Issues
- Token Validation Failed: Check token expiry and Keycloak configuration
- CORS Errors: Server has CORS enabled for
*by default - Session Issues: Use proper session ID management for Streamable HTTP
- SSE Connection Problems: Verify WebSocket/SSE support in your environment
Debug Mode
Enable detailed logging:
DEBUG=mcp:*
LOG_LEVEL=debug
License
MIT