Skip to content

MCP Server

NSIN hosts a remote Model Context Protocol (MCP) server, so AI assistants can manage your domains, DNS records, cache and edge rules in natural language — “add an A record for staging pointing at 203.0.113.7”, “purge everything under /assets on example.com”, “is the site down right now?”, “how much traffic did my site get this week?”.

  • Endpoint: https://api.nsin.ir/mcp (Streamable HTTP)
  • Auth: your API key as Authorization: Bearer nsin_…
  • Nothing to install — it’s hosted by NSIN.
Terminal window
claude mcp add --transport http nsin https://api.nsin.ir/mcp \
--header "Authorization: Bearer nsin_your_key_here"

Add a custom connector in Settings → Connectors with the URL https://api.nsin.ir/mcp, and supply the Authorization: Bearer nsin_… header when prompted.

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

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

A ✓ in the second column means a read-only API key can use the tool. Read-only keys are served a smaller tool list: the write tools are not just rejected, they are never shown to the assistant.

ToolRead-only keysDescription
list_domainsAll domains you can access, with status and your role
get_domainOne domain’s full details, nameserver state and settings
list_dns_recordsDNS records with ids, proxy status, origin scheme/port/host-header
get_ssl_statusCertificate validity, expiry, issuer, SANs, coverage gaps
add_domainAdd a domain to the account (managed or external DNS)
create_dns_recordCreate a record, including origin scheme, port and Host override
update_dns_recordChange a record’s fields
delete_dns_recordRemove a record
check_nameserversRe-test a pending domain’s delegation and activate it
issue_ssl_certificateOrder a certificate now instead of waiting for the cycle
set_developer_modeBypass the cache for a few hours while deploying
update_domain_settingsCache budget/TTL/body cap, security headers, HSTS, minimum TLS version, Markdown for AI agents
ToolRead-only keysDescription
list_cache_entriesBrowse what is cached: host, path, variant, node, size, expiry
get_cache_summaryTotal cached objects and bytes, per edge node
purge_cachePurge a domain’s entire edge cache
purge_cache_by_pathPurge (or refresh) everything matching a URI pattern
purge_cache_entriesPurge (or refresh) exactly the objects you listed
ToolRead-only keysDescription
list_rulesList one rule kind in evaluation order, with ids and settings
toggle_ruleEnable or disable a single rule

list_rules and toggle_rule take a kind: cache, waf, drop, rate_limit, captcha, bot_route, fingerprint, redirect, rewrite, header, origin_pool, origin_route, basic_auth, error_page or optimize. Creating and editing rules stays in the panel — the MCP server can read them and park a misbehaving one.

ToolRead-only keysDescription
get_analytics_summaryRequests, bandwidth, visitors, cache ratio, error rates
get_top_urisMost-requested page URLs over a period
search_request_logsRaw request log, filtered by status, URI, cache, fault, IP, ray id
list_waf_eventsFirewall events: which rule fired, on what, and what it did
run_analytics_queryRun a custom read-only SQL query over your request logs
get_uptime_statusCurrent origin health per hostname — “is it down right now?”
list_uptime_incidentsOutage incident history
list_recommendationsNSIN’s findings for the domain and what to change
get_traffic_usageDaily usage split by cached / proxied / bypass / direct
get_plan_featuresQuota, usage and which features the plan enables

There are three purge tools, in increasing precision. All of them need cache.edit permission and a plan with cache purge.

purge_cache_by_path is the everyday one — the purge after a deploy:

  • path: "/assets/*" — everything under a directory
  • path: "/" — the homepage
  • path: "/blog/post-1" — one page

Matching rules: * is a wildcard, and a pattern with no * matches as a substring, so /logo.png also matches /img/logo.png?v=2. Anchor the pattern (/assets/*) when that matters. Regular expressions are not supported. Optionally narrow to one hostname or one edge node; omit both and the purge covers every hostname of the domain on every node. Every cache-key variant of a matching URL (query strings, mobile, WebP/AVIF, CORS variants) is purged along with it.

A single call purges up to 10,000 objects and reports truncated: true when the pattern matched more — call it again until that is false. To see what a pattern will hit before running it, pass the same path to list_cache_entries.

purge_cache_entries takes the rows list_cache_entries returned and purges exactly those — use it when a substring pattern would catch more than you meant.

purge_cache drops everything the domain has cached, on every node. It is the blunt option: all traffic goes to the origin until the cache refills.

Both targeted tools also accept mode: "refresh", which drops only the cached copy so the next visitor re-fetches it from the origin, leaving the entry in the listing. If someone is actively deploying, set_developer_mode beats purging in a loop.

run_analytics_query lets an assistant answer analytics questions we don’t ship a dedicated tool for — “top 20 URIs by 5xx count over the last 7 days”, “hourly bandwidth for one subdomain”, “which ASNs sent the most bypass traffic”. You (or your AI) pass a ClickHouse SELECT over the requests table (your request log) and get back columns and rows as JSON (capped at 10,000 rows).

It is strictly sandboxed:

  • Read-only. Only a single SELECT (or WITH … SELECT) is accepted. Writes, DDL, settings changes, INTO OUTFILE/FORMAT, and table functions (url, file, remote, s3, …) are rejected.
  • Your data only. Every query is scoped by the engine to the domains your API key can access — there is no way to read another tenant’s rows, even inside a subquery.
  • Bounded. Execution time and rows read/returned are capped so a heavy query can’t run away.

Useful columns on requests: 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 (which side failed: origin/edge/client), errReason, upstreamDuration (ms origin round-trip), originConnReused, originDialMs, originTlsMs, originTtfbMs, originTlsVersion, ja4, botKind, wafScore, mdConverted, optKind. Bucket time with toStartOfHour(event_time) or toStartOfDay(event_time).

Note that errFault = 'origin' catches failures that never produced a 5xx status — timeouts, refused connections, origins that hung up — so it finds outages a status >= 500 filter misses.

  • The MCP server acts with exactly your account’s permissions. Domain sharing roles apply: with Viewer access to a shared domain, write tools fail on that domain even with a full-access key.
  • Plan features apply too. Monitoring, request logs, WAF and cache purge are gated on the domain’s plan, and a tool that needs one fails with the reason.
  • Every MCP action goes through the same validation, audit logging and usage metering as the REST API, and counts toward the key’s rate limit (300 requests/minute).
  • Revoking the key in the panel disconnects the assistant immediately.