Skip to main content
Glama

opencode-router-mcp

Cost-aware, multimodal OpenCode task router and sub-agent MCP server for Claude Code.

This is a Windows-first optional OpenCode execution channel for Claude Code, based on the intended refactoring of AlaeddineMessadi/opencode-mcp. Claude remains the primary agent and may work natively or use Claude subagents; this MCP only manages OpenCode after Claude has selected that path. It exposes only seven compact high-level tools: opencode_delegate, opencode_status, opencode_review, opencode_revise, opencode_abort, opencode_models, and opencode_usage.

Run

Requires Node.js 20+ and an OpenCode installation on PATH. Start over stdio with node src/server.mjs. The repository includes .mcp.json for Claude Code; update its absolute paths if the project is moved.

Run npm run models:refresh after OpenCode Go is configured. Model IDs are read from opencode models; this project never guesses IDs from display names. The registry remains empty when OpenCode is unavailable. npm run models:probe-vision reports whether a real probe was possible; it never fabricates success.

The router defaults to run for cheap/balanced tasks and session for powerful tasks after Claude has already selected OpenCode. mode: auto only chooses one-shot versus persistent OpenCode execution; it never chooses Claude or a Claude subagent. It retries/fails over transient model errors within a tier, disables a provider after shared quota errors, and only upgrades capability when explicitly allowed. Provider remaining quota is always reported as unknown; local usage is estimated only.

Related MCP server: Clanker

Security

Directories and attachments must be absolute and existing. System roots, secrets, credential files, unsupported MIME extensions, oversized files, and more than five attachments are rejected. OpenCode should be configured to listen on localhost only. No global unrestricted permissions, raw shell tool, session sharing, or secret-bearing configuration is provided.

Development

npm run build, npm test, npm run test:skill, npm run test:security, npm run test:failover, npm run test:smoke, npm run test:e2e, and npm run test:closed-loop are the local verification commands. npm run test:opencode-free performs a real, read-only smoke test using a discovered model whose ID is explicitly marked free; it never selects an unmarked model. npm run test:vision reports SKIPPED when no verified image model exists. See docs/ and .claude/skills/opencode-use/ for routing guidance. No commits or pushes are performed automatically.

Available Tools

7 tools
opencode_abortB
DestructiveIdempotent

Abort an existing OpenCode session.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdNo

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already disclose destructive and idempotent behavior, and the description does not contradict them. However, the description adds minimal context beyond 'existing' — it does not mention what happens to the session, whether work is saved, or any side effects. With annotations covering the safety profile, the thin description is acceptable but adds little.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no unnecessary words. It is perfectly concise for a simple abort operation.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite the tool's simplicity, the description omits critical context: what happens upon abort, reversibility, return value/confirmation, and how to source the sessionId. The destructive annotation does not compensate for the missing usage and parameter semantics.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and sessionId is not explained in the description. The description implies a session must exist but does not clarify how to identify or obtain the sessionId. With a single parameter, a small hint is present but not enough for confident invocation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Abort') and resource ('OpenCode session'), clearly distinguishing it from sibling tools like status, review, delegate, and revise. The word 'existing' adds a necessary qualifier that it targets live sessions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no guidance on when to use this tool versus alternatives, no mention of prerequisites (e.g., session must be active), and no indication of when aborting is appropriate. The description simply states what it does, leaving the agent to infer usage.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

opencode_delegateB
Destructive

Execute a task only after Claude has chosen the OpenCode path; mode auto chooses run or session inside OpenCode and never chooses Claude or a Claude subagent.

ParametersJSON Schema
NameRequiredDescriptionDefault
modeNo
taskNo
testsNo
maxTierNo
freeOnlyNo
directoryNo
acceptanceNo
complexityNo
attachmentsNo
allowedFilesNo
forbiddenFilesNo
allowTierUpgradeNo
allowConfigChangesNo
allowDependencyInstallNo

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate mutating, destructive, open-world behavior, so the description's added behavioral insight is limited to the mode auto choosing between run and session and never selecting Claude. That is useful but minimal. The description does not mention other behavioral aspects like potential dependency installation or config changes, even though parameters exist for those.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no waste, covering the main purpose and a key behavioral detail. The phrasing 'only after Claude has chosen the OpenCode path' is slightly convoluted, but overall it is concise and front-loaded with the core action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a 14-parameter tool with no output schema, yet the description covers only mode selection and a usage precondition. It lacks any information about return values, parameter meanings, or example usage. The annotations help with safety expectations but not with how to properly delegate tasks, making the description inadequate for its complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 14 parameters and 0% schema description coverage, the description carries a heavy burden but only explains the 'mode' parameter partially (auto chooses run/session). It provides no guidance on critical parameters like task, tests, maxTier, or allowedFiles, leaving the agent unable to correctly construct a call without external knowledge.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool executes a task ('Execute a task') and clearly distinguishes it from sibling OpenCode tools by being the delegation/execution tool, not a status or review tool. The mode auto behavior further clarifies its role. However, the phrase 'only after Claude has chosen the OpenCode path' is a usage condition rather than a core function statement, making the purpose slightly less crisp.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly says to use it 'only after Claude has chosen the OpenCode path,' providing a clear when-to-use condition. It also excludes alternatives by stating mode 'never chooses Claude or a Claude subagent,' indicating this tool is for OpenCode delegation, not Claude. It doesn't name specific sibling tools as alternatives, but the exclusion is clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

opencode_modelsB
Read-onlyIdempotent

List discovered verified OpenCode models.

ParametersJSON Schema
NameRequiredDescriptionDefault
tierNo
modalityNo
providerNo
availabilityNo

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, openWorldHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds 'discovered verified' which gives some context about the scope of the list, but it does not elaborate on what 'discovered' means, whether this reflects live state, or any other behavioral nuances beyond the annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. It clearly states the action and object, achieving maximum conciseness without under-specifying the core purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

There is no output schema, so the description should explain what the tool returns and how parameters affect the result. It does not describe the return format, whether the list is complete or filtered by default, or the meaning of 'discovered verified.' This leaves a significant gap in an agent's understanding.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description provides no information about the parameters (tier, modality, provider, availability). The description fails to compensate for the lack of schema documentation, leaving the agent to guess whether these are filters, required fields, or what values they accept.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the specific verb 'List' and clearly identifies the resource as 'discovered verified OpenCode models.' It distinguishes the tool from siblings like opencode_delegate and opencode_status, which perform different actions on models.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for listing models, but provides no explicit guidance on when to use this tool versus alternatives, no prerequisites, and no exclusions. The sibling tools are clearly different in function, so the need for this tool is implicitly clear, but explicit guidance is absent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

opencode_reviewB
Read-onlyIdempotent

Get compact file/test review for an existing OpenCode session.

ParametersJSON Schema
NameRequiredDescriptionDefault
detailedNo
sessionIdNo

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false, covering the safety profile. The description adds context about the 'compact' nature of the review and the requirement of an existing session, which provides some behavioral detail without contradicting annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence that gets straight to the action with no filler. It is concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (2 params, no output schema) and strong annotations, the description is minimally adequate. However, it leaves questions about parameter usage and the exact nature of the review output, making it not fully complete for an agent to confidently invoke.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, and the description does not explain the 'detailed' boolean or the optional 'sessionId' parameter. While parameter names are somewhat self-explanatory, the description fails to clarify whether sessionId is required (despite the schema showing 0 required) and what 'detailed' does beyond the implicit contrast with 'compact'.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Get') and resource ('compact file/test review'), and it implicitly distinguishes itself from siblings like opencode_status or opencode_revise by focusing on review output. However, it does not explicitly name alternatives or compare to them.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'for an existing OpenCode session' provides a clear context that the session must already exist, implying this tool is not for creation. However, there is no explicit guidance on when to use this over siblings, nor any when-not-to-use exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

opencode_reviseB
Destructive

Continue an existing OpenCode session with a revision instruction.

ParametersJSON Schema
NameRequiredDescriptionDefault
sessionIdNo
acceptanceNo
instructionNo
allowTierUpgradeNo
allowModelFailoverNo

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already indicate destructive and non-read-only behavior. The description adds no additional behavioral context such as side effects, cost, or what the revision instruction triggers. It merely restates the operation without disclosing consequences.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is one concise sentence, front-loaded with the action verb. No filler words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 5 parameters and no output schema or parameter descriptions. The single-sentence description only captures the core purpose, leaving parameter behavior, return value, and prerequisites undocumented, which is insufficient for reliable invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 5 parameters with 0% description coverage. The description does not explain the purpose of sessionId, acceptance, allowTierUpgrade, or allowModelFailover. Only 'revision instruction' hints at the instruction parameter, but no parameter semantics are provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Continue') and resource ('existing OpenCode session') with a clear qualifier ('with a revision instruction'). This distinguishes it from sibling tools like opencode_status, opencode_review, and opencode_abort.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage when an existing session needs revision, but does not explicitly contrast with siblings like opencode_review or opencode_abort. The context is clear for continuing a session, but no exclusions or alternative tool references are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

opencode_statusA
Read-onlyIdempotent

Get compact status for an existing OpenCode session.

ParametersJSON Schema
NameRequiredDescriptionDefault
detailedNo
directoryNo
sessionIdNo

TDQS

A3.5/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare the tool as read-only, idempotent, and non-destructive. The description adds the behavioral detail that the status is 'compact', but it does not elaborate on what the status contains or any side effects. This is consistent with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler. Every word contributes to the meaning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description should explain what the returned status includes, but it only says 'compact status'. It also doesn't clarify how parameters affect the result or how to specify a session. For a tool with three optional parameters, this is insufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%. The description provides no information about the 'detailed', 'directory', or 'sessionId' parameters. Parameter names are somewhat self-explanatory, but the description does not compensate for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and the resource 'compact status for an existing OpenCode session', making it distinct from sibling tools like opencode_usage or opencode_review. It specifies the scope and output type.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The phrase 'for an existing OpenCode session' implies the tool is for checking status of already-running sessions, but it does not explicitly discuss when to use this tool over alternatives such as opencode_usage. No exclusions or alternative recommendations are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

opencode_usageA
Read-onlyIdempotent

Get compact local OpenCode usage estimates.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint and idempotentHint, covering the safety profile. The description adds 'compact' and 'local' as context but does not detail the return format or what 'usage' specifically measures. No contradictions found.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that directly states the tool's purpose without unnecessary words. It is appropriately sized for the tool's simplicity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter read-only tool with helpful annotations, the description is mostly sufficient. However, the term 'usage estimates' is somewhat ambiguous without an output schema, so adding units or scope would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so the baseline is 4. The description adds no parameter info, but none is needed since there are no parameters to explain.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb 'Get' and a resource 'OpenCode usage estimates' with modifiers 'compact local', making the tool's purpose clear. It is distinct from sibling tools like opencode_status or opencode_models.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There are no explicit exclusions, prerequisites, or references to sibling tools for comparison.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 7 tool updatesv0.1.0
    • First observedopencode_abort
    • First observedopencode_delegate
    • First observedopencode_models
    • First observedopencode_review
    • First observedopencode_revise
    • First observedopencode_status
    • First observedopencode_usage

TDQS

A3.8/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: delegate starts a task, status/review/revise/abort manage sessions, models lists models, and usage reports usage. No two tools overlap in function, making selection unambiguous.

Naming Consistency4/5

All tools share the 'opencode_' prefix, creating a predictable pattern. However, the second part mixes verbs (delegate, revise, abort) with nouns (status, models, usage), which is a minor inconsistency but still readable and navigable.

Tool Count5/5

With 7 tools, the server is well-scoped for its purpose of routing tasks to OpenCode and managing sessions. Each tool fills a necessary role without redundancy.

Completeness5/5

The tool surface covers the full session lifecycle: create (delegate), read (status, review), update (revise), and delete (abort). It also includes auxiliary queries (models, usage) that round out the domain without leaving obvious dead ends.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zhouqingweidev-ops/opencode-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server