Skilllibrary opencode-primitives
Reference for OpenCode's file paths, naming conventions, and configuration primitives that other MCP skills depend on. Use when needing exact paths for OpenCode config files, understanding OpenCode's agent/skill/tool directory structure, or setting up an OpenCode project with MCP support.
git clone https://github.com/merceralex397-collab/skilllibrary
T=$(mktemp -d) && git clone --depth=1 https://github.com/merceralex397-collab/skilllibrary "$T" && mkdir -p ~/.claude/skills && cp -r "$T/07-mcp/opencode-primitives" ~/.claude/skills/merceralex397-collab-skilllibrary-opencode-primitives && rm -rf "$T"
07-mcp/opencode-primitives/SKILL.mdPurpose
Authoritative reference for OpenCode's directory structure, configuration file locations, naming conventions, and the primitives that other MCP skills assume when referencing OpenCode. This is a lookup skill — it provides exact paths and formats rather than procedures.
When to use this skill
- Need exact paths for OpenCode configuration files
- Setting up a project directory for OpenCode with MCP support
- Need to understand OpenCode's agent/skill/command/tool directory structure
- Other skills reference "OpenCode conventions" and you need the specifics
Do not use this skill when
- Connecting an MCP server to OpenCode → use
opencode-bridge - Building an MCP server → use
mcp-development - General MCP onboarding → use
get-started
OpenCode directory structure
project-root/ ├── .opencode/ │ ├── config.json # Project-level OpenCode configuration │ ├── agents/ # Custom agent definitions │ │ └── my-agent.md │ ├── commands/ # Custom slash commands │ │ └── my-command.md │ ├── skills/ # Project-local skills │ │ └── my-skill/ │ │ └── SKILL.md │ └── tools/ # Custom tool definitions │ └── my-tool.md
Configuration file: .opencode/config.json
.opencode/config.jsonPrimary project configuration for OpenCode:
{ "mcpServers": { "server-name": { "command": "node", "args": ["/absolute/path/to/server.js"], "env": { "API_KEY": "value" } } } }
MCP server config fields:
— executable to launch (e.g.,command
,node
,python
)uv
— array of arguments (use absolute paths)args
— environment variables passed to the server processenv
— for remote Streamable HTTP servers (alternative tourl
/command
)args
— HTTP headers for remote serversheaders
Naming conventions
| Entity | Convention | Example |
|---|---|---|
| Agent files | | |
| Skill directories | | |
| Skill entry point | | |
| Command files | | |
| Tool files | | |
| MCP server names | | |
| Config key | | |
Key paths
| Path | Purpose |
|---|---|
| Project MCP server config and settings |
| Custom agent definitions |
| Project-local skill packages |
| Custom slash commands |
| Custom tool definitions |
| Top-level agent instructions (project root) |
MCP integration points
OpenCode connects to MCP servers at startup based on
.opencode/config.json. The integration follows standard MCP protocol:
- Launch: OpenCode starts each configured server as a subprocess (stdio) or connects via URL (HTTP)
- Initialize: Standard MCP
handshake with capability negotiationinitialize - Discover:
to discover available toolstools/list - Use: Agent calls tools during task execution via
tools/call - Shutdown: Clean disconnect when OpenCode exits
Decision rules
- All paths in
should be absolute to avoid working-directory issuesconfig.json - MCP server names in config should be unique kebab-case identifiers
- Skills that reference OpenCode should use the exact paths listed here
- Prefer stdio transport for local MCP servers with OpenCode
Output requirements
This is a reference skill. It produces no artifacts directly — it provides lookup information for other skills and procedures.
Related skills
— connecting MCP servers to OpenCodeopencode-bridge
— general host configuration patternsmcp-host-integration
— initial MCP setup including OpenCodeget-started
Failure handling
- If config file is not found, OpenCode runs without MCP servers — no error, just no tools
- If a server fails to start, OpenCode logs the error and continues with other servers
- If paths are relative, they resolve from OpenCode's working directory (usually project root) — but absolute is safer