Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ description: Does something useful
mcp:
server-name:
command: ["npx", "-y", "@some/mcp-server"]
environment:
env:
API_KEY: "${MY_API_KEY}"
---
```
Expand Down Expand Up @@ -151,6 +151,24 @@ mcp:

## Key Implementation Details

### oh-my-opencode Auto-Detection

This plugin automatically disables itself when oh-my-opencode is detected to avoid conflicts (duplicate `skill` and `skill_mcp` tools).

**Detection Logic:**
1. Call `client.config.get()` via the OpenCode SDK to fetch the active config
2. Check if `oh-my-opencode` is in the `plugin` array
3. If found → return empty hooks (plugin does nothing)

**User's Config Setup:**
| Mode | Launch Command | Config File | Plugins |
|------|----------------|-------------|---------|
| Standard | `opencode` | `opencode.json` | `opencode-lazy-loader` (this plugin) |
| OMO | `OPENCODE_CONFIG=~/.config/opencode/omo.json opencode` | `omo.json` | `oh-my-opencode` |

**Developer Override:**
Set `OPENCODE_LAZY_LOADER_FORCE=1` to force-enable the plugin even when oh-my-opencode is detected (for testing).

### Connection Pooling

- Key format: `${sessionID}:${skillName}:${serverName}`
Expand Down
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,42 @@ Invokes an operation on a skill-embedded MCP server.

## Configuration Format

The MCP configuration supports the standard format:
The MCP configuration supports multiple formats for compatibility with both OpenCode and oh-my-opencode:

```typescript
interface McpServerConfig {
command: string | string[]; // Command to execute (array recommended for args)
environment?: Record<string, string> // Environment variables
// Command formats (both supported):
command: string | string[] // Array: ["npx", "-y", "@some/mcp"] or String: "npx"
args?: string[] // Used with string command: ["-y", "@some/mcp"]

// Environment variable formats (both supported):
env?: Record<string, string> | string[] // Object: { "KEY": "val" } or Array: ["KEY=val"]
}
```

### Examples

**Object format for env (recommended):**
```json
{
"my-server": {
"command": "npx",
"args": ["-y", "@some/mcp-server"],
"env": {
"API_KEY": "${MY_API_KEY}",
"DEBUG": "true"
}
}
}
```

**Array format for env (OpenCode style):**
```json
{
"my-server": {
"command": ["npx", "-y", "@some/mcp-server"],
"env": ["API_KEY=${MY_API_KEY}", "DEBUG=true"]
}
}
```

Expand Down
Loading
Loading