> ## Documentation Index
> Fetch the complete documentation index at: https://glasser.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up with MCP

> Connect any MCP client that can send a header: search, inspect and run paid endpoints under one Key.

For agents that cannot shell out. The data sources as a remote Model Context Protocol server: the
same seven operations as the CLI, the same Key, no install.

<Steps>
  <Step title="Get a Key">
    Create one at [app.glasser.ai/keys](https://app.glasser.ai/keys). Its value is shown once —
    copy it then. If you lose it, revoke that Key and create another.

    Export it as `GLASSER_API_KEY` and reference the variable in your client config instead of
    pasting the Key into a file.
  </Step>

  <Step title="Connect your client">
    <CodeGroup>
      ```bash Claude Code theme={null}
      claude mcp add-json glasser \
        '{"type":"http","url":"https://api.glasser.ai/mcp","headers":{"Authorization":"Bearer ${GLASSER_API_KEY}"}}'
      ```

      ```toml Codex theme={null}
      # ~/.codex/config.toml
      [mcp_servers.glasser]
      url = "https://api.glasser.ai/mcp"
      bearer_token_env_var = "GLASSER_API_KEY"
      ```

      ```json Cursor theme={null}
      // .cursor/mcp.json
      {
        "mcpServers": {
          "glasser": {
            "url": "https://api.glasser.ai/mcp",
            "headers": { "Authorization": "Bearer ${env:GLASSER_API_KEY}" }
          }
        }
      }
      ```

      ```json OpenCode theme={null}
      // opencode.json
      {
        "mcp": {
          "glasser": {
            "type": "remote",
            "url": "https://api.glasser.ai/mcp",
            "enabled": true,
            "headers": { "Authorization": "Bearer {env:GLASSER_API_KEY}" }
          }
        }
      }
      ```
    </CodeGroup>

    Using a different client? Any MCP client that can send an `Authorization` header works —
    copy the URL and header from the Cursor example into its config format.

    Clients that only accept a URL and sign in with OAuth — the Claude.ai web connector, ChatGPT —
    cannot connect yet. OAuth is the next phase of this server; connecting with a Key will keep
    working when it lands.
  </Step>

  <Step title="Try a prompt">
    Your agent now has tools to search the data sources, inspect a price, run an endpoint and read
    the result. Try one of these:

    <AccordionGroup>
      <Accordion title="Enrich a person">
        Using Glasser, enrich a person. Ask me for their name and current company if you don't
        know them, then pull their work history, education and public profiles, and tell me what
        the call cost.
      </Accordion>

      <Accordion title="Competitor research">
        Do a competitor research report using Glasser. Ask me which company to research, then
        pull its firmographics, recent news and web presence, and compare it with two competitors.
      </Accordion>

      <Accordion title="Who is hiring">
        Using Glasser, find companies hiring for a role. Ask me for the role and location, then
        list open postings with company, title and posting date.
      </Accordion>

      <Accordion title="Keyword research">
        Using Glasser, research keywords for a niche. Ask me for the topic and the market, then
        return search volume and related keyword ideas, ranked.
      </Accordion>
    </AccordionGroup>
  </Step>
</Steps>

## Endpoint

```
POST https://api.glasser.ai/mcp
```

Stateless Streamable HTTP with JSON responses. Authentication is the same Bearer Key as the
HTTP API; there is no session, so every request stands on its own.

## Tools

Seven static tools — the same operations as the CLI and the HTTP API. The data sources themselves stay
behind `search`: endpoints are data the agent discovers at run time, never one tool each.

| Tool        | Purpose                                                                                         |
| ----------- | ----------------------------------------------------------------------------------------------- |
| `search`    | Search the data sources — runnable paid endpoints; results are filtered to what the Key may run |
| `inspect`   | One endpoint's input schema, exact Price with every charge clause, current version, run mode    |
| `run`       | Execute an endpoint and charge per call; requires an idempotency\_key you generate              |
| `runs_get`  | One Run by id: status, output, provider\_response, charge                                       |
| `runs_list` | The Workspace's Runs, newest first, cursor-paginated                                            |
| `runs_stop` | Stop an in-flight Run; before dispatch it becomes STOPPED and free                              |
| `balance`   | Balance, held and available; doubles as the auth probe                                          |

## Rules that keep spending safe

The server sends these to the agent at the start of every session — the same rules the
[Skill](/docs/setup-skill) teaches CLI agents.

* Your own keys and integrations outrank Glasser. The agent uses it to fill gaps, never to route
  around what you already have.
* `run` requires an `idempotency_key` the agent generates. Retry with the SAME key and the
  original Run comes back instead of a second charge — the result carries `replayed: true`.
* No speculative, looped or bulk runs without naming the per-call Price and getting your
  go-ahead. Volume parameters start small.
* Every Run reports `charge_usd` as an exact decimal string. Status and charge are independent:
  a provider 404 is a COMPLETED Run, charged per the endpoint's published clauses from `inspect`.
* Refusals the agent can act on — `insufficient_balance`, `rate_limited` with `retry_after_ms`,
  policy refusals — come back as tool results with `isError`, never as protocol errors that abort
  the loop.

## When to prefer the CLI

If your agent has a shell, the [Skill](/docs/setup-skill) plus the [CLI](/docs/cli) is the recommended
path — commands compose with the rest of the shell, and the Skill carries the full working
agreement. Use MCP when the runtime cannot shell out.
