---
title: "Model Context Protocol (MCP) Tools & Resources Reference"
description: "Technical reference of all MCP tools, live workspace resources, prompt templates, and execution guardrails exposed by the Shaf MCP Server."
---

> Documentation Index
> Fetch the complete documentation index at: https://shaf.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Context Protocol (MCP) Tools & Resources Reference

# Model Context Protocol (MCP) Tools & Resources Reference

The Shaf Model Context Protocol (MCP) Server implements the standardized MCP protocol (`2024-11-05`), exposing tools, workspace resources, and prompt templates for autonomous AI development environments including Claude Code, Cursor, Windsurf, and custom agentic frameworks.

---

## Server Endpoints & Transports

The Shaf MCP Server provides dual transport protocols hosted at the edge:

| Transport | Endpoint URL | Protocol | Recommended For |
| :--- | :--- | :--- | :--- |
| **Server-Sent Events (SSE)** | `https://shaf.app/api/v1/mcp/sse` | HTTP/2 SSE Stream | Cursor, Windsurf, Long-running daemon clients |
| **Streamable HTTP POST** | `https://shaf.app/api/v1/mcp` | Standard JSON-RPC 2.0 | Claude Code, Stateless CLI agents, CI/CD runners |

All connections require a Bearer token in the `Authorization` header:

```http
Authorization: Bearer shaf_mcp_live_4a91c0e...
```

Tokens may be configured with either `ro` (read-only) or `rw` (read-write) scope in [Settings > MCP Server](https://shaf.app/docs/docs/how-to/integrations-and-developer/mcp-server).

---

## Tools Catalog

### Read-Only Tools (`ro` Scope)

#### 1. `list_links` (and `search_links`)
Search and list short links in the organization with pagination, keyword search, and live click counts.

- **Annotations**: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`
- **Parameters**:
  - `limit` (`number`, optional): Max links to return (1-100, default: 20).
  - `offset` (`number`, optional): Pagination offset (default: 0).
  - `search` (`string`, optional): Search query matching slug or destination URL.
  - `days` (`number`, optional): Analytics lookback window in days (1-90, default: 30).

#### 2. `get_link_metrics` (and `get_link_analytics`)
Retrieve live click counts, unique visitors, top referrers, geographic breakdown, and metadata for a specific short link.

- **Annotations**: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`
- **Parameters**:
  - `slug` (`string`, **required**): Short link slug identifier.
  - `days` (`number`, optional): Lookback window in days (1-90, default: 30).

#### 3. `get_workspace_analytics`
Get organization-wide link volume, gross visits, unique visitors, top performing links, and active domain/SDK counts.

- **Annotations**: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`
- **Parameters**:
  - `days` (`number`, optional): Lookback window in days (1-90, default: 30).

#### 4. `list_domains`
List custom short domains and subpath proxy routes configured and verified for the workspace.

- **Annotations**: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`
- **Parameters**: None.

#### 5. `list_site_integrations`
List zero-code Site Integrations (dynamic edge SDKs) configured for the workspace.

- **Annotations**: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`
- **Parameters**: None.

#### 6. `inspect_link_safety`
Inspect a destination URL for security threats, phishing vectors, private IPv4/IPv6 ranges, or SSRF risks before shortening.

- **Annotations**: `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: true`
- **Parameters**:
  - `url` (`string`, **required**): Destination URL to analyze.

---

### Write Tools (`rw` Scope)

#### 7. `create_short_link` (and `create_link`)
Create a new branded short link with support for custom domains, slugs, category tags, OpenGraph previews, and expiration.

- **Annotations**: `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`, `openWorldHint: true`
- **Parameters**:
  - `url` (`string`, **required**): Destination target URL (`http://` or `https://`).
  - `slug` (`string`, optional): Custom short slug. If omitted, generates random nanoid.
  - `domain` (`string`, optional): Target custom domain hostname (e.g. `link.brand.com`).
  - `tags` (`string[]`, optional): Array of category tags.
  - `title` (`string`, optional): OpenGraph title preview.
  - `description` (`string`, optional): OpenGraph description preview.
  - `expiresAt` (`number`, optional): Expiration timestamp in Unix epoch seconds.

#### 8. `update_link`
Update destination URL, tags, title, description, comment, or expiration of an existing short link.

- **Annotations**: `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: true`
- **Parameters**:
  - `slug` (`string`, **required**): Existing short link slug to update.
  - `url` (`string`, optional): New destination URL.
  - `tags` (`string[]`, optional): Replacement tag array.
  - `title` (`string`, optional): Updated OpenGraph title.
  - `description` (`string`, optional): Updated OpenGraph description.
  - `comment` (`string`, optional): Internal note or memo.
  - `expiresAt` (`number`, optional): Updated Unix expiration timestamp.

#### 9. `generate_qr_code`
Generate an SVG or PNG QR code for a short link slug or destination URL.

- **Annotations**: `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: true`
- **Parameters**:
  - `slugOrUrl` (`string`, **required**): Short link slug or full URL.
  - `size` (`number`, optional): Pixel dimension (64-1024, default: 240).
  - `ecc` (`string`, optional): Error correction level (`L`, `M`, `Q`, `H`, default: `M`).
  - `format` (`string`, optional): Output format (`svg` or `png`, default: `svg`).

#### 10. `create_partner_referral`
Generate an affiliate partner referral link scoped to a specific program.

- **Annotations**: `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`
- **Parameters**:
  - `partnerId` (`string`, **required**): Partner identifier.
  - `programId` (`string`, **required**): Affiliate program identifier.
  - `campaign` (`string`, optional): Optional campaign tag.

---

## Live MCP Resources

Agents can read context directly from stateful MCP resource URIs:

| Resource URI | MIME Type | Contents |
| :--- | :--- | :--- |
| `shaf://workspace/overview` | `application/json` | Organization metadata, active plan limits, current link counts, and 30-day analytics summary. |
| `shaf://workspace/domains` | `application/json` | Verified and pending custom domains and subpath proxies belonging to the workspace. |
| `shaf://workspace/integrations` | `application/json` | Zero-code Site Integration configurations (routing strategies, domain rules, daily caps). |

---

## MCP Prompts Catalog

Shaf registers pre-configured workflow prompts to guide agents through complex multi-step tasks:

### 1. `create_campaign_links`
Directs the agent to check active custom domains via `list_domains`, and create UTM-tagged short links across multiple marketing channels (`email`, `x`, `linkedin`).

- **Arguments**:
  - `baseUrl` (`string`, required): Landing page URL to promote.
  - `campaign` (`string`, required): Campaign identifier slug (e.g. `summer-promo`).
  - `channels` (`string`, optional): Comma-separated channel names (default: `email,x,linkedin`).

### 2. `audit_workspace_links`
Directs the agent to query `get_workspace_analytics` and `list_links`, summarize traffic velocity, detect zero-click links, and execute `inspect_link_safety` on suspicious destination targets.

- **Arguments**:
  - `days` (`number`, optional): Analytics lookback window (default: 30).

---

## Client Configuration Examples

### Claude Code

Add the server using the `claude mcp add` command:

```bash
claude mcp add shaf -- https://shaf.app/api/v1/mcp \
  --header "Authorization: Bearer shaf_mcp_live_..."
```

### Cursor (\~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "shaf": {
      "url": "https://shaf.app/api/v1/mcp/sse",
      "headers": {
        "Authorization": "Bearer shaf_mcp_live_..."
      }
    }
  }
}
```

### Windsurf

```json
{
  "mcpServers": {
    "shaf": {
      "serverUrl": "https://shaf.app/api/v1/mcp/sse",
      "headers": {
        "Authorization": "Bearer shaf_mcp_live_..."
      }
    }
  }
}
```

Source: https://shaf.app/docs/reference/mcp-tools/index.mdx
