Skip to main content

OpenCode with mittwald

OpenCode is a CLI-based AI coding agent that supports OpenAI-compatible providers.

Installation

Follow the OpenCode installation guide to install the CLI tool.

Configuration

OpenCode can be configured globally or per-project:

  • Global: ~/.config/opencode/opencode.json
  • Per-project: opencode.json in the project root

Configuration Example

{
"$schema": "https://opencode.ai/config.json",
"provider": {
"mittwald": {
"npm": "@ai-sdk/openai-compatible",
"name": "mittwald AI",
"options": {
"baseURL": "https://llm.aihosting.mittwald.de/v1",
"apiKey": "sk-..."
},
"models": {
"Ministral-3-14B-Instruct-2512": {
"name": "Ministral-3-14B-Instruct-2512"
}
}
}
}
}

Replace sk-... with your mittwald LLM API key from mStudio profile settings.

Usage

Run OpenCode with natural language commands:

# Database migrations
opencode run "migrate database schema to add user roles table"

# Code optimization
opencode run "optimize the database queries in user_service.py"

# Feature implementation
opencode run "add email validation to the registration form"

MCP Server Integration

OpenCode supports MCP servers through its configuration:

{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@context7/mcp-server", "--stdio"],
"env": { "CONTEXT7_API_KEY": "your-key" }
},
"postgres": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-postgres", "--stdio"],
"env": { "POSTGRES_CONNECTION_STRING": "postgresql://..." }
},
"directus": {
"command": "npx",
"args": ["-y", "@directus/content-mcp", "--stdio"],
"env": {
"DIRECTUS_URL": "https://your-directus-instance.com",
"DIRECTUS_TOKEN": "your-directus-token"
}
},
"opensearch": {
"command": "npx",
"args": ["-y", "@opensearch-project/mcp-server", "--stdio"],
"env": {
"OPENSEARCH_URL": "https://localhost:9200",
"OPENSEARCH_USERNAME": "your-opensearch-username",
"OPENSEARCH_PASSWORD": "your-opensearch-password"
}
},
"solr": {
"command": "uvx",
"args": ["solr-mcp"],
"env": {
"SOLR_URL": "http://localhost:8983/solr"
}
},
"typo3": {
"command": "mw",
"args": [
"app",
"exec",
"--quiet",
"--installation-id=a-XXXXX",
"vendor/bin/typo3 mcp:server"
]
},
"mittwald": {
"transport": {
"type": "sse",
"url": "https://mcp.mittwald.de/mcp"
}
}
}
}

Next Steps