Skip to content

MCP Clients Integration

Moira works with any client that supports the Model Context Protocol (MCP). This guide covers setup for commonly used MCP clients.

MCP Protocol Overview

Moira exposes tools through MCP Streamable HTTP:

  • Endpoint: https://moira-mcp.com/mcp
  • Transport: Streamable HTTP; successful responses may use SSE streaming
  • Authentication: OAuth 2.1 or API Token

Client Configuration

Recommended: Use CLI command

Terminal
claude mcp add --transport http moira https://moira-mcp.com/mcp

Then authenticate:

OAuth Flow
# After adding, authenticate within claude
/mcp
# → Select "moira"
# → Click "Authenticate"
# → Browser opens for OAuth
Alternative: Manual JSON config
{
  "mcpServers": {
    "moira": {
      "url": "https://moira-mcp.com/mcp"
    }
  }
}
Authentication without OAuth

For CI/CD, Docker, or environments without a browser — use an API token instead of OAuth.

1. Log in to Moira web UI → Settings → API Tokens
2. Create a token (starts with moira_)
3. Replace moira_YOUR_TOKEN below with your token
~/.config/claude/mcp.json
{
  "mcpServers": {
    "moira": {
      "url": "https://moira-mcp.com/mcp",
      "headers": {
        "Authorization": "Bearer moira_YOUR_TOKEN"
      }
    }
  }
}

Custom Client

For custom MCP client implementations, use the MCP SDK with URL: https://moira-mcp.com/mcp

Available Tools

The core lifecycle is liststart prepare → start execute → repeated step calls, with session for inspecting or resuming executions and help for runtime documentation. The MCP tools reference is the source for the complete current catalog, exact input schemas, actions, and examples.

Authentication

Moira supports two authentication methods:

OAuth 2.1 (Default)

  1. Client initiates connection to MCP endpoint 2. Server returns authentication required response
  2. Client opens browser for OAuth flow 4. User authenticates with Moira 5. Client receives access token 6. Subsequent requests include token

OAuth token refresh is handled automatically and preserves the catalog state accepted by the previous access token. Catalog refresh after a server contract change is a separate MCP initialization step described below. If the credential expires, re-authentication may be required.

API Tokens

For MCP clients that do not support OAuth (custom scripts, CI/CD pipelines, headless environments), use API tokens:

  1. Log in to Moira web UI 2. Go to Settings → API Tokens 3. Click Create Token, enter a name and expiration 4. Copy the token (shown once, starts with moira_) 5. Configure your client with the token as Bearer authorization

Example configuration for a custom MCP client:

{
"mcpServers": {
"moira": {
"url": "YOUR_MCP_ENDPOINT",
"headers": {
"Authorization": "Bearer moira_your_token_here"
}
}
}
}

Replace YOUR_MCP_ENDPOINT with your Moira MCP endpoint: https://moira-mcp.com/mcp. API tokens skip the OAuth flow entirely — use them when your client cannot open a browser for authentication.

Static Catalog Refresh

Tool descriptions and schemas are a static catalog shipped with the Moira server. A client accepts that catalog during the MCP initialize handshake. This applies to both OAuth access tokens and API tokens.

When the catalog changes, an ordinary request made with a credential that has not initialized the current catalog returns HTTP 426 with upgrade_required. Reconnect or reinitialize the MCP server with the same credential. A successful initialize refreshes the catalog for that credential; it does not require a new API token. OAuth access tokens may rotate independently during automatic refresh without losing their current, stale, or uninitialized catalog state.

Authentication and account checks run before catalog refresh. A revoked or expired credential, or an account that cannot access MCP, still receives its normal authentication or access error.

Tool Call Examples

List Workflows

{
"method": "tools/call",
"params": {
"name": "list",
"arguments": {}
}
}

Prepare Workflow Start

{
"method": "tools/call",
"params": {
"name": "start",
"arguments": {
"action": "prepare",
"workflowId": "moira/software-development-flow",
"parentExecutionId": "none"
}
}
}

Preparation returns a startAttemptId without creating an execution. Execute it in a second call:

{
"method": "tools/call",
"params": {
"name": "start",
"arguments": {
"action": "execute",
"startAttemptId": "start-attempt-current"
}
}
}

Execute Step

{
"method": "tools/call",
"params": {
"name": "step",
"arguments": {
"processId": "abc-123",
"attemptId": "attempt-current",
"input": {
"result": "Task completed successfully",
"details": { "files": ["main.ts", "utils.ts"] }
}
}
}
}

Error Handling

Common error responses:

ErrorCauseSolution
UNAUTHORIZEDInvalid/expired tokenRe-authenticate
NOT_FOUNDInvalid workflow/process IDVerify IDs
FORBIDDENNo access to resourceCheck permissions
upgrade_requiredMCP catalog must be refreshedReconnect using the same credential
VALIDATION_ERRORInvalid inputCheck input schema
ATTEMPT_PROCESSINGDuplicate still executingRetry the same attempt and input
ATTEMPT_STALEPresentation is no longer currentRead current_step and retry once
ATTEMPT_CONFLICTAttempt is bound to other inputRead current_step; discard old input
ATTEMPT_INVALID_OR_EXPIRED (step)Attempt is unavailableRead current_step; discard attempt
ATTEMPT_OUTCOME_UNKNOWNEffect may have occurredInspect the returned Process ID

Self-Hosted Setup

For self-hosted Moira:

  1. Deploy Moira server
  2. Configure MCP endpoint URL
  3. Set up authentication and account access
  4. Update client configuration with your endpoint

Troubleshooting

Connection Timeout

  • Check network connectivity
  • Verify endpoint URL
  • Ensure SSE is not blocked by firewall

Tools Not Appearing

  • Reconnect the Moira MCP server so the client runs initialize again
  • Keep the existing OAuth or API-token credential unless it is invalid or expired
  • Verify JSON syntax in config
  • Check client logs for errors

Authentication Loop

  • Clear stored tokens
  • Check OAuth configuration
  • Verify redirect URIs