# Claude Code Integration

Anthropic's terminal-based agent. It speaks MCP natively over HTTP, so no bridge package is needed — the APILayer MCP adapter is added with a single \`**claude mcp add**\` command.

## **Prerequisites**

-   Claude Code installed and authenticated (\`**claude --version**\` works).
-   A MCP Bearer token with \`**mcp\_access\_enabled**\` on the subscription.

## **Add the server (Bearer token)**

<table><colgroup><col></colgroup><tbody><tr><td><p><span>claude mcp add \</span></p><p><span>&nbsp;&nbsp;--transport http \</span></p><p><span>&nbsp;&nbsp;--header "Authorization: Bearer YOUR_APILAYER_MCP_TOKEN" \</span></p><p><span>&nbsp;&nbsp;apilayer https://mcp.apilayer.com/mcp</span></p></td></tr></tbody></table>

The token is stored in Claude Code's MCP config and resent on every request. Scope it to one APILayer product (portal:<name> claim); mint a separate server entry per product.

**Scope: user vs. project**

By default the server is added at user scope (available in every Claude Code session). Add --scope project to record the entry in the current repo's **.mcp.json** instead, so teammates inherit it:

<table><colgroup><col></colgroup><tbody><tr><td><p><span>claude mcp add --scope project --transport http \</span></p><p><span>&nbsp;&nbsp;--header "Authorization: Bearer $APILAYER_MCP_TOKEN" \</span></p><p><span>&nbsp;&nbsp;apilayer https://mcp.apilayer.com/mcp</span></p></td></tr></tbody></table>

In project scope, **never commit a literal token** — reference an env var and have each developer export it locally.

When Claude Code prompts for the tool's arguments, include token:

<table><colgroup><col></colgroup><tbody><tr><td><span>{ "ip": "8.8.8.8", "apiKey": "your-apilayer-access-key" }</span></td></tr></tbody></table>

## **Verify Integration**

List configured servers:

<table><colgroup><col></colgroup><tbody><tr><td><span>claude mcp list</span></td></tr></tbody></table>

Once configured. Examples:

-   "What country and city is the IP address 8.8.8.8 located in?"  (uses ipstack\_lookup)
-   “Get location details for {IP\_ADDRESS}.” (uses ipstack\_lookup)
-   “What region does IP {IP\_ADDRESS} belong to?”

You should see **ipstack\_lookup** fire and return country / city / lat / lng.

## **Troubleshooting**

**Server shows red / connection failed.** Run **claude mcp get apilayer** — confirm the URL ends with **/mcp** and the header is present. Hit the endpoint manually to rule out network issues:

<table><colgroup><col></colgroup><tbody><tr><td><p><span>curl -i -H "Authorization: Bearer $APILAYER_MCP_TOKEN" \</span></p><p><span>&nbsp;&nbsp;-H "Accept: application/json, text/event-stream" \</span></p><p><span>&nbsp;&nbsp;https://mcp.apilayer.com/mcp</span></p></td></tr></tbody></table>

**Not authorized on every tool call**

-   Bearer token missing the **portal:<IPStack>** scope — mint a new one.
-   Subscription lacks **features.mcp\_access\_enabled** — requires Professional+.

**Updating or removing the entry.**

<table><colgroup><col></colgroup><tbody><tr><td><p><span>claude mcp remove apilayer</span></p><p><span>claude mcp add --transport http --header "Authorization: Bearer $NEW_TOKEN" \</span></p><p><span>&nbsp;&nbsp;apilayer https://mcp.apilayer.com/mcp</span></p></td></tr></tbody></table>

## **Tool Catalog**

| **Tool** | **Description** |
| --- | --- |
| ipstack\_lookup | Geolocation + security for a single IP. |
| ipstack\_check | Geolocation + security for the caller's own IP. |
| ipstack\_bulk\_lookup | Geolocation + security for a comma-separated list of IPs. |
