> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xhuoapi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# ShortURL MCP Integration Guide

> shorturl MCP 服务器集成

[MCP (Model Context Protocol)](https://modelcontextprotocol.io) is a model context protocol launched by Anthropic that allows AI models (such as Claude, GPT, etc.) to call external tools through a standardized interface. With the ShortURL MCP Server provided by XHuoAPI, you can directly generate short links in AI clients like Claude Desktop, VS Code, Cursor, and more.

## Feature Overview

The ShortURL MCP Server offers the following core features:

* **Single URL Shortening** — Convert long URLs into short, easy-to-share links
* **Batch URL Shortening** — Shorten multiple URLs at once (up to 10)
* **Usage Guide** — Access complete usage instructions and best practices
* **API Information** — View API service details and error code explanations

## Prerequisites

Before use, you need to obtain an XHuoAPI API Token:

1. Register or log in to the [XHuoAPI Platform](https://api.xhuoapi.ai)
2. Go to the [ShortURL API](https://api.xhuoapi.ai/documents/short-url) page
3. Click "Acquire" to get your API Token (free quota granted on first application)

## Installation and Configuration

### Method 1: pip Installation (Recommended)

```bash theme={null}
pip install mcp-shorturl
```

### Method 2: Source Installation

```bash theme={null}
git clone https://github.com/XHuoAPI/ShortURLMCP.git
cd ShortURLMCP
pip install -e .
```

After installation, you can start the service using the `mcp-shorturl` command.

## Using in Claude Desktop

Edit the Claude Desktop configuration file:

* **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
* **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`

Add the following configuration:

```json theme={null}
{
  "mcpServers": {
    "shorturl": {
      "command": "mcp-shorturl",
      "env": {
        "XHuoAPI_API_TOKEN": "your API Token"
      }
    }
  }
}
```

If using `uvx` (no need to pre-install packages):

```json theme={null}
{
  "mcpServers": {
    "shorturl": {
      "command": "uvx",
      "args": ["mcp-shorturl"],
      "env": {
        "XHuoAPI_API_TOKEN": "your API Token"
      }
    }
  }
}
```

Save the configuration and restart Claude Desktop to use ShortURL-related tools in conversations.

## Using in VS Code / Cursor

Create `.vscode/mcp.json` in your project root directory:

```json theme={null}
{
  "servers": {
    "shorturl": {
      "command": "mcp-shorturl",
      "env": {
        "XHuoAPI_API_TOKEN": "your API Token"
      }
    }
  }
}
```

Or use `uvx`:

```json theme={null}
{
  "servers": {
    "shorturl": {
      "command": "uvx",
      "args": ["mcp-shorturl"],
      "env": {
        "XHuoAPI_API_TOKEN": "your API Token"
      }
    }
  }
}
```

## Available Tools

| Tool Name                  | Description                            |
| -------------------------- | -------------------------------------- |
| `shorturl_create`          | Shorten a single URL                   |
| `shorturl_batch_create`    | Batch shorten multiple URLs (up to 10) |
| `shorturl_get_usage_guide` | Get the complete usage guide           |
| `shorturl_get_api_info`    | Get API service details                |

## Usage Examples

After configuration, you can directly invoke these functions in AI clients using natural language, for example:

* "Please shorten this link for me"
* "Batch shorten these 5 URLs"
* "Generate a short link for sharing"

## More Information

* GitHub Repository: [XHuoAPI/ShortURLMCP](https://github.com/XHuoAPI/ShortURLMCP)
* PyPI Package: [mcp-shorturl](https://pypi.org/project/mcp-shorturl/)
* API Documentation: [Short URL Generation API](https://api.xhuoapi.ai/documents/short-url)
