Skip to content

MCP (Model Context Protocol)

Overview

SakuraNav supports MCP (Model Context Protocol), allowing external AI agents (such as Claude Desktop, Cursor, Cline, etc.) to perform full data read/write operations on your navigation site through the standard protocol.

As long as the agent has an API Token configured in your personal space and correctly sets up the MCP connection, it can perform all operations including tag management, site management, card management, snapshot management, and more.

Transport Protocols

SakuraNav supports two MCP transport protocols for maximum compatibility:

ProtocolEndpointDescription
Streamable HTTP (Recommended)POST /api/mcpStateless, single endpoint for all requests, recommended for modern clients
SSEGET /api/mcp/sse + POST /api/mcp/sse/messagesStateful long connection, compatible with legacy MCP clients

Configuration

1. Create an API Token

  1. Log in to SakuraNav, navigate to ProfileAccess Tokens tab
  2. Click "Create Token", enter a name (e.g., MCP-Claude), select expiration
  3. Copy the token immediately — it cannot be viewed again after closing the dialog

⚠️ It's recommended to use a separate Token for each MCP client for easier management and revocation.

2. Configure Your MCP Client

Choose the appropriate configuration based on your AI agent tool:

Claude Desktop

Edit claude_desktop_config.json (usually located in ~/.claude/ directory):

json
{
  "mcpServers": {
    "sakuranav": {
      "url": "https://your-domain.com/api/mcp",
      "headers": {
        "Authorization": "Bearer sak_your_token_here"
      }
    }
  }
}

Cursor

Add MCP Server in Cursor settings:

json
{
  "mcpServers": {
    "sakuranav": {
      "url": "https://your-domain.com/api/mcp",
      "headers": {
        "Authorization": "Bearer sak_your_token_here"
      }
    }
  }
}

Other MCP-Capable Clients

General configuration parameters:

  • URL: https://your-domain.com/api/mcp (Streamable HTTP) or https://your-domain.com/api/mcp/sse (SSE)
  • Authentication: Authorization: Bearer sak_xxx request header
  • Protocol Version: 2025-03-26

Available Tools

Once configured, the agent can use the following MCP tools:

Tag Management

ToolDescription
list_tagsGet all tags (including virtual tags for social/note cards, with _note annotations)
list_site_tagsGet site tags only (real tags, no virtual tags)
create_tagCreate a tag
update_tagUpdate a tag
delete_tagDelete a tag (deleting a virtual tag triggers batch cleanup of that card type)
reorder_tagsReorder tags

Site Management

ToolDescription
list_site_cardsGet sites (with pagination and filtering)
list_all_site_cardsGet all sites (no pagination)
get_site_cardGet a single site
create_site_cardCreate a site
update_site_cardUpdate a site
delete_site_cardDelete a site
batch_create_site_card_cardsBatch create sites (up to 50)

Social Cards

ToolDescription
list_social_cardsGet all social cards
create_social_cardCreate a social card
update_social_cardUpdate a social card
delete_social_cardDelete a social card

Note Cards

ToolDescription
list_note_cardsGet all note cards
create_note_cardCreate a note card
update_note_cardUpdate a note card
delete_note_cardDelete a note card

Snapshot Management

ToolDescription
list_snapshotsGet all snapshots
create_snapshotCreate a snapshot
get_snapshotGet snapshot details
restore_snapshotRestore from a snapshot
delete_snapshotDelete a snapshot
ToolDescription
search_site_cardsSearch sites and tags

Usage Examples

Here are examples of operations an agent can perform:

User: Add GitHub to the "Dev Tools" tag in my navigation site

Agent flow:
1. list_tags → Find the "Dev Tools" tag ID
2. create_site_card → Create site { name: "GitHub", url: "https://github.com", tagIds: ["tag-xxx"] }
User: List all offline sites in my navigation

Agent flow:
1. list_all_site_cards → Get all sites
2. Filter sites where siteIsOnline === false and present to user

Security Notes

  • Token equals user permissions: MCP requests authenticated via Token have the same permissions as the Token creator
  • Use dedicated tokens: Create a separate Token for each MCP client; delete unused ones promptly
  • Rate limiting: MCP endpoints are limited to 300 requests per IP per minute
  • Token security: Never commit Tokens to version control or share them publicly
  • Regular rotation: Periodically delete old Tokens and create new ones

Technical Details

Authentication

MCP endpoints require Authorization: Bearer sak_xxx authentication, using the existing API Token system:

MCP Request → Bearer Token → SHA-256 Hash → Database Match → User Verification

Data Isolation

MCP operations follow multi-tenant data isolation rules:

  • Admin tokens operate on admin data space
  • Regular user tokens only operate on that user's own data

SSE Session Management

  • SSE mode maintains in-memory session mapping, suitable for single-instance deployment
  • Sessions expire and are cleaned up after 30 minutes of inactivity
  • For multi-instance deployment, Streamable HTTP (stateless) is recommended