Skip to main content
SendURL, home
Link trackingBy MikeUpdated First published 20 min read

MCP Server Setup for Claude, ChatGPT and Cursor

Part of the Link tracking handbook

Step-by-step set-up of the SendURL MCP server in claude.ai, Claude Code, ChatGPT, OpenAI Codex, Cursor, VS Code and any other MCP client. Sign in with OAuth or use an API key with only the permissions it needs, then test it with one prompt.

The SendURL MCP server lets an AI assistant create and manage your short links and read their clicks. It runs at one address, https://api.sendurl.to/mcp, on every plan, Free included, and there is nothing to install. This guide connects it to each major client, one section per client, then gives a prompt to test it and the fixes for the usual problems.

Jump to your client:

What the server can do, tool by tool, is on the MCP server page, and the reference is in the API docs.

Before you start

You need a SendURL account; sign up free if you don't have one. Then choose how the assistant gets in:

  • Sign in (OAuth). claude.ai, ChatGPT, Claude Code, Codex, Cursor and VS Code open a SendURL page in your browser. No key is created or pasted.
  • An API key. For Claude Code, Codex, Cursor, VS Code, scripts and any client that sends a header: Authorization: Bearer snu_…. ChatGPT only signs in, and on claude.ai sign in too. Keep the key in an environment variable, never in a file you share or commit.

What the SendURL page asks

Every sign-in ends on the same page, in the SendURL console:

  1. At the top, the page shows the address the app connects from, with a Verified label when SendURL has checked the app, as for claude.ai. The heading names the app: "Allow Claude to access your SendURL workspace?", and the line under it says where your browser goes back to: "You'll be sent back to claude.ai."
  2. Under Workspace, pick the workspace if you have more than one. Only its owner or an admin can connect an app.
  3. Under This app will be able to, the permissions the app asked for are grouped into View, Create and edit and Delete, and every one is ticked. Untick any you don't want it to have; at least one must stay. To stop an assistant deleting links, untick Delete links, under Delete (deleted links can't be restored).
  4. Choose Allow. Your browser goes back to the app, which is now connected. Deny cancels.

The page adds a note when SendURL can't vouch for the app: "Unverified app" for an app that registered itself, which SendURL hasn't checked, and a red warning when the app's name looks like a well-known brand but the app isn't hosted by that brand, the usual sign of a copycat. Continue only if you started the connection yourself and the line "You'll be sent back to …" names the app you use. Cursor's own app shows both notes, as expected: see Cursor.

The app then shows under Connected apps on the console's API keys page. To cut it off, choose the app to open its details, then Disconnect, and Disconnect again to confirm; its next call is refused. A connection left unused for 30 days has to sign in again.

Create an API key with limited permissions

An assistant rarely needs everything. To give it only what it needs:

  1. Open API keys in the console and choose New key.
  2. Under Name, name it after the assistant, for example "Claude". Under Access, keep All folders or pick one folder; under Expires, pick when it stops working.
  3. Under Permissions, choose Custom and tick only what it needs. For a read-and-create assistant: Read links, Create and edit links, Read analytics and Read workspace. Leave Delete links unticked.
  4. Choose Create key, then Copy, and store the key as SENDURL_API_KEY in your shell or your client's secret store. Choose Done.
New key with Custom permissions

The key then shows in the list with its permissions, and you can copy it again or revoke it there.

The new key in the list
PermissionLets the assistant
Read links (links:read)List and view links, their daily stats and their clicks one by one
Create and edit links (links:write)Create links, change them, pick an A/B test winner
Delete links (links:delete)Delete links (paid plans)
Read analytics (analytics:read)Overview, breakdowns and clicks across links
Read workspace (workspace:read)Account, folders, tags and domains
Create folders (folders:write)Create new folders
Keep the key in your shell (bash or zsh)Shell
read -rs SENDURL_API_KEY && export SENDURL_API_KEY

Paste the key when the terminal waits (nothing shows as you paste), then press Enter. read -s takes the key from the keyboard, so it never appears in a command and never lands in your shell history; don't type export SENDURL_API_KEY="snu_…", which does. The variable lasts for that terminal. To have it in every terminal, keep the key in a password manager or your system keychain and load it from your shell profile; on macOS, store it once with security add-generic-password -a "$USER" -s sendurl-api-key -w (it asks for the key) and add export SENDURL_API_KEY="$(security find-generic-password -s sendurl-api-key -w)" to ~/.zshrc.

Test it

Every section below ends with the same check. Ask your assistant:

Text
Shorten https://example.com and show me its clicks.

It should call create_link, give you a snu.to short link, then call get_link or get_link_stats and report zero clicks so far. Open the short link once and ask again: the count goes up.

claude.ai and Claude Desktop

Custom connectors depend on your Claude plan. The same connector shows in claude.ai and the Claude desktop app.

  1. Open Customize → Connectors, choose + Add, then Add custom connector.
  2. Name it SendURL and paste the server URL: https://api.sendurl.to/mcp. Choose Continue.
  3. If Claude shows advanced settings, keep the sign-in it detects and leave any request headers empty, then add the connector.
  4. Choose Connect. The SendURL page opens: sign in, choose the permissions and choose Allow (what the page asks).
  5. In a chat, choose + at the bottom left, then Connectors, and turn SendURL on.

Don't put an API key in the connector's request headers: Claude would keep it, and on Claude Team and Enterprise every member would share it. Sign in instead.

On Claude Team and Enterprise: an owner adds the connector first, in Organization settings → Connectors → Add, then Custom → Web, with the same URL. Each member then finds it under Customize → Connectors and chooses Connect to sign in.

Test it: ask "Shorten https://example.com and show me its clicks." Claude asks for your approval before it runs a tool, unless you allowed it.

Troubleshooting

  • The connector says it can't reach the server. Paste the URL exactly, https://api.sendurl.to/mcp, with the /mcp path.
  • The sign-in page says you can't approve. Only the workspace owner or an admin can approve a connection.
  • A tool is missing. Its permission was unticked when you approved. Remove the connector and add it again to choose again.

Claude Code

Add the server once, from your terminal:

Add the SendURL MCP serverShell
claude mcp add --transport http sendurl https://api.sendurl.to/mcp

Then sign in from your shell:

Sign in to SendURL from Claude CodeShell
claude mcp login sendurl

Your browser opens the SendURL sign-in; approve, and Claude Code stores and refreshes the token for you. Or run /mcp inside Claude Code and follow the steps in your browser.

Add --scope user to use SendURL in every project. To share the connection with your team through the repository's .mcp.json, add --scope project to the first claude mcp add command above, the sign-in command (no --header); each person then signs in.

With an API key instead: send it as a header. The command names the variable, not the key, so the key stays out of your shell history as long as you set the variable as above.

Add the server with an API keyShell
claude mcp add --transport http sendurl https://api.sendurl.to/mcp \
  --header "Authorization: Bearer $SENDURL_API_KEY"

Your shell fills in the key before Claude Code runs, so Claude Code saves the key itself, in your own settings. Keep this command for yourself, with the default scope or --scope user: never with --scope project, which would write your key into .mcp.json, where the next commit shares it.

To share a key-based connection, write .mcp.json at the root of the repository by hand, with the variable instead of the key. Claude Code reads ${SENDURL_API_KEY} from each person's environment when it connects, so the file holds no key and is safe to commit:

.mcp.jsonJSON
{
  "mcpServers": {
    "sendurl": {
      "type": "http",
      "url": "https://api.sendurl.to/mcp",
      "headers": { "Authorization": "Bearer ${SENDURL_API_KEY}" }
    }
  }
}

Each person sets SENDURL_API_KEY to their own key, and Claude Code asks once before it uses a server from a project's .mcp.json.

Test it: ask "Shorten https://example.com and show me its clicks."

Troubleshooting

  • The server shows as failed although you passed a key. Claude Code doesn't fall back to a sign-in when the server refuses a configured Authorization header. Run claude mcp list to see the error, check the key starts with snu_ and isn't revoked, and that $SENDURL_API_KEY was set when you ran the command; then claude mcp remove sendurl and add it again.
  • The server needs sign-in again. Run claude mcp login sendurl.
  • A tool is missing. Its permission was unticked when you approved. Disconnect the app under Connected apps and run claude mcp login sendurl again to choose again.

ChatGPT

ChatGPT connects to the SendURL MCP server with a sign-in (it doesn't send API keys). Custom MCP servers depend on your ChatGPT plan; on a Business or Enterprise workspace, an admin may need to allow them.

  1. Open ChatGPT's settings for apps and connectors and choose to add a custom MCP server. (The menu's name depends on your plan and changes often; on some workspaces an admin must allow custom servers first.)
  2. Name it SendURL and paste the server URL https://api.sendurl.to/mcp.
  3. For authentication, choose OAuth.
  4. Confirm ChatGPT's warning about custom servers and create it.
  5. Sign in to SendURL when asked, choose the permissions and choose Allow.
  6. In a chat, pick SendURL from the tools menu or by typing @.

Test it: ask "Shorten https://example.com and show me its clicks." ChatGPT asks you to confirm before a tool that writes, such as create_link.

Troubleshooting

  • New tools don't show. Open the server's settings in ChatGPT and refresh its tools.
  • You can't find where to add a custom MCP server. Your plan or workspace doesn't allow custom MCP servers; ask your admin.
  • ChatGPT asks for an API key. Choose OAuth instead; ChatGPT can't send a SendURL key.

OpenAI Codex CLI

Add SendURL to ~/.codex/config.toml. A project's .codex/config.toml works too, but Codex reads it only in a project you trust.

~/.codex/config.tomlTOML
[mcp_servers.sendurl]
url = "https://api.sendurl.to/mcp"

Then sign in:

Sign in to SendURL from CodexShell
codex mcp login sendurl

Your browser opens the SendURL page; choose the permissions and choose Allow.

With an API key instead: add bearer_token_env_var, and Codex sends Authorization: Bearer and the value of SENDURL_API_KEY:

~/.codex/config.toml (with an API key)TOML
[mcp_servers.sendurl]
url = "https://api.sendurl.to/mcp"
bearer_token_env_var = "SENDURL_API_KEY"

Test it: start codex and ask "Shorten https://example.com and show me its clicks." Type /mcp to see the server and its tools.

Troubleshooting

  • Every call fails with 401. With a key, SENDURL_API_KEY isn't set in the shell that started Codex, or the key was revoked. Signed in, the app was disconnected: run codex mcp login sendurl again.
  • Sign-in can't open a browser (a remote machine): open the address Codex prints in a browser on your own computer.

Cursor

Add SendURL to ~/.cursor/mcp.json (every project) or .cursor/mcp.json (one project):

~/.cursor/mcp.jsonJSON
{
  "mcpServers": {
    "sendurl": {
      "url": "https://api.sendurl.to/mcp"
    }
  }
}

Cursor signs in with OAuth: when Cursor asks you to sign in to the server, your browser opens the SendURL sign-in; sign in, choose the permissions and choose Allow. Manage the server, and sign out, in Cursor's MCP settings.

What the SendURL page shows for Cursor. Expect two notes: "Unverified app", and a red warning that the app's name looks like a well-known brand but isn't hosted by that brand. Both are expected for Cursor's own app. Cursor registers itself with SendURL when it connects, so SendURL can't confirm who made it, and its name is one SendURL warns about whenever it can't confirm the app. For any other app, the same warning is a reason to stop. Before you choose Allow, check the line under the heading: from the Cursor desktop app it reads "You'll be sent back to localhost", and from Cursor on the web "You'll be sent back to www.cursor.com". If it names anything else, or you didn't just connect from Cursor, choose Deny.

With an API key instead: add a header that reads the key from your environment, so it never sits in the file:

~/.cursor/mcp.jsonJSON
{
  "mcpServers": {
    "sendurl": {
      "url": "https://api.sendurl.to/mcp",
      "headers": { "Authorization": "Bearer ${env:SENDURL_API_KEY}" }
    }
  }
}

Write the variable as ${env:SENDURL_API_KEY}, never the key itself: .cursor/mcp.json sits in the project, where a commit would share it.

Test it: in the agent chat, ask "Shorten https://example.com and show me its clicks." Cursor asks before running each tool unless you allow it.

Troubleshooting

  • The sign-in page says you can't approve. Only the workspace owner or an admin can approve a connection.
  • With a key, the server shows no tools. Start Cursor from a shell where SENDURL_API_KEY is set, or put the key in your system environment, then reload the server. Check the key isn't revoked.
  • Something else fails. Open Cursor's MCP logs in the Output panel and look for the connection or authentication error.

VS Code with GitHub Copilot

Add SendURL to .mcp.json at the root of your workspace, or to ~/.copilot/mcp-config.json for every workspace:

.mcp.json (sign in)JSON
{
  "mcpServers": {
    "sendurl": {
      "type": "http",
      "url": "https://api.sendurl.to/mcp"
    }
  }
}

Complete the authorization when VS Code prompts for it: your browser opens the SendURL page, where you choose the permissions and choose Allow. If VS Code doesn't prompt, open the server's actions (MCP: List Servers) and start the sign-in from there. You can also add the server from the Command Palette with MCP: Add Server → HTTP and the URL.

With an API key instead: add a header that names the variable, never the key:

.mcp.jsonJSON
{
  "mcpServers": {
    "sendurl": {
      "type": "http",
      "url": "https://api.sendurl.to/mcp",
      "headers": { "Authorization": "Bearer ${SENDURL_API_KEY}" }
    }
  }
}

In this file, write the variable as ${SENDURL_API_KEY}: VS Code reads it from the environment VS Code runs in (start VS Code from a terminal where it is set). ${env:SENDURL_API_KEY} belongs to the older .vscode/mcp.json format below, and a bare $SENDURL_API_KEY is sent as literal text.

Still on the older .vscode/mcp.json format? It still works; use .mcp.json above for anything new. In .vscode/mcp.json, VS Code can ask for the key once and keep it as a secret:

.vscode/mcp.jsonJSON
{
  "inputs": [
    { "type": "promptString", "id": "sendurl-api-key", "description": "SendURL API key", "password": true }
  ],
  "servers": {
    "sendurl": {
      "type": "http",
      "url": "https://api.sendurl.to/mcp",
      "headers": { "Authorization": "Bearer ${input:sendurl-api-key}" }
    }
  }
}

Test it: open Copilot Chat in agent mode and ask "Shorten https://example.com and show me its clicks." Expand the tool call to see what it sent.

Troubleshooting

  • VS Code asks whether to trust the server. Trusting it lets it start; tool approvals are asked separately.
  • The ${input:…} key isn't used by a Copilot session. Use the .mcp.json format with an environment variable, or sign in.

Any other MCP client

Any client that speaks the MCP Streamable HTTP transport can connect:

SettingValue
Server URLhttps://api.sendurl.to/mcp
TransportStreamable HTTP (stateless, POST only)
Sign-inOAuth 2.1 with PKCE, discovered from the server's 401 answer; the client identifies itself with a client ID metadata document or registers itself (dynamic client registration), and the sign-in must return to an https or localhost address (custom app-link schemes are refused)
Or a headerAuthorization: Bearer snu_… (an API key)

A client that only runs local (stdio) servers can bridge with mcp-remote. First set the whole header value as a variable, from the key you set above:

The header value, from your keyShell
export SENDURL_AUTH="Bearer $SENDURL_API_KEY"

Then add the bridge. The file names the variable, never the key:

A stdio-only clientJSON
{
  "mcpServers": {
    "sendurl": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://api.sendurl.to/mcp", "--header", "Authorization:${SENDURL_AUTH}"]
    }
  }
}

mcp-remote replaces ${SENDURL_AUTH} with the variable from its own environment when it starts, which is the environment your client starts it with. There is no space after Authorization: because some clients (Cursor, Codex CLI and Claude Desktop on Windows, says the mcp-remote README) don't escape spaces inside args when they start npx, which mangles the value; the space inside the variable's value is fine.

The mcp-remote README recommends --header-file for credentials: it keeps the key out of the process arguments, where other users on the machine can read it, and out of your client's config. It also works when a desktop app starts local servers without your shell's environment (then the call fails with 401 and mcp-remote logs Environment variable 'SENDURL_AUTH' not found). Put one header per line in a file only you can read, for example ~/.config/sendurl/headers.txt:

~/.config/sendurl/headers.txtText
Authorization: Bearer <your key>

Run chmod 600 ~/.config/sendurl/headers.txt, then point the bridge at it (use the full path; the config names the file, never the key):

A stdio-only client, with a header fileJSON
{
  "mcpServers": {
    "sendurl": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://api.sendurl.to/mcp", "--header-file", "/Users/you/.config/sendurl/headers.txt"]
    }
  }
}

Keep the header file in your home folder, never in a config file inside a repository or anywhere you share or commit.

Troubleshooting

  • 401 Unauthorized. The key is wrong, revoked or expired, or a console session token was sent (the MCP server takes API keys and sign-ins only).
  • insufficient_scope. The key or the connection lacks the permission that tool needs. With an API key, the tool call returns an error with that code, and requiredScope names the permission; with a sign-in, the server answers 403 and the client can ask you to approve the missing permission. Create a key with it, or reconnect and tick it.
  • 403 from a web page. The server refuses requests from browsers; call it from a server or a desktop client.
  • plan_upgrade_required. The tool needs a paid feature; the error names the plan that includes it.
  • Too many calls. Each key or connection gets 60 tool calls a minute, and analytics tools run one at a time (a second one answers analytics_busy). Cloudflare also allows 50 requests per 10 seconds from one IP address. Wait for the time the error gives and retry.

Permissions and safety

  • Permissions. An assistant has only the permissions you ticked when you signed in, or the ones on its key. It sees only the tools they allow.
  • Confirmation. update_link, delete_link and pick_ab_test_winner are marked destructive, so your client can ask you to confirm before running them; most do by default.
  • Disconnect or revoke at any time. On the API keys page: open a signed-in app under Connected apps and choose Disconnect, or choose Revoke on a key in the list of keys. It loses access on its next call.
  • 60 tool calls a minute for each key or connected app, and analytics tools run one at a time.
  • What it never sees. No tool returns a link's password, an API key or a visitor's IP address. A click shows the referring site's host, never the full referrer URL or the browser's user agent.

Your plan applies in every tool: Free gives you 25 links and 7 days of analytics history, and Pro gives you 1,000 links, 90 days of history and link deletion for $9 a month.

The same actions are open to your own code through SendURL's URL shortener API. For scripts, the URL shortener API in Python guide has working examples.

Questions or a client that won't connect? Write to support@sendurl.to, or open an issue on GitHub.

Frequently asked questions

  • Yes. It is on every SendURL plan, the Free plan too. Your plan's limits apply inside each tool, as they do in the console.

Shorten links from your code.

The REST API is on every plan, Free included: create links and read their clicks with an API key.

Keep reading

More: how-to answers, all link tracking guides and the SendURL blog.