MCP server for Robot configuration management - AI Agent tools for Robot draft/online/template configs
Project description
RobotEditMCP
MCP server for Robot configuration management - AI Agent tools for Robot draft/online/template configs.
Overview
RobotEditMCP provides AI Agents with tools to manage Robot configurations through a Model Context Protocol (MCP) server. It enables operations on draft, online (production), and template configurations with support for complex relationships and batch operations.
Features
- Draft Configuration Management: Create, read, update, delete draft configs
- Online Configuration Management: Manage production environment configs
- Template Management: Save, load, and apply configuration templates
- Conversations Management: Create chat sessions and exchange messages
- Batch Operations: Create interconnected configurations with internal references
- Action Triggering: Execute configuration actions (sync and async)
- Metadata Discovery: Explore scenes, factories, and schemas
- Progressive Disclosure: Tools designed for AI-driven exploration
Installation
Prerequisites
- Python 3.10 or higher
- pip or poetry for package management
Install from source
# Clone the repository
git clone <repository-url>
cd RobotEditMCP
# Install in development mode
pip install -e .
# Or with poetry
poetry install
Configuration
RobotEditMCP requires environment variables for authentication and API access:
Required Environment Variables
Create a .env file in your project root:
# Required - API authentication and endpoint
ROBOT_ADMIN_TOKEN=your_admin_token_here
ROBOT_BASE_URL=https://api.robot.com
# Required - Kubernetes network routing headers
TF_NAMESPACE=staging-tenant
TF_ROBOT_ID=friday
# Optional
ROBOT_LOG_LEVEL=INFO
API_TIMEOUT=30
MAX_CONNECTIONS=10
Environment Variables Reference
| Variable | Required | Description | Default |
|---|---|---|---|
ROBOT_ADMIN_TOKEN |
Yes | Admin API token for authentication (sent in adminToken cookie) |
- |
ROBOT_BASE_URL |
Yes | RobotServer base URL | - |
TF_NAMESPACE |
Yes | Kubernetes namespace for Pod routing (sent in tfNamespace cookie) |
- |
TF_ROBOT_ID |
Yes | Robot instance identifier for K8s service discovery (sent in tfRobotId cookie) |
- |
ROBOT_LOG_LEVEL |
No | Log level (INFO/ERROR/DEBUG) | INFO |
API_TIMEOUT |
No | API request timeout in seconds | 30 |
MAX_CONNECTIONS |
No | Maximum HTTP connections | 10 |
Kubernetes Architecture Notes
TF_NAMESPACE and TF_ROBOT_ID are essential cookies used in the Kubernetes network layer:
tfNamespace: Identifies the K8s namespace where the Robot pods are deployedtfRobotId: Identifies the specific Robot instance for service discovery and routing
These cookies enable proper network routing in multi-tenant K8s environments, allowing requests to reach the correct Robot pod. They are set on the HTTP client instance and sent with every HTTP request, processed by the Kubernetes network infrastructure (e.g., Ingress, Service Mesh, or custom controllers).
Usage
Running the MCP Server
# Using the installed command
roboteditmcp
# Or directly with Python
python -m roboteditmcp.main
MCP Client Configuration
Add to your Claude Desktop config or MCP client configuration:
{
"mcpServers": {
"robotedit": {
"command": "roboteditmcp",
"env": {
"ROBOT_ADMIN_TOKEN": "your_token_here",
"ROBOT_BASE_URL": "https://api.robot.com",
"TF_NAMESPACE": "staging-tenant",
"TF_ROBOT_ID": "friday"
}
}
}
}
Available Tools
Draft Configuration (9 tools)
- list_drafts - List draft configurations with optional filters
- get_draft - Get detailed information about a single draft
- create_draft - Create a new draft configuration
- update_draft - Update a draft (supports partial updates)
- delete_draft - Delete a draft configuration
- batch_create_drafts - Batch create with internal references
- release_draft - Release all drafts to production
- trigger_draft_action - Trigger an action on a draft
Online Configuration (4 tools)
- list_online_configs - List production environment configs
- get_online_config - Get online configuration details
- get_online_action_detail - Get action details (Online only)
- trigger_online_action - Trigger an action (supports async)
Template Management (5 tools)
- list_templates - List available templates (paginated)
- get_template - Get template details
- apply_template - Create draft from template
- save_as_template - Save draft as template
- delete_template - Delete a template
Conversations Management (3 tools)
- conversations_create - Create a new chat conversation
- conversations_send_message - Send a message to a conversation
- conversations_get_messages - Get messages and events from a conversation
Metadata Tools (2 tools)
- list_scenes - List all scene types
- list_factories - List factories for a scene
Usage Examples
Exploring the Configuration System
# 1. List available scenes
scenes = list_scenes()
# Returns: ["ROBOT", "LLM", "CHAIN", ...]
# 2. List factories for a scene
factories = list_factories(scene="ROBOT", type="draft")
# Returns: {factory_names: ["RobotBrainDraftSetting", ...]}
Creating a Configuration
# Create a new draft
draft = create_draft(
scene="ROBOT",
name="RobotBrainDraftSetting",
setting_name="My Robot Config",
config={"model": "gpt-4", "temperature": 0.7}
)
Batch Creating with References
# Create multiple interconnected configs
result = batch_create_drafts(drafts=[
{
"temp_id": -1,
"draft": {
"scene": "LLM",
"name": "LLMProviderDraftSetting",
"setting_name": "My GPT",
"config": {"model": "gpt-4"}
}
},
{
"temp_id": -2,
"draft": {
"scene": "ROBOT",
"name": "RobotBrainDraftSetting",
"setting_name": "My Robot",
"config": {
"llm_provider": {"setting_id": -1, "category": "Draft"}
}
}
}
])
Updating and Releasing
# Update configuration (partial)
update_draft(
setting_id=123,
setting_name="My Robot Config (Updated)",
config={"temperature": 0.8} # Only update temperature
)
# Release all drafts to production
release_draft()
Managing Conversations
# Create a new conversation
conversation = conversations_create(title="Customer Support Chat")
# Returns: {conversationId: 7, title: "Customer Support Chat", ...}
# Send a message to the conversation
conversations_send_message(
conversation_id=7,
content="Hello, I need help with my account"
)
# Get messages and events (AI responses are generated asynchronously)
messages = conversations_get_messages(conversation_id=7, count=-10)
# Returns: {cursor: "...", messages: [...], events: [...]}
# Poll for AI response (may need multiple calls if AI is still generating)
response = conversations_get_messages(conversation_id=7)
Architecture
src/roboteditmcp/
├── __init__.py # Package initialization
├── config.py # Configuration management
├── client.py # HTTP API client
├── server.py # MCP server implementation
├── main.py # CLI entry point
├── logging_config.py # Logging setup
├── models/
│ └── __init__.py # Data models
└── tools/
├── __init__.py # Tools registry
├── draft.py # Draft configuration tools
├── online.py # Online configuration tools
├── template.py # Template management tools
├── conversations.py # Conversations management tools
└── metadata.py # Metadata tools
Authentication
RobotEditMCP uses the admin_key header for authentication (consistent with frontend implementation):
headers = {
"admin_key": ROBOT_ADMIN_TOKEN,
"Content-Type": "application/json"
}
Error Handling
All API responses follow the TFSResponse format:
{
"code": 200,
"message": "success",
"data": {...}
}
Errors are raised with detailed messages for debugging.
Development
Running Tests
# Run tests (if available)
pytest tests/
# Or with poetry
poetry run pytest
Code Structure
- client.py: Low-level HTTP client with all API endpoints
- tools/*.py: MCP tool definitions and handlers
- server.py: MCP server orchestration
- config.py: Configuration and validation
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
[Specify your license here]
Support
For issues and questions:
- API Documentation:
/Users/huruize/PycharmProjects/TFRobotServer/tfrobotserver/api/v1/robot_factory/ - Example Configurations:
/Users/huruize/PycharmProjects/RobotEditMCP/机器人配置json.txt
Version History
-
0.1.4 (2025): Add conversations management
- Create and manage chat conversations
- Send messages and retrieve responses
- Support for pagination in message history
-
0.1.3 (2025): Type conversion improvements
- Added setting_id type conversion for string inputs
- Enhanced error handling
-
0.1.0 (2025): Initial release
- Draft, Online, Template configuration management
- Batch operations with references
- Action triggering (sync/async)
- Metadata discovery tools
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file roboteditmcp-0.2.0.tar.gz.
File metadata
- Download URL: roboteditmcp-0.2.0.tar.gz
- Upload date:
- Size: 160.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
467cf9096aff3ed7aa0aed63e1cfdb5cc5d4f78c75eb696fbde30f2843c3324d
|
|
| MD5 |
e769b022bf751c8997eb38ce78b211d6
|
|
| BLAKE2b-256 |
97191f442c1b6e88c47d511511d5a79c65ef02155545cf2e5b27e0155d834d40
|
Provenance
The following attestation bundles were made for roboteditmcp-0.2.0.tar.gz:
Publisher:
publish.yml on hrz394943230/RobotEditMCP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
roboteditmcp-0.2.0.tar.gz -
Subject digest:
467cf9096aff3ed7aa0aed63e1cfdb5cc5d4f78c75eb696fbde30f2843c3324d - Sigstore transparency entry: 1079608170
- Sigstore integration time:
-
Permalink:
hrz394943230/RobotEditMCP@bb378c04cfd9796a542ed5b008ffc4c98e15481e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hrz394943230
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb378c04cfd9796a542ed5b008ffc4c98e15481e -
Trigger Event:
push
-
Statement type:
File details
Details for the file roboteditmcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: roboteditmcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d78ddfa84939b9b197c896958ba7b34dade7acc3642ac93b2411c3e4611c64
|
|
| MD5 |
da80d8f0340403cd5c25df2cc292277f
|
|
| BLAKE2b-256 |
1259da0163dc15e7963cb61eb9b71b4e49a80b876083993aa6e54ed6ae722c36
|
Provenance
The following attestation bundles were made for roboteditmcp-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on hrz394943230/RobotEditMCP
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
roboteditmcp-0.2.0-py3-none-any.whl -
Subject digest:
39d78ddfa84939b9b197c896958ba7b34dade7acc3642ac93b2411c3e4611c64 - Sigstore transparency entry: 1079608216
- Sigstore integration time:
-
Permalink:
hrz394943230/RobotEditMCP@bb378c04cfd9796a542ed5b008ffc4c98e15481e -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/hrz394943230
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@bb378c04cfd9796a542ed5b008ffc4c98e15481e -
Trigger Event:
push
-
Statement type: