nsindocs Search the docs⌘K
  1. Docs
  2. API & MCP

MCP Server

Connect Claude, Cursor and other AI tools to NSIN with the hosted Model Context Protocol server.

On this page

NSIN hosts a remote Model Context Protocol (MCP) server — ask your AI assistant to "purge /assets on example.com" or similar, in plain language.

  • Endpoint: https://api.nsin.ir/mcp (Streamable HTTP)
  • Auth: your API key as Authorization: Bearer nsin_…
  • Nothing to install — NSIN hosts it.

Connect

Claude Code

bash
claude mcp add --transport http nsin https://api.nsin.ir/mcp \
  --header "Authorization: Bearer nsin_your_key_here"

Claude Desktop

Add this to claude_desktop_config.json (Settings → Developer → Edit Config). It uses mcp-remote to send your key as a header:

json
{
  "mcpServers": {
    "nsin": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://api.nsin.ir/mcp",
               "--header", "Authorization: Bearer nsin_your_key_here"]
    }
  }
}

Cursor

Add to .cursor/mcp.json (or global ~/.cursor/mcp.json):

json
{
  "mcpServers": {
    "nsin": {
      "url": "https://api.nsin.ir/mcp",
      "headers": { "Authorization": "Bearer nsin_your_key_here" }
    }
  }
}

Tools

✓ means a read-only key can use the tool. Read-only keys get a smaller list — write tools are never shown to the assistant. Every tool also tells the client whether it only reads, and whether it deletes or replaces something, so Claude and other clients can ask you before a risky call.

Domains and DNS records

Tool Read-only keys Description
list_domains ✓ Your domains: status, DNS mode, SSL, role
get_domain ✓ One domain's details, nameservers, settings
get_domain_checks ✓ Last result of each DNS check
add_domain — Add a domain (managed or external DNS)
check_nameservers — Re-test the delegation and activate a pending domain
verify_domain — Check an external-DNS domain's TXT record and activate it
enable_domain — Bring a disabled domain back
delete_domain — Delete a domain (owner only, needs confirm)
update_domain_settings — Cache budget/TTL/body cap, security headers, HSTS, min TLS, bot cache, Markdown for AI, DNS mode
set_developer_mode — Bypass cache and show origin errors, briefly
probe_origin_protocols ✓ Which HTTP versions each origin speaks
list_dns_records ✓ Records: ids, proxy status, origin scheme/port/host
create_dns_record — Create a record: TTL, scheme, port, Host override
update_dns_record — Change a record's fields
delete_dns_record — Remove a record
batch_update_dns_records — Change up to 1,000 records in one call
batch_delete_dns_records — Delete up to 1,000 records (needs confirm)
check_edge_dns — External DNS: test that a hostname reaches the NSIN edge

Zone import and export

Tool Read-only keys Description
export_dns_zone ✓ The zone as a BIND file (origins, not edge IPs)
scan_dns_records ✓ Preview what the current nameservers publish
preview_zone_file — Parse a zone file and show what an import would do
import_dns_records — Import rows, or everything from a fresh scan
get_dns_import_session ✓ Read a staged import
manage_dns_import_session — Start, rescan, commit or discard a staged import

An NSIN export imports back as it was: proxied records stay proxied, and the apex alias comes back as ANAME.

SSL

Tool Read-only keys Description
get_ssl_status ✓ Cert validity, expiry, issuer, SANs, gaps
list_ssl_certificates ✓ Every certificate: NSIN-managed and uploaded
issue_ssl_certificate — Order a certificate now, skip the cycle
request_managed_ssl_certificate — Add an NSIN certificate behind an uploaded one
upload_ssl_certificate — Install your own certificate and key, or just parse it
select_ssl_certificate — Choose which certificate the edge serves
remove_ssl_certificate — Delete an uploaded certificate (needs confirm)
check_ssl_delegation — External DNS: test the _acme-challenge delegation
get_acme_dns_account ✓ The acme-dns account behind issuance, if any
manage_acme_dns_account — Save, test or remove that account

Sharing and gateways

Tool Read-only keys Description
list_domain_members ✓ Who has access, with role
list_domain_invites — Pending invitations (their links are credentials)
invite_domain_member — Invite someone by email with a role
update_domain_member — Change a member's role or notifications
remove_domain_member — Revoke access (needs confirm)
manage_domain_invite — Resend or revoke an invitation
list_gateways ✓ The gateway catalog and which are on
accept_gateway_terms — Record the user's acceptance of the gateway terms
enable_gateway / rename_gateway / disable_gateway — Switch a gateway on, rename it, switch it off

Rules

Tool Read-only keys Description
list_rules ✓ One rule kind, in evaluation order, with ids and settings
get_rule ✓ One rule with every field
get_rule_schema ✓ The exact body of each kind, with examples
create_rule — Create a rule of any kind
update_rule — Change a rule (partial body)
delete_rule — Delete a rule (needs confirm)
reorder_rules — Set the evaluation order of one kind
toggle_rule — Flip a rule on or off
get_waf_shield_status ✓ State of NSIN Shield, the default WAF rule
restore_waf_shield — Bring back a deleted Shield rule
list_edge_nodes ✓ Edge node ids, for geo origin pools

kind: cache, waf, drop, rate_limit, captcha, bot_route, fingerprint, redirect, rewrite, header, origin_pool, origin_route, basic_auth, error_page or optimize. Rules only affect proxied hostnames. A kind your plan does not include saves switched off and cannot be switched on.

Cache

Tool Read-only keys Description
list_cache_entries ✓ What's cached: host, path, variant, storage node, size, expiry
get_cache_summary ✓ Cached objects and bytes per storage node
get_cache_entry_content ✓ What the edge stored for one object
purge_cache — Purge a domain's entire cache
purge_cache_by_path — Purge/refresh a URI pattern
purge_cache_entries — Purge/refresh exactly the objects listed

Traffic and logs

Tool Read-only keys Description
get_analytics_summary ✓ Requests, bandwidth, visitors, errors
get_traffic_breakdown ✓ One breakdown: countries, ASNs, status codes, TLS, cache, origins, AI crawlers, slowest paths, …
get_top_uris ✓ Most-requested URLs
get_account_analytics ✓ Traffic across all your domains
search_request_logs ✓ Raw log: status, URI, cache, fault, IP, ray id
list_waf_events ✓ Firewall events: rule, target, action
list_tunnel_suspects ✓ Clients that look like VPN/proxy tunnels
run_analytics_query ✓ Custom read-only SQL over request logs
test_markdown_for_agents ✓ Fetch a page as a browser and as an AI agent
get_traffic_usage ✓ Daily usage: cached / proxied / bypass / direct
get_plan_features ✓ Quota, usage, the plan's features

Uptime

Tool Read-only keys Description
get_uptime_status ✓ Origin health per hostname, now
list_uptime_incidents ✓ Outage history
get_uptime_settings ✓ Thresholds, watched hosts, alert channels
update_uptime_settings — Change detection and alerting
list_uptime_monitors ✓ Path monitors (up to 10 per domain)
create_uptime_monitor / update_uptime_monitor / delete_uptime_monitor — Manage path monitors
get_uptime_webhook — The webhook and its signing secret
list_uptime_webhook_deliveries — The last 50 deliveries
test_uptime_webhook — Send a test event now
rotate_uptime_webhook_secret — Replace the signing secret (needs confirm)

Email Routing

Tool Read-only keys Description
get_email_routing ✓ A domain's routing state, DNS and catch-all
enable_email_routing / disable_email_routing — Turn routing on or off (MX records change)
check_email_routing_dns — Check the MX, SPF and DKIM records now
set_email_routing_lock — Lock or unlock the records routing manages
update_email_routing_settings — Routing options (subaddressing)
list_email_routing_rules ✓ Custom addresses
create_email_routing_rule / update_email_routing_rule / delete_email_routing_rule — Manage custom addresses
set_email_catch_all — What happens to mail no rule matches
list_email_destinations ✓ Inboxes mail can go to, and if they're verified
create_email_destination — Add an inbox; sends a verification email
resend_email_destination_verification / verify_email_destination — Resend the link, or finish with its token
delete_email_destination — Remove an inbox (needs confirm)
get_email_routing_activity ✓ What happened to the domain's mail
setup_email_routing — One step: turn routing on, add the inbox, create the first address
send_email — Send a plain-text email from one of the domain's addresses (needs confirm)
list_sent_email ✓ Sent mail and what the receiving servers answered

A destination forwards nothing until its owner clicks the verification link.

Account

Tool Read-only keys Description
list_recommendations ✓ NSIN's findings for one domain, and what to change
get_recommendations_overview ✓ Open findings across every domain
set_recommendation_dismissed — Hide or bring back a finding
list_notifications ✓ Your notification feed
mark_notifications_read — Mark some or all read
list_support_tickets / get_support_ticket ✓ Your tickets and their threads
create_support_ticket / reply_to_support_ticket — Open a ticket or reply to one

Writing rules

Call get_rule_schema with the kind first: it lists every field of that kind's body with its type, allowed values, defaults and limits, plus example bodies. Then create_rule with kind and the body as rule. A field the kind doesn't have is refused before anything is saved.

update_rule takes a partial body: fields you leave out keep their values, and a list you send replaces the old one. To stop a rule without deleting it, send {"enabled": false}. Lower priority runs first; reorder_rules sets the order of one kind in one call.

Purging the cache

Three purge tools, most to least precise. All need cache.edit permission and a plan with cache purge.

purge_cache_by_path — the everyday, after-a-deploy tool. path: "/assets/*" (a directory), path: "/" (homepage), path: "/blog/post-1" (one page). * is a wildcard, no regex.

  • No * = substring match — /logo.png also matches /img/logo.png?v=2 — anchor it (/assets/*) when that matters.
  • Optional hostname/node narrows it; omit both = every hostname, every node.
  • All cache-key variants (query strings, mobile, WebP/AVIF, CORS) purge too.
  • Up to 10,000 objects per call; truncated: true means repeat. Preview with list_cache_entries.

purge_cache_entries purges exactly the rows list_cache_entries returned — for over-matching patterns.

purge_cache drops everything cached, on every node — the blunt option, origin takes all traffic until refill.

Targeted tools also accept mode: "refresh": drops the cached copy, keeps the entry listed; the next visitor re-fetches from origin. Deploying? Use set_developer_mode, not a purge loop.

Custom analytics queries

run_analytics_query covers what no dedicated tool does — "top 20 URIs by 5xx count, last 7 days". Pass a ClickHouse SELECT over the requests table, get columns and rows back as JSON, capped at 10,000 rows.

Sandboxed:

  • Read-only. Only a single SELECT/WITH … SELECT. Writes, DDL, settings changes, INTO OUTFILE/FORMAT, table functions (url, file, remote, s3, …) are rejected.
  • Your data only — scoped to domains your key can access, even in a subquery.
  • Bounded execution time and rows.

Useful requests columns: event_time, domain_id, hostname, method, uri, status, bytesIn, bytesOut, duration (ms), remoteAddr, country, asn, asnOrg, userAgent, cacheStatus (hit/miss/bypass), bypassReason, cacheAge, reqStatus (cache/proxied/direct), isWS, protocol, referer, rayId, node, originStatus, originAddr, error, errFault (origin/edge/client), errReason, upstreamDuration (ms), originConnReused, originDialMs, originTlsMs, originTtfbMs, originTlsVersion, ja4, botKind, wafScore, mdConverted, optKind. Bucket with toStartOfHour(event_time) or toStartOfDay(event_time).

errFault = 'origin' catches outages with no 5xx status — timeouts, refused connections, hangups — that status >= 500 misses.

Permissions and safety

  • MCP uses your account's own permissions — Viewer on a shared domain blocks write tools there, even on a full-access key.
  • Plan features gate too: monitoring, logs, WAF, cache purge; a tool needing one fails with the reason.
  • Every action gets the REST API's validation, audit logging, usage metering, and counts toward the 300 req/min rate limit.
  • Tools that delete something for good take confirm: true; the assistant should ask you first.
  • No key can move money: top-ups, plan purchases and choosing a domain's billing member stay in the panel.
  • Revoking the key in the panel disconnects the assistant.
esc