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.
Connect
Section titled “Connect”Claude Code
Section titled “Claude Code”claude mcp add --transport http nsin https://api.nsin.ir/mcp \ --header "Authorization: Bearer nsin_your_key_here"Claude.ai / Claude Desktop
Section titled “Claude.ai / Claude Desktop”Add a custom connector in Settings → Connectors with the URL https://api.nsin.ir/mcp, and supply the Authorization: Bearer nsin_… header when prompted.
Cursor
Section titled “Cursor”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.
Domains, DNS and SSL
Section titled “Domains, DNS and SSL”| Tool | Read-only keys | Description |
|---|---|---|
list_domains | ✓ | All domains you can access, with status and your role |
get_domain | ✓ | One domain’s full details, nameserver state and settings |
list_dns_records | ✓ | DNS records with ids, proxy status, origin scheme/port/host-header |
get_ssl_status | ✓ | Certificate validity, expiry, issuer, SANs, coverage gaps |
add_domain | — | Add a domain to the account (managed or external DNS) |
create_dns_record | — | Create a record, including origin scheme, port and Host override |
update_dns_record | — | Change a record’s fields |
delete_dns_record | — | Remove a record |
check_nameservers | — | Re-test a pending domain’s delegation and activate it |
issue_ssl_certificate | — | Order a certificate now instead of waiting for the cycle |
set_developer_mode | — | Bypass the cache for a few hours while deploying |
update_domain_settings | — | Cache budget/TTL/body cap, security headers, HSTS, minimum TLS version, Markdown for AI agents |
| Tool | Read-only keys | Description |
|---|---|---|
list_cache_entries | ✓ | Browse what is cached: host, path, variant, node, size, expiry |
get_cache_summary | ✓ | Total cached objects and bytes, per edge node |
purge_cache | — | Purge a domain’s entire edge cache |
purge_cache_by_path | — | Purge (or refresh) everything matching a URI pattern |
purge_cache_entries | — | Purge (or refresh) exactly the objects you listed |
| Tool | Read-only keys | Description |
|---|---|---|
list_rules | ✓ | List one rule kind in evaluation order, with ids and settings |
toggle_rule | — | Enable 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.
Traffic, logs and health
Section titled “Traffic, logs and health”| Tool | Read-only keys | Description |
|---|---|---|
get_analytics_summary | ✓ | Requests, bandwidth, visitors, cache ratio, error rates |
get_top_uris | ✓ | Most-requested page URLs over a period |
search_request_logs | ✓ | Raw request log, filtered by status, URI, cache, fault, IP, ray id |
list_waf_events | ✓ | Firewall events: which rule fired, on what, and what it did |
run_analytics_query | ✓ | Run a custom read-only SQL query over your request logs |
get_uptime_status | ✓ | Current origin health per hostname — “is it down right now?” |
list_uptime_incidents | ✓ | Outage incident history |
list_recommendations | ✓ | NSIN’s findings for the domain and what to change |
get_traffic_usage | ✓ | Daily usage split by cached / proxied / bypass / direct |
get_plan_features | ✓ | Quota, usage and which features the plan enables |
Purging the cache
Section titled “Purging the cache”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 directorypath: "/"— the homepagepath: "/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.
Custom analytics queries
Section titled “Custom analytics queries”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(orWITH … 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.
Permissions and safety
Section titled “Permissions and safety”- 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.