Contents

MCP server reference

Everything an AI client needs to connect to NAPT over the Model Context Protocol: the server URL, the OAuth 2.1 authorization flow, the scope model, and example requests for each tool.

Server URL

NAPT exposes a single Streamable-HTTP MCP endpoint. Paste this URL into ChatGPT, Claude, Cursor, Codex, or any MCP-capable client:

text
https://napt.networkgig.in/mcp/server

The endpoint accepts POST JSON-RPC requests and requires both application/json and text/event-stream in the Accept header. Unauthenticated requests return 401 along with a WWW-Authenticate header pointing at the protected-resource metadata:

text
https://napt.networkgig.in/.well-known/oauth-protected-resource

OAuth 2.1 flow

NAPT is an OAuth resource server; the authorization server is the platform identity service. Most clients perform every step below automatically once you paste the server URL — the manual detail is here for custom integrations.

  1. Discovery. The client fetches /.well-known/oauth-protected-resource from NAPT, reads the authorization_servers entry, then fetches that issuer's /.well-known/oauth-authorization-server document.
  2. Client registration. Dynamic client registration (DCR) is enabled, so the client self-registers at the issuer's registration_endpoint. No client id needs to be created by hand.
  3. Authorization + PKCE. The client opens the issuer's authorize endpoint with a PKCE challenge. You sign in to NAPT if you are not already signed in.
  4. Consent. You are redirected to the NAPT consent screen at /.lovable/oauth/consent, which names the client and the account you are connecting. Approve or deny there.
  5. Token exchange. The client exchanges the authorization code for an access token and refresh token at the issuer's token endpoint.
  6. Calling tools. Every MCP request carries Authorization: Bearer <access token>. NAPT verifies the signature, issuer and audience, resolves your user identity, and applies scope checks and row-level security per tool.

Copied app-session tokens are rejected on purpose: only tokens minted through this OAuth flow carry the OAuth client claim the server requires.

text
Discovery : GET https://napt.networkgig.in/.well-known/oauth-protected-resource
Authorize : GET  <issuer>/authorize?response_type=code&code_challenge=…
Consent   : GET  https://napt.networkgig.in/.lovable/oauth/consent?authorization_id=…
Token     : POST <issuer>/token   (grant_type=authorization_code | refresh_token)
Call      : POST https://napt.networkgig.in/mcp/server    (Authorization: Bearer <token>)

Scopes

Access tokens authenticate you; NAPT scopes authorize each tool. Scopes are granted per-user by a platform admin and checked on every call. Admins hold all scopes.

ScopeGrantsTools
scripts:readRead the automation script cataloglist_scripts, get_script
findings:readRead your network findingsquery_findings
compliance:readRead your compliance scoreslist_compliance_scores

A call without the required scope returns a tool error naming the missing scope. Admins manage grants at /admin/mcp-scopes and review every request at /admin/mcp-audit.

Tool reference

Four tools are advertised over tools/list. Each example below is a complete JSON-RPC request body plus an equivalent curl command.

list_scripts
scripts:read
List automation scripts

Browse the NAPT automation script catalog with server-side filtering and pagination. Prefer cursor pagination: pass the response's next_cursor back as cursor until has_more is false. Cursors encode the last row's sort key, so they never skip or repeat rows when the catalog changes between pages (offset can). offset remains supported for legacy callers.

ArgumentTypeDescription
categorystringCategory id, e.g. routing, security, wan
vendorstringVendor substring, e.g. juniper, cisco, arista
searchstringFree-text match on slug, label or description
difficultystringDifficulty filter, e.g. beginner, advanced
limitnumberPage size (default 25, max 200)
cursorstringOpaque next_cursor from the previous page (preferred)
offsetnumberLegacy zero-based offset into the filtered set
sortstringslug | label | category | difficulty (default slug)
orderstringasc | desc (default asc)

JSON-RPC request

json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list_scripts",
    "arguments": {
      "category": "routing",
      "vendor": "cisco",
      "limit": 25
    }
  }
}

curl

bash
curl -X POST https://napt.networkgig.in/mcp/server \
  -H "Authorization: Bearer $NAPT_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"list_scripts","arguments":{"category":"routing","vendor":"cisco","limit":25}}}'

Example response payload

json
{
  "total": 112,
  "count": 25,
  "limit": 25,
  "offset": 0,
  "has_more": true,
  "next_offset": 25,
  "next_cursor": "eyJzIjoic2x1ZyIsIm8iOiJhc2MiLCJrIjoi4oCmIiwiZyI6IuKApiJ9",
  "scripts": [
    { "slug": "bgp-neighbor-audit", "label": "BGP neighbour audit", "vendors": ["cisco"], "category": "routing" }
  ]
}
get_script
scripts:read
Get script details

Fetch the full definition of one script by slug, including source and parameters.

ArgumentTypeDescription
slug *stringScript slug, e.g. bgp-neighbor-audit

JSON-RPC request

json
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "get_script",
    "arguments": {
      "slug": "bgp-neighbor-audit"
    }
  }
}

curl

bash
curl -X POST https://napt.networkgig.in/mcp/server \
  -H "Authorization: Bearer $NAPT_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_script","arguments":{"slug":"bgp-neighbor-audit"}}}'

Example response payload

json
{
  "script": {
    "slug": "bgp-neighbor-audit",
    "title": "BGP neighbour audit",
    "framework": "netmiko",
    "code": "..."
  }
}
query_findings
findings:read
Query network findings

Read the signed-in user's network findings. Results are scoped to the caller's own data by row-level security.

ArgumentTypeDescription
severitystringinfo | low | medium | high | critical
categorystringFinding category, e.g. drift, compliance
run_idstringRestrict to one run id
limitnumberMax rows (default 50, max 200)

JSON-RPC request

json
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "query_findings",
    "arguments": {
      "severity": "critical",
      "limit": 20
    }
  }
}

curl

bash
curl -X POST https://napt.networkgig.in/mcp/server \
  -H "Authorization: Bearer $NAPT_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"query_findings","arguments":{"severity":"critical","limit":20}}}'

Example response payload

json
{
  "result": {
    "total": 3,
    "findings": [
      { "id": "…", "severity": "critical", "title": "OSPF area mismatch", "device": "core-rtr-01" }
    ]
  }
}
list_compliance_scores
compliance:read
List compliance scores

Latest compliance score per profile (CIS / NIST / PCI) for the signed-in user.

ArgumentTypeDescription
profile_idstringRestrict to one compliance profile id
limitnumberMax rows (default 50)

JSON-RPC request

json
{
  "jsonrpc": "2.0",
  "id": 4,
  "method": "tools/call",
  "params": {
    "name": "list_compliance_scores",
    "arguments": {
      "limit": 10
    }
  }
}

curl

bash
curl -X POST https://napt.networkgig.in/mcp/server \
  -H "Authorization: Bearer $NAPT_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"list_compliance_scores","arguments":{"limit":10}}}'

Example response payload

json
{
  "result": {
    "scores": [
      { "profile": "CIS", "score": 87, "scored_at": "2026-07-28T04:00:00Z" }
    ]
  }
}

To enumerate tools programmatically, send {"jsonrpc":"2.0","id":0,"method":"tools/list"} to the same endpoint.

Health & troubleshooting

A public readiness probe reports MCP definition, transport, database and auth health:

bash
curl -s https://napt.networkgig.in/api/public/mcp-health | jq
  • 401 on every call — the token was not minted through the OAuth flow, or it expired. Reconnect the client.
  • 406 Not Acceptable — the client omitted Accept: application/json, text/event-stream.
  • "Access denied … missing the scope" — ask a platform admin to grant the scope listed in the error.
  • Empty results — tools read your own data under row-level security; check you connected with the intended account.