MCP Server

MCP server for Claude, Cursor, and other AI assistants. Let your AI create and retrieve CodeThis pastes directly from chat.

What is MCP?

Model Context Protocol (MCP) is an open standard that lets AI assistants like Claude connect to external tools and services. When you configure an MCP server, your AI client gains new tools it can use during conversations.

The CodeThis MCP server gives Claude (and any other MCP-compatible client) three tools:

  • create_paste — create a new paste and get back a shareable URL
  • get_paste — fetch the content of an existing paste by slug or URL
  • list_pastes — list your recent pastes

Example prompt: "Save this TypeScript function as a CodeThis paste with a 30-day expiry." Claude will call create_paste and return the URL.

The CodeThis MCP server runs as an HTTP endpoint at https://codethis.dev/mcp. There is nothing to install — just point your MCP client at the URL with your API key.

The MCP server is available on the Free tier — every registered account can use it. Pro raises the API key and rate-limit ceilings, but there is no Pro gate on MCP itself.


Prerequisites

Before setting up the MCP server, you need a CodeThis API key:

  1. Sign in at codethis.dev
  2. Go to Settings > API Keys
  3. Click Create API Key, give it a name, and copy the key (starts with ct_)

API keys are free — every registered account can create up to 2 (Pro: 20). Create one at Settings → API Keys.


Every MCP client has a slightly different config schema for remote HTTP servers. The verified-working setup for each is below.

Claude Code

The fastest path is the CLI. Pick the scope that matches how you want to use it:

# Available across every project on this machine (recommended):
claude mcp add --scope user --transport http codethis https://codethis.dev/mcp \
  -H "Authorization: Bearer ct_your_api_key_here"

# Or scoped to one project (writes .mcp.json in your current directory):
claude mcp add --scope project --transport http codethis https://codethis.dev/mcp \
  -H "Authorization: Bearer ct_your_api_key_here"

If you omit --scope, claude mcp add defaults to local — it writes to the current directory and the server only loads when Claude Code is launched from that exact path. Use --scope user for "available everywhere" or --scope project for "shared with my team via a committed .mcp.json."

Verify with claude mcp list — you should see codethis in the output.

If the CLI fails silently, edit the config file directly. For --scope user, edit ~/.claude.json; for --scope project, edit .mcp.json in the project root:

{
  "mcpServers": {
    "codethis": {
      "type": "http",
      "url": "https://codethis.dev/mcp",
      "headers": {
        "Authorization": "Bearer ct_your_api_key_here"
      }
    }
  }
}

The type field must be "http" (not "streamable-http"). Reload the conversation, then run /mcp inside Claude Code to confirm codethis is connected.


Claude Desktop

Claude Desktop's claude_desktop_config.json only supports stdio servers natively. To connect to remote HTTP servers like CodeThis, use one of these two approaches:

Open claude.ai → Settings → Connectors → Add custom connector → paste https://codethis.dev/mcp → complete authentication by pasting your API key as the Bearer token when prompted.

This is the official Anthropic path for remote MCP servers on Claude Desktop / claude.ai.

Option B — mcp-remote stdio bridge

If you want a config-file-driven setup, use the mcp-remote npm package to bridge a remote HTTP server through stdio:

{
  "mcpServers": {
    "codethis": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://codethis.dev/mcp",
        "--header",
        "Authorization: Bearer ct_your_api_key_here"
      ]
    }
  }
}

Paths for claude_desktop_config.json:

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

Save the file and fully quit and relaunch Claude Desktop (not just close the window).


Cursor

Create or edit .cursor/mcp.json in your project root (or ~/.cursor/mcp.json for global config). Cursor does not use a type field — the presence of url identifies a remote server:

{
  "mcpServers": {
    "codethis": {
      "url": "https://codethis.dev/mcp",
      "headers": {
        "Authorization": "Bearer ct_your_api_key_here"
      }
    }
  }
}

Cursor supports environment-variable interpolation: "Authorization": "Bearer ${env:CODETHIS_API_KEY}" — useful if you want to keep the key out of the committed config.

Reload Cursor after editing.


VS Code (Copilot Agent mode)

VS Code's MCP config lives in .vscode/mcp.json and uses servers (not mcpServers) as the root key:

{
  "servers": {
    "codethis": {
      "type": "http",
      "url": "https://codethis.dev/mcp",
      "headers": {
        "Authorization": "Bearer ct_your_api_key_here"
      }
    }
  }
}

The quickest add path is MCP: Add Server from the Command Palette → pick HTTP → paste the URL → add the Authorization header when prompted.


Available Tools

create_paste

Create a new paste on CodeThis. Returns the paste URL and metadata.

Parameters

ParameterTypeRequiredDescription
contentstringYesThe content of the paste
titlestringNoOptional filename (e.g., app.tsx). Language is auto-detected from the extension.
languagestringNoProgramming language (e.g., typescript, python). Overrides title extension detection.
durationstringNoHow long the paste should be accessible. Options: 1h, 4h, 1d, 3d, 7d, 30d, 90d, 1y, forever. Defaults to your tier's default.

Example response

Paste created successfully!
URL: https://codethis.dev/doc/xK7mQ2pN
Slug: xK7mQ2pN
Language: typescript
Expires: 2026-05-17T00:00:00.000Z

get_paste

Fetch a paste by its slug or full URL.

Parameters

ParameterTypeRequiredDescription
slugstringYesThe paste slug (e.g., xK7mQ2pN) or full URL (e.g., https://codethis.dev/doc/xK7mQ2pN)

If you pass a full URL, the slug is extracted automatically.

Example response

Title: greet.ts
Language: typescript
Created: 2026-04-17T10:23:45.000Z
---
const greet = (name: string) => `Hello, ${name}!`

list_pastes

List your recent pastes.

Parameters

ParameterTypeDefaultDescription
pagenumber1Page number
limitnumber20Results per page (max 50)

Example response

greet.ts (typescript) — https://codethis.dev/doc/xK7mQ2pN — 2026-04-17T10:23:45.000Z
brave-tiger-42 (plaintext) — unpublished — 2026-04-16T09:00:00.000Z

Example Prompts

Once the MCP server is configured, you can ask Claude to:

  • "Save this code as a paste on CodeThis with a 7-day expiry."
  • "Fetch the paste at codethis.dev/doc/xK7mQ2pN and summarize it."
  • "List my recent CodeThis pastes."
  • "Create a CodeThis paste named deploy.sh with the contents of this script."
  • "Share this Python function as a permanent CodeThis paste."

Claude will use the appropriate tool automatically based on your prompt.


Troubleshooting

"Valid API key required" (401 error)

Your API key may be missing, invalid, expired, or deleted. Make sure the Authorization header is set to Bearer ct_your_key. Check Settings > API Keys on CodeThis and regenerate if needed.

claude mcp add "succeeds" but the server doesn't appear in claude mcp list

You almost certainly hit the scope default. claude mcp add without --scope writes to .mcp.json in your current working directory — if you ran it from ~, it wrote ~/.mcp.json, which Claude Code only loads when launched from ~. Re-run with --scope user to register the server globally:

claude mcp add --scope user --transport http codethis https://codethis.dev/mcp \
  -H "Authorization: Bearer ct_your_key"

The server is configured but Claude doesn't show CodeThis tools

Restart Claude Desktop / Claude Code after editing the config file. MCP servers are loaded at startup.

Testing the connection manually

You can verify the endpoint is reachable with a curl request:

curl -X POST https://codethis.dev/mcp \
  -H "Authorization: Bearer ct_your_key" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"0.0.1"}}}'

A successful response returns a JSON object with serverInfo and capabilities.