OpenCode Connection Guide¶
This guide describes how to connect OpenCode to SnatchArr's Model Context Protocol (MCP) server.
Protocol and Transport¶
SnatchArr exposes a native Model Context Protocol server over two transports:
- Streamable HTTP:
http://localhost:8080/api/v1/mcp(sessionless JSON-RPC 2.0). - Subprocess stdio:
snatcharr mcp stdio(ordocker exec -i -e SNATCHARR_URL -e SNATCHARR_API_KEY <container> /snatcharr-api mcp stdiofor container deployments), a thin proxy that delegates to/api/v1/mcpviaSNATCHARR_URLandSNATCHARR_API_KEY.
Authentication and Prerequisites¶
Connecting to SnatchArr requires:
- Enabling the MCP server on the settings page (
/settings) via the Enable MCP server (/api/v1/mcp) toggle. - Generating a scoped bearer API key on the account page (
/account) under the API keys section.
See Module Toggle Switch and Authentication and Permission Scopes for full scope descriptions, challenge behavior, and write-tool activation instructions.
Export the connection environment variables in your shell:
Client Configuration¶
OpenCode supports configuring MCP servers via opencode.json (or opencode.jsonc) or via the opencode mcp CLI.
Option A: Subprocess stdio Transport¶
To compile and install the host snatcharr CLI binary, see Install the proxy.
Configuration File (opencode.json)¶
Add the local proxy server under the mcp key in ~/.config/opencode/opencode.json (global) or opencode.json (workspace):
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"snatcharr": {
"type": "local",
"command": "snatcharr",
"args": ["mcp", "stdio"],
"enabled": true,
"env": {
"SNATCHARR_URL": "http://localhost:8080",
"SNATCHARR_API_KEY": "{env:SNATCHARR_API_KEY}"
}
}
}
}
For containerized deployments:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"snatcharr": {
"type": "local",
"command": "docker",
"args": ["exec", "-i", "-e", "SNATCHARR_URL", "-e", "SNATCHARR_API_KEY", "snatcharr-api", "/snatcharr-api", "mcp", "stdio"],
"enabled": true,
"env": {
"SNATCHARR_URL": "http://localhost:8080",
"SNATCHARR_API_KEY": "{env:SNATCHARR_API_KEY}"
}
}
}
}
CLI Helper¶
Register the stdio server using the CLI:
opencode mcp add snatcharr --command snatcharr --args mcp,stdio --env SNATCHARR_URL="http://localhost:8080" --env SNATCHARR_API_KEY="${SNATCHARR_API_KEY}"
Option B: Streamable HTTP Transport¶
Configuration File (opencode.json)¶
Add the remote server:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"snatcharr": {
"type": "remote",
"url": "http://localhost:8080/api/v1/mcp",
"enabled": true,
"headers": {
"Authorization": "Bearer {env:SNATCHARR_API_KEY}"
}
}
}
}
[!IMPORTANT] OpenCode's
{env:VARIABLE_NAME}syntax interpolates the secret from your environment dynamically at runtime. Never place raw bearer credentials into the JSON configuration file.
CLI Helper¶
Register the remote MCP server using the CLI:
opencode mcp add snatcharr --url http://localhost:8080/api/v1/mcp --header 'Authorization=Bearer {env:SNATCHARR_API_KEY}'
[!IMPORTANT] Single quotes around
'Authorization=Bearer {env:SNATCHARR_API_KEY}'are mandatory. Single quotes protect the{env:...}block from premature shell expansion or brace interpretation, ensuring the literal template string is written toopencode.jsonfor OpenCode to resolve at runtime.
Agent Skills Installation¶
SnatchArr provides an official Agent Skills bundle complying with the agentskills.io standard at skills/snatcharr/ in the repository root (ADR-0021 section 8).
Copy the skill definition into your OpenCode skills directory:
- Global user path:
~/.config/opencode/skills/snatcharr/SKILL.mdor~/.agents/skills/snatcharr/SKILL.md(verified inhttps://opencode.ai/docs/skills) - Workspace project path:
.opencode/skills/snatcharr/SKILL.mdor.agents/skills/snatcharr/SKILL.md(verified inhttps://opencode.ai/docs/skills)
# Global installation
mkdir -p ~/.config/opencode/skills/snatcharr
cp -r skills/snatcharr/* ~/.config/opencode/skills/snatcharr/
# Or workspace installation
mkdir -p .opencode/skills/snatcharr
cp -r skills/snatcharr/* .opencode/skills/snatcharr/
Verification¶
To verify the connection and list available tools:
- Run the CLI tool verification command:
- Confirm that
snatcharrreports an active status and that standard read tools are listed: snatcharr_get_system_statussnatcharr_list_instancessnatcharr_list_runssnatcharr_get_hourly_caps
Official Documentation References¶
- OpenCode MCP Documentation: OpenCode official reference (OpenCode MCP Servers), checked 2026-10-24.
- OpenCode Skills Documentation: OpenCode official reference (OpenCode Skills), checked 2026-10-24.
- SnatchArr Architectural Record: ADR-0021: LLM access module.