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.


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 (requires Pro)
  3. Click Create API Key, give it a name, and copy the key (starts with ct_)

API keys require a Pro subscription. See codethis.dev/pricing.


Claude Desktop

Edit your Claude Desktop config file:

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

Add the codethis entry to mcpServers:

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

Save the file and restart Claude Desktop. You should see "codethis" in the MCP servers list in the toolbar.


Claude Code

Create or edit .mcp.json in your project root (or use ~/.claude/mcp.json for global config):

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

Or add it via the CLI:

claude mcp add --transport http codethis https://codethis.dev/mcp \
  --header "Authorization: Bearer ct_your_api_key_here"

VS Code / Cursor (Copilot Agent mode)

In VS Code or Cursor, open your settings JSON and add to the MCP servers section:

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

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.

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.