Connecting OpenCode to ShortURL MCP
📘 Overview: OpenCode MCP Overview →
You have just used OpenCode to generate a set of video, image, or document links and need to share them with colleagues or send them to a group chat. The original URLs are long and unattractive, and copying and pasting them can easily cause line breaks and formatting issues. After connecting the ShortURL MCP Server, you can have OpenCode shorten all the links into surl.id short links at once, with the results returned directly for you to copy and share.
ShortURL MCP is useful for organizing links to share in OpenCode, replacing links in documents with short links in batches, or standardizing external link formats in published materials. It responds quickly and costs little, making it one of the best services for “trying MCP for the first time.”
¶ Get an API Token
Before using the ShortURL MCP Server, you need to prepare an Ace Data Cloud API Token. OpenCode and Claude Code use the same set of Tokens, and the process for obtaining one is the same:
- Open the Ace Data Cloud Console - Application List and obtain your API Token for later use.
- If you have not logged in or registered, you will be automatically redirected to the login page; after logging in or registering, you will automatically return to the current page.
- Confirm that the key is authorized to access the required interfaces, and check your balance and limits in the console.

A general-purpose application's API Key can be reused within its authorized scope. In documentation and screenshots, it is recommended to show only a masked form, such as YOUR_ACEDATACLOUD_API_KEY. Do not paste the full Token into public repositories, Issues, screenshots, or chat logs.
Want to use Claude Desktop / the Claude.ai web version for one-click OAuth authorization directly? See the ShortURL MCP Claude.ai / Desktop tutorial.
¶ Configure OpenCode
First, run opencode --version. OpenCode 2.x users should set ACEDATACLOUD_API_KEY in the terminal, then run the following commands.
opencode mcp add shorturl --global --url https://shorturl.mcp.acedata.cloud/mcp --header 'Authorization=Bearer {env:ACEDATACLOUD_API_KEY}'
opencode reload
opencode mcp list
¶ OpenCode 1.x Configuration
OpenCode uses a single opencode.json file to describe all MCP Servers. The file can be placed in either of two locations; choose one based on the “scope” below. The field structures are identical in both locations; only the priority differs.
It is strongly recommended to put the Token in an environment variable first:
export ACEDATACLOUD_API_KEY="替换为你的真实 Token"
Then reference it in opencode.json using the {env:ACEDATACLOUD_API_KEY} placeholder to avoid writing the actual Token into the file.
¶ Global: Shared Across All Projects
File location: ~/.config/opencode/opencode.json. Suitable for “my own machine, configured once and available to 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}" }
}
}
}
A Bearer API Key is used here.
"oauth": falsetells OpenCode to send the request header according to this configuration.
¶ Project-Level: Only Applies to the Current Project
File location: opencode.json in the root directory of the current project. For services with the same name, the definition in the project takes priority. Suitable for team sharing, single-repository customization, or temporarily enabling an MCP only in a particular 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, make sure to use the {env:ACEDATACLOUD_API_KEY} placeholder instead of the actual Token to prevent leaks.
Please launch OpenCode from a terminal where the environment variable has been set and exported.
¶ Verify the Connection
After configuration, run:
opencode mcp list
Seeing shorturl connected means the handshake was successful. If it fails, check whether ACEDATACLOUD_API_KEY has been exported, the hosted address, and whether Authorization includes the Bearer prefix. Models and tool Schemas change over time, so please select a model that supports native tool calling from the current catalog.
¶ Typical Scenarios
Once configured, you can call the service directly using natural language in an OpenCode session without first switching to /mcp:
Shorten a Single Link
把这条链接压成短链:https://platform.acedata.cloud
Shorten Links in Batches
把下面 5 条 release notes 链接都压成短链,发出来:
...
Share with Non-Technical Colleagues
把这几个文档链接都缩短,我要发到群里
¶ Tool List
The table below lists commonly used tools. For their full names, see the hosted service's live tool list.
| Tool | Description |
|---|---|
| shorturl_create | Generate a short link |
| shorturl_batch_create | Generate short links in batches |
| shorturl_get_api_info | Get API information |
| shorturl_get_usage_guide | Get the usage guide |
