> For the complete documentation index, see [llms.txt](https://www.opencodebook.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.opencodebook.xyz/en/chapter_15_oh-my-opencode_deep_dive/15.8_embedded_mcp_services.md). Agents can also search and read this documentation through its [MCP server](https://www.opencodebook.xyz/~gitbook/mcp).

# 15.8 Embedded MCP Services

> **Model**: claude-opus-4-6 (anthropic/claude-opus-4-6) **Generation Date**: 2026-02-17

***

oh-my-opencode embeds 3 MCP services, providing Agents with out-of-the-box external information retrieval capabilities. These MCP services run in **Remote MCP** mode -- oh-my-opencode does not launch MCP Server processes locally; instead, it connects directly to cloud-based MCP service endpoints.

## 15.8.1 Context7 Integration

Context7 is an MCP service that provides official documentation and code examples for open-source libraries. When the Librarian Agent needs to look up API documentation for a library, it retrieves the latest, structured documentation through Context7.

```typescript
// oh-my-opencode/src/mcp/context7.ts
export const context7 = {
  type: "remote" as const,
  url: "https://mcp.context7.com/mcp",
  enabled: true,
  headers: process.env.CONTEXT7_API_KEY
    ? { Authorization: `Bearer ${process.env.CONTEXT7_API_KEY}` }
    : undefined,
  oauth: false as const,  // Uses API Key, not OAuth
}
```

The configuration is extremely concise -- only a remote URL is needed. If the user has set the `CONTEXT7_API_KEY` environment variable, the authentication information is passed via the Authorization Header; otherwise, anonymous access is used.

Typical tools provided by Context7:

* `resolve-library-id`: Resolves a library name to a Context7-compatible ID
* `query-docs`: Queries documentation and code examples for a library

## 15.8.2 Grep.app Integration

Grep.app is a service for searching public GitHub code repositories. It enables Agents to search for real-world code patterns -- for example, "How do other projects handle JWT authentication?"

```typescript
// oh-my-opencode/src/mcp/grep-app.ts
export const grep_app = {
  type: "remote" as const,
  url: "https://grep.app.context7.com/mcp",
  enabled: true,
  oauth: false as const,
}
```

Grep.app's search differs from GitHub's code search -- it is a **literal code pattern search** (similar to grep), supporting regular expressions and filtering by programming language, repository, and file path.

Typical usage scenarios:

* `searchGitHub("useState(", language=["TypeScript"])`: Search for React useState usage patterns
* `searchGitHub("async function $NAME($$$)", useRegexp=true)`: Search for async function patterns

## 15.8.3 Web Search Integration

Web Search is a general-purpose web search service that uses **Exa** as the default provider and also supports **Tavily**.

```typescript
// oh-my-opencode/src/mcp/websearch.ts
export function createWebsearchConfig(config?: WebsearchConfig): RemoteMcpConfig {
  const provider = config?.provider || "exa"

  if (provider === "tavily") {
    const tavilyKey = process.env.TAVILY_API_KEY
    if (!tavilyKey) {
      throw new Error("TAVILY_API_KEY environment variable is required")
    }
    return {
      type: "remote",
      url: "https://mcp.tavily.com/mcp/",
      enabled: true,
      headers: { Authorization: `Bearer ${tavilyKey}` },
      oauth: false,
    }
  }

  // Default to Exa
  return {
    type: "remote",
    url: process.env.EXA_API_KEY
      ? `https://mcp.exa.ai/mcp?tools=web_search_exa&exaApiKey=${encodeURIComponent(process.env.EXA_API_KEY)}`
      : "https://mcp.exa.ai/mcp?tools=web_search_exa",
    enabled: true,
    ...(process.env.EXA_API_KEY ? { headers: { "x-api-key": process.env.EXA_API_KEY } } : {}),
    oauth: false,
  }
}
```

Supported Web Search configuration:

```jsonc
{
  "websearch": {
    "provider": "exa"     // or "tavily"
  }
}
```

### MCP Registration Entry Point

All three MCP services are registered through a unified entry point:

```typescript
// oh-my-opencode/src/mcp/index.ts
export function createBuiltinMcps(disabledMcps: string[] = [], config?) {
  const mcps: Record<string, RemoteMcpConfig> = {}

  if (!disabledMcps.includes("websearch")) {
    mcps.websearch = createWebsearchConfig(config?.websearch)
  }

  if (!disabledMcps.includes("context7")) {
    mcps.context7 = context7
  }

  if (!disabledMcps.includes("grep_app")) {
    mcps.grep_app = grep_app
  }

  return mcps
}
```

Users can disable any embedded MCP through configuration:

```jsonc
{
  "disabled_mcps": ["websearch"]  // Disable Web Search
}
```

### Design Decision: Why Use Remote MCP?

oh-my-opencode chose the Remote MCP mode over the Stdio MCP mode as a deliberate design decision:

1. **Zero-configuration installation**: Remote MCP does not require installing any local binaries or Node.js modules. A single URL is all that is needed to connect to the service.
2. **No process management**: Stdio MCP requires starting and managing the lifecycle of child processes, including startup, health checks, crash recovery, etc. Remote MCP offloads this complexity to the service provider.
3. **Always up-to-date**: Server-side updates require no action from the client. When Context7 adds support for a new library, all users benefit immediately.
4. **Trade-off**: Requires a network connection and is subject to the service provider's availability and API rate limits.

> **Extended Explanation: Remote MCP vs. Stdio MCP**
>
> MCP (Model Context Protocol) supports two transport modes:
>
> **Stdio MCP**: The MCP Server runs as a local process and communicates with the client via standard input/output (stdin/stdout). The client is responsible for starting the process, sending JSON-RPC messages to stdin, and reading responses from stdout.
>
> ```
> Client ——stdin/stdout——→ Local MCP Server Process
> ```
>
> **Remote MCP (SSE)**: The MCP Server runs on a remote server and communicates with the client via HTTP/SSE (Server-Sent Events). The client sends HTTP POST requests, and the server returns responses via SSE streaming.
>
> ```
> Client ——HTTP/SSE——→ Remote MCP Server (cloud)
> ```
>
> Stdio MCP is suitable for scenarios that require access to local resources (file system, databases); Remote MCP is suitable for pure information query scenarios (documentation search, code search, web search). All three of oh-my-opencode's embedded MCPs fall into the latter category, making Remote MCP the natural choice.

## Section Summary

The 3 embedded MCP services in oh-my-opencode provide Agents with three types of external information retrieval capabilities:

1. **Context7**: Official documentation and code examples for open-source libraries
2. **Grep.app**: Code pattern search across public GitHub repositories
3. **Web Search (Exa/Tavily)**: General-purpose web search

All three use Remote MCP mode, delivering a zero-configuration, zero-installation, out-of-the-box experience. Through the `disabled_mcps` configuration, users can precisely control which services are enabled.

***

## Chapter 15 Summary

This chapter provided a comprehensive analysis of oh-my-opencode's internal architecture. As the most complex third-party Plugin in the OpenCode ecosystem, it demonstrates the full capability boundaries of the Plugin system:

* **11 role-based Agents**, achieving metadata-driven intelligent delegation through dynamic Prompt builders
* **15 custom tools**, from AST search to hashline editing, significantly expanding Agent operational capabilities
* **53 behavioral Hooks**, forming a dense safety net covering context management, error recovery, task continuation, and more
* **20 Feature modules**, encapsulating independent functional domains such as background concurrency, tmux visualization, and state persistence
* **9 Plugin interface implementations**, adapting internal capabilities to OpenCode's interface specification
* **3 embedded MCP services**, providing out-of-the-box external information retrieval

oh-my-opencode's design philosophy can be summarized as: **Agent personification, behavioral defensiveness, composable knowledge, and out-of-the-box experience**. It is not merely a powerful toolset, but a successful practice in AI Agent engineering.
