OpenCode Integration with ShortURL MCP

📘 OverviewOpenCode MCP Overview →

You have just generated a set of video, image, or document links using OpenCode and need to share them with colleagues or post them in a group. The original URLs are long and unattractive, and copying and pasting can easily lead to line breaks and misalignment. After connecting to the ShortURL MCP Server, OpenCode can compress all links into surl.id short links at once, returning the results directly for easy copying and pasting.

ShortURL MCP is suitable for organizing and sharing links in OpenCode, batch replacing document links with short links, or unifying external link formats in published materials. It is fast and cost-effective, making it one of the best services for "experiencing MCP first."

Obtain API Token

Before using the ShortURL MCP Server, you need to prepare an Ace Data Cloud API Token. OpenCode and Claude Code share the same set of tokens, and the acquisition process is the same:

  1. Open the Ace Data Cloud Console - Application List to obtain your API Token for backup.
  2. If you are not logged in or registered, you will be automatically redirected to the login page; after logging in or registering, you will be returned to the current page.
  3. The first application will grant a free quota, allowing you to experience the ShortURL MCP service for free.

One token can be used for all 11 MCP Servers provided by AceData Cloud, and there is no need to apply separately for ShortURL. It is recommended in documents and screenshots to only display a desensitized form, such as 3b78cc40dd3b43db806a4300...., and not to paste the full token into public repositories, issues, screenshots, or chat records.

Want to use Claude Desktop / Claude.ai web version for direct OAuth one-click authorization? Please see the Claude.ai / Desktop tutorial for ShortURL MCP.

Configure OpenCode

OpenCode describes all MCP Servers in a single opencode.json file, which can be placed in two locations; choose one according to the "scope of application" below. The field structure in both locations is exactly the same, with the only difference being priority.

It is strongly recommended to first write the token to an environment variable:

export ACEDATACLOUD_API_KEY="replace with your real token"

Then reference it in opencode.json using the {env:ACEDATACLOUD_API_KEY} placeholder to avoid writing the real token into the file.

Global: Shared by All Projects

File location: ~/.config/opencode/opencode.json, suitable for "my own machine, configured once, usable by all projects."

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "shorturl": {
      "type": "remote",
      "url": "https://shorturl.mcp.acedata.cloud/mcp",
      "enabled": true,
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:ACEDATACLOUD_API_KEY}" }
    }
  }
}

⚠️ "oauth": false cannot be omitted. AceData's MCP Server uses Bearer Token authentication and does not go through the OAuth process; OpenCode will automatically redirect 401 as an OAuth challenge by default, causing opencode mcp list to show SSE error: Non-200 status code (401). Explicitly declaring "oauth": false allows OpenCode to call directly with Authorization: Bearer ..., and opencode mcp debug shorturl will also echo OAuth explicitly disabled, indicating it is effective.

Project Level: Effective Only for Current Project

File location: opencode.json in the current project root directory, which will override the global configuration. Suitable for team sharing, single repository customization, or temporarily enabling a certain MCP in a specific project.

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "shorturl": {
      "type": "remote",
      "url": "https://shorturl.mcp.acedata.cloud/mcp",
      "enabled": true,
      "oauth": false,
      "headers": { "Authorization": "Bearer {env:ACEDATACLOUD_API_KEY}" }
    }
  }
}

If the project-level opencode.json will be committed to Git, please ensure to use the {env:ACEDATACLOUD_API_KEY} placeholder instead of the real token to avoid leakage.

💡 If the .env in Shell is not explicitly exported, you need to use set -a && source .env && set +a to pass the variables to the OpenCode process; otherwise, opencode debug config will show "Authorization": "Bearer " (placeholder not resolved).

Actual Running Results

Below is the desensitized output after actual execution in an isolated temporary directory in OpenCode 1.15.13. The command uses a real AceData Cloud Token, and the token in the output has been replaced with 357265014ad145fc8ab2...., and the temporary configuration has been deleted.

$ opencode --version
1.15.13

$ opencode mcp list

┌  MCP Servers
│
●  ✓ shorturl connected
│      https://shorturl.mcp.acedata.cloud/mcp
│
└  1 server(s)

Seeing ✓ shorturl connected indicates that the ShortURL MCP has been successfully integrated. If it shows or unauthorized, please check whether ACEDATACLOUD_API_KEY is set, whether the token is copied completely, and whether the Authorization prefix is Bearer (pay attention to case and spaces).

To debug the connection details of a specific MCP:

opencode mcp debug shorturl

After a successful handshake, OpenCode's INFO log will output service=mcp key=shorturl transport=StreamableHTTP connected and service=mcp key=shorturl toolCount=4 (tested with 4 tools), indicating that the ShortURL MCP is ready to be called by the model.

🤖 Model Selection Testing Suggestions: To truly allow the model to actively call the ShortURL MCP in OpenCode, please prioritize using OpenAI series models (such as acedatacloud/gpt-5-mini, acedatacloud/gpt-5). When the Claude series models on AceData are exposed through the OpenAI compatible interface, tool calls often return Improperly formed request (tested: acedatacloud/claude-haiku-4-5-20251001, acedatacloud/claude-sonnet-4-6 reported this error when mounting multiple MCPs). Claude models can be used normally when only doing dialogue without calling tools.

Typical Scenarios

After configuration is complete, you can directly call it in the OpenCode session using natural language without switching to /mcp:

Single Shortening

Shorten this link: https://platform.acedata.cloud

Batch Shortening

Shorten the following 5 release notes links and send them out:
...

Sharing with Non-Technical Colleagues

Shorten these document links; I want to send them to the group.

Tool List

The table below lists the main tools (The ShortURL MCP Server has exposed a total of 4 tools, which can be obtained through curl -X POST https://shorturl.mcp.acedata.cloud/mcp -H 'Authorization: Bearer <token>' -H 'Accept: application/json' -H 'Content-Type: application/json' --data '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' to get the complete list):

Tool Description
shorturl_create Generate short link
shorturl_batch_create Batch generate short links
shorturl_get_api_info Get API information
shorturl_get_usage_guide Get usage guide