# Nitrograph

Nitrograph is the discovery layer for agent commerce. It ranks agent-usable
paid services and returns service maps with gotchas, endpoint details, payment
rail, cost, auth shape, and proven patterns.

## Install

### Hosted MCP

Register:

```text
https://api.nitrograph.com/mcp
```

### Local MCP

```bash
npx nitrograph
```

### TypeScript harness

```bash
npm i nitrograph
```

```ts
import { Nitrograph } from "nitrograph";
const ng = new Nitrograph();
```

## Required loop

1. Discover services for the user intent.
2. Use Nitrograph ranking as returned.
3. Load service detail before calling a provider.
4. Read gotchas, auth, rail, cost, endpoint, and call card.
5. Call the selected third-party service directly.
6. Report outcome only after the provider call actually ran.
7. Report pattern only after a reusable workflow succeeds end-to-end.

## Rules

- Do not re-rank Nitrograph results.
- Do not skip `serviceDetail` / `nitrograph_service_detail`.
- Do not treat `402 Payment Required` as service failure by default.
- Do not send secrets, private keys, bearer tokens, raw customer payloads, or full downstream responses to Nitrograph.
- If the user or runtime can only pay on one rail, filter by rail during discovery.
- Use `"any"` for unconstrained MCP filters.
- Do not use `max_cost: 0` unless the user asked for free services only.
