MeduxMedux
Overview / MCP / OpenCode

Use Medux MCP in OpenCode

Add the Medux-hosted remote MCP server to OpenCode with opencode.json, verify it, and call Medux media tools from your prompts.

How to start

1

Sign in and get your Medux API key. It looks like sk-medux-... — copy it once and store it safely.

2

Add the server under the mcp key in your opencode.json (or opencode.jsonc). OpenCode substitutes {env:NAME}, so the key stays out of the file. Set oauth to false because Medux uses an API key rather than OAuth here.

{ "$schema": "https://opencode.ai/config.json", "mcp": { "medux": { "type": "remote", "url": "https://mcp.medux.io/api/mcp/v1", "enabled": true, "oauth": false, "headers": { "Authorization": "Bearer {env:MEDUX_API_KEY}" } } } }
3

Verify the connection. opencode mcp list shows every MCP server and its status. Then start opencode and ask for a Medux tool.

opencode mcp list
4

Use it from a prompt. Start OpenCode in the folder that holds your files and mention Medux so it picks the right tool.

Use Medux to generate a 1024x1024 image of a red fox in watercolor style.
5

How a call works: OpenCode chooses a medux_* tool and fills in its parameters. For a local file it first calls medux_file_create_upload_url, uploads the file to the returned upload_url with an HTTP PUT (using the returned content_type), then passes the file_id to the tool. Most tools run as async tasks, so it polls medux_task_query with the task_id until the result URL is ready.

6

To find the exact tool for a capability, open Playground, switch to For AI Agents, and read the MCP tab for its mcp_tool_id.

What this means

  • Server not connecting: confirm the entry has "type": "remote" and the full URL, then run opencode mcp list again.
  • OpenCode asks to authenticate: add "oauth": false so it sends your header instead of starting an OAuth flow.
  • 401 Unauthorized: make sure MEDUX_API_KEY is set in the shell that launched opencode.
  • Local-file upload fails: upload URLs expire. Ask the agent to request a new one and send the exact content_type it returns.
  • Insufficient credits: top up or upgrade on the Pricing page. MCP calls use the same credits as the public API.