OPENCODE_SETUP.md•2.56 kB
# Katamari MCP - OpenCode Integration Setup
## Quick Start
### 1. Start Katamari Server
```bash
cd /projects/katamari-mcp
python -m katamari_mcp.server sse
```
### 2. OpenCode Configuration
The `opencode.jsonc` file is already configured:
```jsonc
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"katamari-sse": {
"type": "remote",
"url": "http://localhost:49152/mcp",
"enabled": true,
"timeout": 10000
}
}
}
```
### 3. Available Tools
- **web_search**: Search the web using DuckDuckGo (no API tokens required)
- **web_scrape**: Extract and convert web content to markdown
### 4. Usage Examples
#### Web Search
```json
{
"name": "web_search",
"arguments": {
"query": "python programming",
"max_results": 5
}
}
```
#### Web Scraping
```json
{
"name": "web_scrape",
"arguments": {
"url": "https://www.python.org"
}
}
```
## Verification
### Test Server Status
```bash
curl -X POST http://localhost:49152/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {}}'
```
### Test Tool Call
```bash
curl -X POST http://localhost:49152/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "web_search", "arguments": {"query": "test"}}}'
```
## Architecture
- **Server**: Katamari MCP running on `localhost:49152`
- **Transport**: Server-Sent Events (SSE) for real-time communication
- **Router**: SimpleRouter - direct mapping of tools to capabilities
- **Capabilities**: Isolated web search and scraping modules
## Features
✅ **Working Components**
- Remote SSE transport
- MCP protocol compliance
- Web search (DuckDuckGo)
- Web scraping with markdown conversion
- Error handling and logging
✅ **OpenCode Ready**
- Configuration file created
- Tools properly formatted for MCP
- Server responds correctly to JSON-RPC requests
## Troubleshooting
### Server Won't Start
```bash
# Check dependencies
poetry install
# Start with specific transport
python -m katamari_mcp.server sse
```
### Connection Issues
- Verify port 49152 is available
- Check firewall settings
- Ensure server is running before testing
### Tool Errors
- Check server logs for error messages
- Verify URL format for web scraping
- Ensure search queries are properly escaped
## Next Steps
The Katamari MVP is now fully integrated with OpenCode and ready for production use. The system provides web search and scraping capabilities through a lightweight, ML-free architecture.