Skip to main content
All MCP guides

MCP setup guide

Use Attorly with OpenAI models

The OpenAI API can call Attorly's MCP server directly, so agents and back ends built on OpenAI models can use its tools for contracts, clauses and legal research.

Before you start

  • An Attorly Pro or Enterprise plan.
  • An OpenAI API key with access to the Responses API.

ChatGPT's own connector settings only add servers that sign in with OAuth. Attorly's MCP server uses API keys, so it connects through the OpenAI API, as below, rather than through ChatGPT's settings.

Steps

  1. Create a key

    Create a key in Settings › Developers and choose OpenAI API. The settings page then shows the steps below with your key already filled in.

    Create a key for OpenAI API
  2. Add Attorly to OpenAI API

    Give an OpenAI model Attorly's tools by adding the MCP server to an OpenAI API request.

    Call the OpenAI Responses API with Attorly as a tool

    bash
    curl https://api.openai.com/v1/responses \
      -H "Authorization: Bearer $OPENAI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
      "model": "gpt-5.5",
      "tools": [
        {
          "type": "mcp",
          "server_label": "attorly",
          "server_url": "https://attorly.ai/api/mcp",
          "headers": {
            "Authorization": "Bearer lbmcp_your_api_key"
          },
          "require_approval": "never"
        }
      ],
      "input": "List my five most recent documents in Attorly and summarise the riskiest one."
    }'

    The same call with the OpenAI Python library

    python
    from openai import OpenAI
    
    client = OpenAI()
    response = client.responses.create(
        model="gpt-5.5",
        tools=[{
            "type": "mcp",
            "server_label": "attorly",
            "server_url": "https://attorly.ai/api/mcp",
            "headers": {"Authorization": "Bearer lbmcp_your_api_key"},
            "require_approval": "never",
        }],
        input="List my five most recent documents in Attorly and summarise the riskiest one.",
    )
    print(response.output_text)
  3. Check that it works

    Run the request. The response lists the Attorly tools the model called and ends with its answer. Calls also appear in Settings › Developers › Request logs.

If it does not work

The response contains an error for the Attorly server.
Check the Authorization header in the request. Error details, such as a missing permission, are in the response's MCP output and in your request log.
The model does not call Attorly.
Say in the input what you want from Attorly, for example “Use Attorly to search the clause library for…”.
Something else went wrong.
Errors such as 401, insufficient_scope and rate_limited are explained in the MCP troubleshooting section. Every call also appears in Settings › Developers › Request logs, with the error it returned. MCP troubleshooting

Other clients