Contracts AI

Set up an MCP connection

Connect an MCP client to Contracts AI so you can ask questions and search contracts from your AI assistant using a Bearer token.

MCP (Model Context Protocol) lets compatible AI clients call Contracts AI tools over HTTP—ask questions about your contracts, search the repository, open a contract by ID, or list upcoming renewals—without opening the Contracts AI UI.

Contracts AI exposes a single MCP endpoint. You authenticate with a Bearer JWT (the same kind of token used for other Contracts AI APIs).


What you need

  • Access to Contracts AI (and an admin who can create an OAuth application, if you use client credentials)
  • An MCP-capable client that supports remote / HTTP MCP servers
  • Your Contracts AI API base URL (production is typically https://api.contracts.ai; use your tenant or staging API host if that is where your data lives)

Step 1: Get an access token

  1. Open Admin → Security → Manage OAuth Applications.
  2. Create Application with a clear name (for example MCP Integration) and any redirect URI your org requires for registration (client-credentials usage does not rely on the browser redirect).
  3. Copy the Client ID (and Client Secret, if your application has one).
  4. Request a token:
curl -X POST https://api.contracts.ai/api/oauth/token \
  -H "Content-Type: application/json" \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "YOUR_CLIENT_ID",
    "client_secret": "YOUR_CLIENT_SECRET"
  }'

Omit client_secret if the OAuth app was created without one.

  1. From the response, copy access_token. Use it as Bearer <access_token>.

Permissions: The token runs as the user who created the OAuth app (or an org admin fallback). That user’s contract access applies to every MCP tool call.

Option B — Sign-in JWT

Sign in to Contracts AI normally and use a valid session / API access JWT as the Bearer token. Prefer Option A for MCP so you are not tied to a personal browser session.


Step 2: MCP endpoint

ItemValue
URLhttps://api.contracts.ai/api/mcp/
MethodPOST (JSON-RPC); GET returns a short discovery / health payload
Auth headerAuthorization: Bearer YOUR_ACCESS_TOKEN
TransportHTTP (Streamable HTTP / JSON-RPC)

Replace the host with your environment’s API base if you are not on production.

Quick discovery check:

curl https://api.contracts.ai/api/mcp/

Step 3: Connect your MCP client

Exact steps vary by client. In general:

  1. Open your client’s MCP / connectors / custom server settings.
  2. Add a remote / HTTP MCP server.
  3. Set the server URL to https://api.contracts.ai/api/mcp/ (or your API host + /api/mcp/).
  4. Add the header:
    • Name: Authorization
    • Value: Bearer YOUR_ACCESS_TOKEN
  5. Save and restart or refresh the client if prompted.
  6. Confirm Contracts AI tools appear (names below).

Example MCP server config

Many clients use an mcpServers entry with a URL and headers:

{
  "mcpServers": {
    "contracts-ai": {
      "url": "https://api.contracts.ai/api/mcp/",
      "headers": {
        "Authorization": "Bearer YOUR_ACCESS_TOKEN"
      }
    }
  }
}

Use the format required by your client if it differs; the important values are the URL and Bearer header.


Available tools

ToolUse it to
ask_contractsAsk a natural-language question about contracts in your organization
search_contractsFind contracts by text, counterparty, active/inactive, with a result limit
get_contractLoad full details for one contract by numeric ID or con_xxx public ID
list_renewalsList renewals / expiries in a days-ahead window (optional auto-renewal only)

Example prompts

  • “Which contracts renew in the next 90 days?”
  • “Search for agreements with Acme.”
  • “What are the payment terms in contract con_…?”
  • “Do we have liability caps over $1M with this vendor?”

Security practices

  • Treat the access token like a password; do not paste it into tickets or screenshots.
  • Prefer a dedicated OAuth application for MCP so you can Deactivate or Regenerate Client ID without affecting other integrations.
  • Remember MCP calls use the creating user’s permissions—use an account with the least access needed.
  • Rotate credentials if a token or Client ID may have leaked.

Troubleshooting

IssueWhat to check
401 / unauthorizedBearer header present; token not expired; Client ID active
Tools missing in clientURL ends with /api/mcp/; client supports remote HTTP MCP; restart after config change
Empty or wrong contractsWrong API host (prod vs staging / tenant); token user’s org and access rules
invalid_client on token requestClient ID correct; app Active; secret matches if the app has one

  • OAuth Applications — register Client IDs used for client_credentials
  • API docs / Setting up the API — broader token and REST usage

Summary

Create or reuse an OAuth app, obtain a Bearer token from POST /api/oauth/token (grant_type=client_credentials), point your MCP client at https://api.contracts.ai/api/mcp/ with Authorization: Bearer …, then use ask_contracts, search_contracts, get_contract, and list_renewals.

Did this answer your question?