# Upfyn-Code MCP Server

Connect any MCP client to control your Upfyn-Code instance

## Quick Start

1
Get your API key — Log into Upfyn-Code, go to Settings, then API Keys. Click "Generate New Key".
2
Add MCP config to your client (see examples below).
3
Start using tools — Your client can now send prompts, manage canvas, and control sessions.

## Client Configuration

### Claude Desktop

Add to `~/.claude/mcp_servers.json`:

    {
      "upfynai": {
        "type": "streamable-http",
        "url": "https://upfynai.thinqmesh.com/mcp",
        "headers": {
          "x-api-key": "YOUR_API_KEY_HERE"
        }
      }
    }

### Claude Code CLI

    claude mcp add upfynai \
      --transport streamable-http \
      https://upfynai.thinqmesh.com/mcp \
      --header "x-api-key: YOUR_API_KEY_HERE"

### Cursor

Add to `.cursor/mcp.json` in your project:

    {
      "mcpServers": {
        "upfynai": {
          "url": "https://upfynai.thinqmesh.com/mcp",
          "headers": { "x-api-key": "YOUR_API_KEY_HERE" }
        }
      }
    }

### Any HTTP MCP Client

    POST https://upfynai.thinqmesh.com/mcp
    Headers:
      Content-Type: application/json
      x-api-key: YOUR_API_KEY_HERE

## Available Tools

send-prompt Send a message to Claude and get a streaming response
list-projects List all available projects
list-sessions List sessions for a specific project
get-session-messages Retrieve messages from a session
get-canvas-state Get current tldraw canvas nodes
add-canvas-node Add a visual node to the canvas
clear-canvas Clear all canvas nodes
get-active-sessions Get currently running Claude sessions
abort-session Stop an active Claude session

## Resources

upfynai://canvas/state Current canvas state (JSON)
upfynai://sessions/active Active sessions list (JSON)

## Authentication

All MCP requests require authentication via one of:

API Key (recommended for external clients):
`x-api-key: ck_your_key_here`

JWT Bearer Token (for browser-based access):
`Authorization: Bearer eyJhbG...`

Security: Keep your API key secret. Each key is tied to your user account. You can revoke keys at any time from Settings.

## Local Relay Connection

To power Upfyn-Code with your local Claude Code CLI:

    npx upfynai-code connect --server https://upfynai.thinqmesh.com --key YOUR_API_KEY

This connects your local machine's Claude CLI, terminal, filesystem, and git to the hosted UI. All computation runs locally — the server only relays messages.