Tutorials
Connect Claude to a lookup API over MCP
An MCP server lets an AI assistant call lookups as tools instead of you pasting results into a chat. This walkthrough adds the LookValid server to a client, shows the two ways to authenticate, and ends with a terminal check that proves the connection works. Every command below is generated from the same config file the docs use, so it matches the live server.
What the client connects to
The server lives at a single address, https://YOUR_API_HOST/v1/mcp. The MCP specification defines this shape for its Streamable HTTP transport: one HTTP endpoint that accepts POST requests, each carrying one JSON-RPC message 1. The client must send an Accept header listing both application/json and text/event-stream, and the server answers with either a single JSON object or an event stream 1. Your client handles all of that; you only need the address.
Every live product is exposed as a tool. The tool name is the product id with hyphens turned into underscores, so website-contacts-scraper becomes website_contacts_scraper. Each tool takes the same input as its REST endpoint and returns the same envelope, and it is billed from the same credit balance. Create a key in your dashboard and keep it in an environment variable named LOOKVALID_API_KEY, so no key is pasted into a config file.
Add the server to your client
Pick the client you use. In Claude Code, one command registers the server and stores the header with it:
claude mcp add --transport http lookvalid https://YOUR_API_HOST/v1/mcp --header "Authorization: Bearer $LOOKVALID_API_KEY"
Claude Code
In Cursor, put this in .cursor/mcp.json. Cursor expands the environment variable itself, so the key stays out of the file:
{
"mcpServers": {
"lookvalid": {
"url": "https://YOUR_API_HOST/v1/mcp",
"headers": {
"Authorization": "Bearer ${env:LOOKVALID_API_KEY}"
}
}
}
}
Cursor
Codex reads the bearer token from the same variable. Put this in ~/.codex/config.toml:
[mcp_servers.lookvalid]
url = "https://YOUR_API_HOST/v1/mcp"
bearer_token_env_var = "LOOKVALID_API_KEY"
Codex
| Client | Where | How the key is supplied |
|---|---|---|
| Claude Code | A terminal command | The header is stored with the server entry |
| Cursor | .cursor/mcp.json | Expanded from your environment |
| VS Code | .vscode/mcp.json | A one-time password prompt, kept out of the file |
| Codex | ~/.codex/config.toml | Read from LOOKVALID_API_KEY |
Where each snippet goes and how it finds your key
Sign in with OAuth instead of a key
Clients that can open a browser need no key at all. Point them at https://YOUR_API_HOST/v1/mcp/oauth and the server asks for a sign-in. The reason there are two addresses is that the plain address also serves the free tools to callers with no credentials, so it never starts a sign-in by itself.
claude mcp add --transport http lookvalid https://YOUR_API_HOST/v1/mcp/oauth
Claude Code with OAuth
After adding it, run /mcp inside Claude Code and choose the server to sign in.
The flow follows the MCP authorization specification, and these parts of it are what you will see:
- A request with no token gets HTTP 401 and a
WWW-Authenticateheader that carries aresource_metadataaddress. The client reads that document to find the authorization server 2. - The client uses PKCE with the
S256method, which the specification requires of clients 2. - Tokens travel in the
Authorization: Bearerheader on every request and must not appear in a URL query string 2.
Our access tokens last one hour and are renewed with a refresh token that rotates on each use. A token opens the MCP server only, never the REST API, and you can disconnect an app from the Connected apps page in your dashboard.
Test the connection from a terminal
Before debugging a client, send the protocol message it would send. This lists every tool your key can use:
curl -X POST https://YOUR_API_HOST/v1/mcp \
-H "Authorization: Bearer $LOOKVALID_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
List all tools with a key
Drop the Authorization line and the same call lists only the free tools. Without a key you get 25 lookups per day and 5 per 60 seconds from one address, and the keyless website contacts tool crawls at most 3 pages.
curl -X POST https://YOUR_API_HOST/v1/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
List the free tools without a key
Fix the usual problems
| What you see | Why | What to do |
|---|---|---|
| HTTP 401 on connect | A key was sent but it is wrong. A wrong key is never quietly treated as no key | Check the environment variable your client expands, then retry |
| A tool error named unauthorized | You called a paid tool with no key | Add the header, or use the OAuth address |
| A tool error named rate_limited | You passed the free per-address allowance | Wait the number of seconds the error gives, or add a key |
| No tools listed | The client never completed the handshake | Run the curl call above and compare its output with what your client logs |
Symptoms and fixes when connecting
Once the list call works, ask your assistant to check an IP address or read a company website and watch the tool call it makes. The full client list, tool table and limits are in the MCP docs, and the quickstart covers the same lookups over plain REST.
Sources
- Model Context Protocol specification 2025-11-25: Transports, read 2026-10-19
- Model Context Protocol specification 2025-11-25: Authorization, read 2026-10-19