Documentation MCP Usage Examples

MCP Usage Examples

Below are common patterns for interacting with the MCP server from external clients. Send each body as an HTTP POST with your Authorization header.

List all tools
json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}
List your projects
json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "list_projects",
    "arguments": { "limit": 10 }
  }
}
Create a file in a project
json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "create_file",
    "arguments": {
      "project_id": "your-project-uuid",
      "path": "src/components/NewWidget.tsx",
      "content": "export default function NewWidget() { return <div>Hello</div>; }"
    }
  }
}
Edit a file in place
json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "search_replace_file",
    "arguments": {
      "project_id": "your-project-uuid",
      "path": "src/components/NewWidget.tsx",
      "search": "<div>Hello</div>",
      "replace": "<div>Hello, world</div>"
    }
  }
}
Search across files
json
{
  "jsonrpc": "2.0",
  "id": 5,
  "method": "tools/call",
  "params": {
    "name": "search_files",
    "arguments": {
      "project_id": "your-project-uuid",
      "query": "useState"
    }
  }
}
Read a resource
json
{
  "jsonrpc": "2.0",
  "id": 6,
  "method": "resources/read",
  "params": { "uri": "cloudcode://project/your-project-uuid/file-tree" }
}
Stream an external agent's reply into project chat

Call stream_start to get a message_id, send stream_chunk with the full text so far as often as you like, then finish with stream_end:

json
{
  "jsonrpc": "2.0",
  "id": 7,
  "method": "tools/call",
  "params": {
    "name": "stream_start",
    "arguments": { "project_id": "your-project-uuid", "source": "claude-code" }
  }
}
json
{
  "jsonrpc": "2.0",
  "id": 8,
  "method": "tools/call",
  "params": {
    "name": "stream_end",
    "arguments": { "message_id": "<message_id from stream_start>", "content": "Done." }
  }
}
Tip
Use tools/list to dynamically discover all available tools and their input schemas. This ensures your integration stays compatible even as new tools are added.
Using with Claude Code

Add the server with the CLI:

bash
claude mcp add --transport http cloudcode https://tytvylihloorkrcgkzok.supabase.co/functions/v1/mcp-server \
  --header "Authorization: Bearer <access_token>"

Or commit a project-scoped .mcp.json (keep the token in an environment variable):

json
{
  "mcpServers": {
    "cloudcode": {
      "type": "http",
      "url": "https://tytvylihloorkrcgkzok.supabase.co/functions/v1/mcp-server",
      "headers": {
        "Authorization": "Bearer ${CLOUDCODE_ACCESS_TOKEN}"
      }
    }
  }
}
Using with Cursor

Add to ~/.cursor/mcp.json (or .cursor/mcp.json in a project):

json
{
  "mcpServers": {
    "cloudcode": {
      "url": "https://tytvylihloorkrcgkzok.supabase.co/functions/v1/mcp-server",
      "headers": {
        "Authorization": "Bearer <access_token>"
      }
    }
  }
}
Using with Claude Desktop

Claude Desktop's claude_desktop_config.json launches local (stdio) servers, so connect through the mcp-remote bridge, which forwards requests to the HTTP endpoint with your header:

json
{
  "mcpServers": {
    "cloudcode": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://tytvylihloorkrcgkzok.supabase.co/functions/v1/mcp-server",
        "--header",
        "Authorization:${CLOUDCODE_AUTH}"
      ],
      "env": {
        "CLOUDCODE_AUTH": "Bearer <access_token>"
      }
    }
  }
}
Warning
Access tokens expire (Supabase default: 1 hour). When the client starts getting 401 Unauthorized, replace the token in your config and restart or reconnect the server.