npm package: @inswsi/opencode-tools
Description: MCP server providing OpenCode tools - file operations, bash, web search, code search, and more
Latest version: 1.0.0

# opencode-tools-mcp-server

A Model Context Protocol (MCP) server providing comprehensive file operations, bash execution, web search, code search, and more.

## Installation

### Using npx (recommended)

```json
{
  "mcpServers": {
    "opencode-tools": {
      "command": "npx",
      "args": ["-y", "opencode-tools-mcp-server"]
    }
  }
}
```

### Global installation

```bash
npm install -g opencode-tools-mcp-server
```

Then configure:

```json
{
  "mcpServers": {
    "opencode-tools": {
      "command": "opencode-tools"
    }
  }
}
```

## Available Tools

### File Operations
| Tool | Description |
|------|-------------|
| `read` | Read files or directories with pagination support |
| `write` | Write content to files |
| `edit` | Edit files with smart string replacement (9 replacer strategies) |
| `multiedit` | Perform multiple edits in sequence |
| `glob` | Find files using glob patterns |
| `grep` | Search file contents using regex |
| `ls` | List directory contents in tree format |

### Execution
| Tool | Description |
|------|-------------|
| `bash` | Execute shell commands with timeout support |

### Web Operations
| Tool | Description |
|------|-------------|
| `webfetch` | Fetch web content (HTML, Markdown, images) |
| `websearch` | Search the web using Exa API |
| `codesearch` | Search for code examples using Exa API |

### Task Management
| Tool | Description |
|------|-------------|
| `todowrite` | Write/update todo list |
| `todoread` | Read current todo list |
| `task` | Create sub-agent tasks |
| `batch` | Execute multiple tool calls in parallel |

### Other Tools
| Tool | Description |
|------|-------------|
| `apply_patch` | Apply patch files |
| `question` | Ask user questions |
| `lsp` | LSP operations (definition, references, hover, etc.) |
| `set_working_directory` | Set the working directory for file operations |

## Features

### Smart Edit Replacement

The `edit` tool includes 9 intelligent replacement strategies:

1. **SimpleReplacer** - Direct string matching
2. **LineTrimmedReplacer** - Match with trimmed lines
3. **BlockAnchorReplacer** - Match using first/last line anchors with Levenshtein similarity
4. **WhitespaceNormalizedReplacer** - Normalize whitespace for matching
5. **IndentationFlexibleReplacer** - Ignore indentation differences
6. **EscapeNormalizedReplacer** - Handle escape sequences
7. **TrimmedBoundaryReplacer** - Match trimmed boundaries
8. **ContextAwareReplacer** - Use context for matching
9. **MultiOccurrenceReplacer** - Handle multiple occurrences

### File Reading Features

- Automatic binary file detection
- Image and PDF support (returns base64)
- Line truncation for long lines
- Byte limit enforcement
- File suggestions when file not found

### Web Operations

- HTML to Markdown conversion
- Image fetching support
- Configurable timeouts
- Accept header negotiation

## Configuration Example

For Claude Desktop (`claude_desktop_config.json`):

```json
{
  "mcpServers": {
    "opencode": {
      "command": "npx",
      "args": ["-y", "opencode-mcp-server"]
    }
  }
}
```

For other MCP clients, adjust the configuration accordingly.

## Requirements

- Node.js >= 18.0.0

## License

MIT