OpenCode: OpenCode Custom Tools

Last updated: 2026-08-31

--- title: OpenCode Custom Tools and oh-my-openagent description: Create custom tools to extend OpenCode and explore the oh-my-openagent plugin ecosystem order: 19 lang: en

Custom tools and community plugins let OpenCode's capabilities expand infinitely.

1. What You Will Learn


2. Custom Tool Development

JSON
{
  "mcp": {
    "my-tool": {
      "command": "node",
      "args": ["./tools/my-tool-server.js"]
    }
  }
}

TypeScript MCP Server Template:

TYPESCRIPT
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = new Server(
  { name: "my-tool", version: "1.0.0" },
  { capabilities: { tools: {} } }
);

server.setRequestHandler("tools/list", async () => ({
  tools: [{
    name: "my_custom_tool",
    description: "Custom tool description",
    inputSchema: {
      type: "object",
      properties: { input: { type: "string" } },
      required: ["input"]
    }
  }]
}));

Python MCP Server also supported.


3. oh-my-openagent

oh-my-openagent is the community plugin ecosystem for OpenCode (like oh-my-zsh for Zsh).

BASH
git clone https://github.com/anomalyco/oh-my-openagent ~/.config/opencode/oh-my-openagent

Common plugins:

Plugin Function
git-enhanced Enhanced Git operations
docker-helper Docker container management
code-style Code style checking and auto-fix
test-runner Enhanced test running
doc-generator Auto documentation generation
security-scanner Security vulnerability scanning

4. Community Ecosystem

Project Description
OpenCode Core CLI tool
oh-my-openagent Community plugins
MCP SDK Tool development SDK
CC Switch API config management

❓ FAQ

Q Custom tools vs MCP servers?
A Custom tools are primarily implemented via MCP servers. MCP is the protocol standard; custom tools are the concrete implementation.
Q Is oh-my-openagent safe?
A Community plugins are maintained by open-source contributors. Review code before installing. Test in sandbox environments.

📖 Summary


📝 Exercises

  1. Basic: Install oh-my-openagent and enable a community plugin.

  2. Intermediate: Develop a simple MCP server with a custom tool.

  3. Advanced: Develop a practical custom tool (e.g., project template generator) and share with the community.

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏