Skip to main content

MCP Tools Reference

OpRelay exposes 17 MCP tools organized around collaborative agent work. All tools use project_key scoping and require auth_token when the server has MCP_AUTH_TOKEN set.

Shared State Tools

get_context

Bounded retrieval of facts, decisions, and runs for a project. Use at session start for baton-pass.

{
"project_key": "my-project",
"agent": "claude-code",
"max_facts": 50,
"max_decisions": 20,
"max_runs": 10,
"auth_token": "TOKEN"
}

get_fact

Exact fact lookup by category + key.

{
"project_key": "my-project",
"category": "infra",
"key": "database",
"auth_token": "TOKEN"
}

upsert_fact

Write structured operational state, scoped by project.

{
"project_key": "my-project",
"category": "infra",
"key": "database",
"value_json": "{\"engine\": \"postgres\", \"version\": \"16\"}",
"source": "my-agent",
"confidence": 1.0,
"tags": ["infra", "database"],
"auth_token": "TOKEN"
}
FieldTypeRequiredNotes
project_keystringyesScoping key
categorystringyesDot-separated: infra, stack.server
keystringyesUnique within project+category
value_jsonanyyesString or object — stored as-is
sourcestringnoDefaults to "manual"
confidencenumbernoFloat 0-1, defaults to 1.0
tagsstring[]noDefaults to []
auth_tokenstringyes*Required when MCP_AUTH_TOKEN is set

upsert_decision

Record an engineering decision with rationale.

{
"project_key": "my-project",
"decision_key": "use_advisory_locks",
"summary": "Use Postgres advisory locks for task claiming",
"rationale": "Avoids deadlocks, supports timeout-based contention",
"status": "accepted",
"tags": ["architecture", "core"],
"auth_token": "TOKEN"
}
FieldTypeRequiredNotes
project_keystringyes
decision_keystringyesUnique within project
summarystringyesShort description
rationalestringnoWhy this decision was made
statusstringnodraft, accepted, superseded, rejected
source_ticketstringnoe.g., OPR-1
agentstringnoWho made the decision
tagsstring[]no
auth_tokenstringyes*

record_run

Append an immutable audit trail entry for an agent execution.

{
"project_key": "my-project",
"agent": "claude-code",
"ticket": "OPR-1",
"summary": "Implemented dashboard MVP",
"meta_json": {
"status": "success",
"files_touched": ["dashboard/", "server/src/apiRoutes.ts"],
"git": {
"repo": "oprelay/oprelay",
"branch": "codex/example",
"head_sha": "abc1234",
"pr_number": 42
}
},
"auth_token": "TOKEN"
}
FieldTypeRequiredNotes
project_keystringyes
agentstringyesAgent identifier
ticketstringnoLinear/Jira ticket
summarystringyesWhat was done
meta_jsonobjectnoStructured run metadata
auth_tokenstringyes*

list_projects / list_categories / list_fact_keys

Discovery tools — no write side effects. All require auth_token. list_categories and list_fact_keys also require project_key.

health

Database connectivity check. No auth required.

Coordination Tools

core_register_agent

Agent self-registration with capabilities.

{
"name": "claude-code",
"capabilities": ["code", "review", "test"],
"auth_token": "TOKEN"
}

core_start_run / core_end_run

Run lifecycle with structured outcomes. core_start_run returns a run_id used for all subsequent coordination in that session. core_end_run records the outcome, token usage, and files touched.

core_create_task

Create coordinated work items with optional dependencies.

{
"project_key": "my-project",
"title": "Add user authentication",
"description": "Implement OAuth2 flow",
"priority": "high",
"depends_on": [],
"auth_token": "TOKEN"
}

core_claim_task

Claim a task with advisory-lock contention safety. Only one agent can claim a task at a time.

core_transition_task

Append status transitions: pendingin_progressdone / failed / blocked.

core_update_task

Update task metadata, assignment, and routing.

core_list_tasks

Query tasks with filtering by status, assignee, project, and title search.

core_record_failure

Record structured failure events with context for debugging and recovery.

Common Mistakes

confidence is a number, not a string

BAD:  "confidence": "confirmed"     → validation error
BAD: "confidence": "high" → validation error
GOOD: "confidence": 1.0
GOOD: (omit it — defaults to 1.0)

auth_token goes in arguments AND the header

The Authorization: Bearer header authenticates the HTTP transport. Each tool call also requires auth_token in its arguments. Both are needed.

StreamableHTTP requires a session lifecycle

You cannot fire one-shot HTTP requests. The protocol requires:

  1. initialize → capture Mcp-Session-Id from response headers
  2. notifications/initialized → with session ID header
  3. Tool calls → with session ID header

Accept header must include both content types

BAD:  Accept: application/json
GOOD: Accept: application/json, text/event-stream