Connecting

Three ways to connect to the Moonlit MCP server, depending on your client and where it runs.

Every method authenticates with your Moonlit subscription key, the same Ocp-Apim-Subscription-Key used for the Data API. If you do not have one yet, get your key here. The MCP server runs at https://mcp.moonlit.ai/.

Choose a method

Your setupHow to connect
Desktop AI client with a person present (Claude, Cursor)Browser login
An app that supports OAuth client configurationOAuth client credentials
A deployed service, chatbot, or backend with no browserProvisioned token

Desktop AI clients

For clients where a person is present, such as Claude or Cursor. Authentication is a one-time browser login: you paste your subscription key on the Moonlit consent page and the OAuth handshake completes on its own.

For Claude.ai and Claude Code, follow the step-by-step in the Quickstart.

Cursor

  1. Open Settings and go to MCP.
  2. Add a new server with type streamable-http.
  3. Set the URL to https://mcp.moonlit.ai/.
  4. Follow the browser login when prompted.
Other desktop clients work the same way: set the server URL to https://mcp.moonlit.ai/, leave any OAuth fields empty, and complete the browser login.

OAuth client credentials

For applications that support OAuth client configuration. You register once to get a client_id and client_secret, then configure your MCP client with standard OAuth fields.

Register a client

Visit https://mcp.moonlit.ai/auth/register in your browser. Enter your Moonlit subscription key and a client name. You receive a client_id and client_secret. Store them securely. The secret is shown only once, and credentials expire after 90 days.

Configure your client

Use the credentials in any MCP client that supports OAuth:

FieldValue
Server URLhttps://mcp.moonlit.ai/
Client IDYour registered client_id
Client SecretYour registered client_secret

The client uses the client_credentials grant type to obtain access tokens automatically.

Token exchange (optional)

If your client does not handle OAuth on its own, you can exchange credentials for a token directly:

curl -X POST https://mcp.moonlit.ai/token \
  -d 'grant_type=client_credentials&client_id=YOUR_ID&client_secret=YOUR_SECRET'

Response:

{
  "access_token": "eyJhbGciOiJIUzI1NiI...",
  "token_type": "Bearer",
  "expires_in": 604800,
  "refresh_token": "eyJhbGciOiJIUzI1NiI...",
  "scope": ""
}

Access tokens are valid for 7 days. A refresh token, valid for 30 days, is included so clients can renew without re-authenticating.

Revoke credentials

curl -X POST https://mcp.moonlit.ai/auth/revoke-client \
  -d 'client_id=YOUR_ID&client_secret=YOUR_SECRET'

Deployed services

For server-side applications where there is no browser and no OAuth flow, such as chatbots and backend integrations. You generate a long-lived Bearer token once and configure your MCP client with it.

Provision a token

curl -X POST https://mcp.moonlit.ai/auth/provision \
  -H "Content-Type: application/json" \
  -d '{"apim_key": "your-subscription-key"}'

Response:

{
  "token": "eyJhbGciOiJIUzI1NiI...",
  "token_type": "Bearer",
  "expires_in": 31536000
}

The token is valid for 1 year. Store it securely. It grants the same access as your subscription key.

Use the token

Pass the token as a Bearer token in the Authorization header. Example using the MCP Python SDK:

from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client

async def connect():
    async with streamablehttp_client(
        "https://mcp.moonlit.ai/",
        headers={"Authorization": "Bearer eyJhbGciOiJIUzI1NiI..."}
    ) as (read, write, _):
        async with ClientSession(read, write) as session:
            await session.initialize()
            tools = await session.list_tools()
            print(f"Connected: {len(tools.tools)} tools available")

Access control

Your subscription key determines:

ControlsBased on
Which toolsYour subscription role (keyword, semantic, hybrid, and so on)
Which jurisdictionsYour subscription jurisdiction scope
Rate limitsQuota tracked per subscription in Azure API Management

If a tool returns an access error, your subscription may not include that capability. Contact support@moonlit.ai to upgrade.

Tools and parameters

Once connected, the server exposes the Moonlit legal-search tools to your client. See Tools for what each one does. The tools wrap the same endpoints as the Data API, so the API reference documents the full parameter schema for every search, filter, and retrieval call.