temporal-mcp
Temporal-MCP Server connects AI assistants with Temporal workflows, allowing orchestration of complex backend processes through natural language commands. Its features enable seamless execution and monitoring of tasks, making backend operations more accessible and efficient.
β°π§ Temporal-MCP Server
Temporal MCP is an MCP server that bridges AI assistants (like Claude) and Temporal workflows. It turns complex backend orchestration into simple, chat-driven commands. Imagine triggering stateful processes without writing a line of glue code. Temporal-MCP makes that possible.
Why Temporal MCP
- Supercharged AI β AI assistants gain reliable, long-running workflow superpowers
- Conversational Orchestration β Trigger, monitor, and manage workflows through natural language
- Enterprise-Ready β Leverage Temporal's retries, timeouts, and persistenceβexposed in plain text
β¨ Key Features
- π Automatic Discovery β Explore available workflows and see rich metadata
- πββοΈ Seamless Execution β Kick off complex processes with a single chat message
- π Real-time Monitoring β Follow progress, check status, and get live updates
- β‘ Performance Optimization β Smart caching for instant answers
- π§ AI-Friendly Descriptions β Purpose fields written for both humans and machines
π Getting Started
Prerequisites
- Go 1.21+ β For building and running the MCP server
- Temporal Server β Running locally or remotely (see Temporal docs)
Quick Install
- Run your Temporal server and workers In this example, we'll use the Temporal Money Transfer Demo.
MCP Setup
Get Claude (or similar MCP-enabled AI assistant) talking to your workflows in 5 easy steps:
- Build the server
git clone https://github.com/Mocksi/temporal-mcp.git
cd temporal-mcp
make build
- Define your workflows in
config.yml
The sample configuration (config.sample.yml
) is designed to work with the Temporal Money Transfer Demo:
workflows:
AccountTransferWorkflow:
purpose: "Transfers money between accounts with validation and notification. Handles the happy path scenario where everything works as expected."
input:
type: "TransferInput"
fields:
- from_account: "Source account ID"
- to_account: "Destination account ID"
- amount: "Amount to transfer"
output:
type: "TransferOutput"
description: "Transfer confirmation with charge ID"
taskQueue: "account-transfer-queue"
AccountTransferWorkflowScenarios:
purpose: "Extended account transfer workflow with various scenarios including human approval, recoverable failures, and advanced visibility features."
input:
type: "TransferInput"
fields:
- from_account: "Source account ID"
- to_account: "Destination account ID"
- amount: "Amount to transfer"
- scenario_type: "Type of scenario to execute (human_approval, recoverable_failure, advanced_visibility)"
output:
type: "TransferOutput"
description: "Transfer confirmation with charge ID"
taskQueue: "account-transfer-queue"
- Generate Claude's configuration
cd examples
./generate_claude_config.sh
- Install the configuration
cp examples/claude_config.json ~/Library/Application\ Support/Claude/claude_desktop_config.json
- Start Claude with this configuration
Conversing with Your Workflows
Now for the magic part! Talk to your workflows through Claude using natural language:
π¬ "Claude, can you transfer $100 from account ABC123 to account XYZ789?"
π¬ "What transfer scenarios are available to test?"
π¬ "Execute a transfer that requires human approval for $500 between accounts ABC123 and XYZ789"
π¬ "Has the transfer workflow completed yet?"
π¬ "Run a transfer scenario with recoverable failures to test error handling"
Behind the scenes, Temporal MCP translates these natural language requests into properly formatted workflow executionsβno more complex API calls or parameter formatting!
Core Values
- Clarity First β Use simple, direct language. Avoid jargon.
- Benefit-Driven β Lead with "what's in it for me".
- Concise Power β Less is moreβkeep sentences tight and memorable.
- Personality & Voice β Bold statements, short lines, a dash of excitement.
Ready to Showcase
Lights, camera, actionβcapture your first AI-driven workflow in motion. Share that moment. Inspire others to see Temporal MCP in action.
Development
Project Structure
./
βββ cmd/ # Entry points for executables
βββ internal/ # Internal package code
β βββ api/ # MCP API implementation
β βββ cache/ # Caching layer
β βββ config/ # Configuration management
β βββ temporal/ # Temporal client integration
βββ examples/ # Example configurations and scripts
βββ docs/ # Documentation
Common Commands
Command | Description |
---|---|
make build | Builds the binary in ./bin |
make test | Runs all unit tests |
make fmt | Formats code according to Go standards |
make run | Builds and runs the server |
make clean | Removes build artifacts |
π Troubleshooting
Common Issues
Connection Refused
- β Check if Temporal server is running
- β Verify hostPort is correct in config.yml
Workflow Not Found
- β Ensure workflow is registered in Temporal
- β Check namespace settings in config.yml
Claude Can't See Workflows
- β Verify claude_config.json is in the correct location
- β Restart Claude after configuration changes
βοΈ Configuration
The heart of Temporal MCP is its configuration file, which connects your AI assistants to your workflow engine:
Configuration Architecture
Your config.yml
consists of three key sections:
- π Temporal Connection β How to connect to your Temporal server
- πΎ Cache Settings β Performance optimization for workflow results
- π§ Workflow Definitions β The workflows your AI can discover and use
Example Configuration
The sample configuration is designed to work with the Temporal Money Transfer Demo:
# Temporal server connection details
temporal:
hostPort: "localhost:7233" # Your Temporal server address
namespace: "default" # Temporal namespace
environment: "local" # "local" or "remote"
defaultTaskQueue: "account-transfer-queue" # Default task queue for workflows
# Fine-tune connection behavior
timeout: "5s" # Connection timeout
retryOptions: # Robust retry settings
initialInterval: "100ms" # Start with quick retries
maximumInterval: "10s" # Max wait between retries
maximumAttempts: 5 # Don't try forever
backoffCoefficient: 2.0 # Exponential backoff
# Define AI-discoverable workflows
workflows:
AccountTransferWorkflow:
purpose: "Transfers money between accounts with validation and notification. Handles the happy path scenario where everything works as expected."
workflowIDRecipe: "transfer_{{.from_account}}_{{.to_account}}_{{.amount}}"
input:
type: "TransferInput"
fields:
- from_account: "Source account ID"
- to_account: "Destination account ID"
- amount: "Amount to transfer"
output:
type: "TransferOutput"
description: "Transfer confirmation with charge ID"
taskQueue: "account-transfer-queue"
activities:
- name: "validate"
timeout: "5s"
- name: "withdraw"
timeout: "5s"
- name: "deposit"
timeout: "5s"
- name: "sendNotification"
timeout: "5s"
- name: "undoWithdraw"
timeout: "5s"
π‘ Pro Tip: The sample configuration is pre-configured to work with the Temporal Money Transfer Demo. Use it as a starting point for your own workflows.
π Best Practices
Crafting Perfect Purpose Fields
The purpose
field is your AI assistant's window into understanding what each workflow does. Make it count!
β Do This
- Write clear, detailed descriptions of functionality
- Mention key parameters and how they customize behavior
- Describe expected outputs and their formats
- Note any limitations or constraints
β Avoid This
- Vague descriptions ("Processes data")
- Technical jargon without explanation
- Missing important parameters
- Ignoring error cases or limitations
Before & After
Before: "Gets information about a file."
After: "Retrieves detailed metadata about a file or directory including size, creation time, last modified time, permissions, and type. Performs access validation to ensure the requested file is within allowed directories. Returns formatted JSON with all attributes or an appropriate error message."
Naming Conventions
Item | Convention | Example |
---|---|---|
Workflow IDs | PascalCase | AccountTransferWorkflow |
Parameter names | snake_case | from_account , to_account |
Parameters with units | Include unit | timeout_seconds , amount |
Security Guidelines
β οΈ Important Security Notes:
- Keep credentials out of your configuration files
- Use environment variables for sensitive values
- Consider access controls for workflows with sensitive data
- Validate and sanitize all workflow inputs
π‘ Tip: Create different configurations for development and production environments
Why Good Purpose Fields Matter
- Enhanced AI Understanding - Claude and other AI tools can provide much more accurate and helpful responses when they fully understand the capabilities and limitations of each component
- Fewer Errors - Detailed descriptions reduce the chances of AI systems using components incorrectly
- Improved Debugging - Clear descriptions help identify issues when workflows don't behave as expected
- Better Developer Experience - New team members can understand your system more quickly
- Documentation As Code - Purpose fields serve as living documentation that stays in sync with the codebase
Contribute & Collaborate
We're building this together.
- Share your own workflow configs
- Improve descriptions
- Share your demos (video or GIF) in issues
Let's unleash the power of AI and Temporal together!
π License
This project is licensed under the MIT License - see the LICENSE file for details. Contributions welcome!