# Connect an AI agent

Chain.Love MCP Gateway exposes a hosted MCP endpoint that an AI agent can use as a Web3 gateway:

```
https://app.chain.love/mcp
```

{% hint style="info" %}
The hosted Chain.Love gateway currently does not require authorization. For most setups, you only need the endpoint URL below.
{% endhint %}

## Basic connection flow

Use this quick setup flow first, then copy the config example that matches your case.

{% stepper %}
{% step %}

#### Add the public endpoint

Add `https://app.chain.love/mcp` to your MCP-compatible AI agent. This is enough for public gateway access.
{% endstep %}

{% step %}

#### Add optional token or downstream credentials

If you want to use a Chain.Love token, add `Authorization: Bearer <CHAINLOVE_MCP_TOKEN>`. If a private MCP needs its own credentials, pass them as `x-chainlove-cred-*` headers in the same MCP config.
{% endstep %}

{% step %}

#### Restart or reload your agent

Most AI clients load MCP configuration on startup. Restart the client or reload its MCP servers after changing the config.
{% endstep %}

{% step %}

#### Test discovery

Ask the agent to call `discover_networks`. If the configuration is correct, it should return the list of supported chain keys.
{% endstep %}
{% endstepper %}

***

## Minimal `mcp_config.json` example

```json
{
  "mcpServers": {
    "chainlove-gateway": {
      "url": "https://app.chain.love/mcp"
    }
  }
}
```

## Optional Chain.Love token

If you want to create a Chain.Love token, open the Chain.Love UI:

<https://app.chain.love/user>

Use it as an HTTP bearer token in your MCP client:

```json
{
  "mcpServers": {
    "chainlove-gateway": {
      "url": "https://app.chain.love/mcp",
      "headers": {
        "Authorization": "Bearer <CHAINLOVE_MCP_TOKEN>"
      }
    }
  }
}
```

Token hygiene:

* Store the token in local config or a secret manager.
* Never commit real tokens into Git, screenshots, examples, or public issues.
* Rotate the token if it was exposed.

## Downstream credentials for private MCP servers

Use the hosted gateway URL in your MCP client and add downstream credentials only when a private MCP requires them, using `x-chainlove-cred-<credentialKey>` headers.

To understand which header name you need, open the open-source registry file at [mcpservers.csv](https://github.com/Chain-Love/chain-love/blob/main/references/offers/mcpservers.csv) or browse the UI at <https://app.chain.love/toolbox/mcpservers>, choose the MCP server you want, and check its `credentialKey` value.

## Generic private MCP credential pattern

```json
{
  "mcpServers": {
    "chainlove-gateway": {
      "url": "https://app.chain.love/mcp",
      "headers": {
        "x-chainlove-cred-<credentialKey>": "<credentialValue>"
      }
    }
  }
}
```

## Example: GitHub MCP

```json
{
  "mcpServers": {
    "chainlove-gateway": {
      "url": "https://app.chain.love/mcp",
      "headers": {
        "x-chainlove-cred-github": "<GITHUB_TOKEN>"
      }
    }
  }
}
```

For GitHub MCP, the `credentialKey` is `github`, so the header becomes `x-chainlove-cred-github`.

***

## Self-hosted MCP servers

Self-hosted MCP servers cannot be proxied through the public hosted endpoint. They need to be deployed and run locally in the user's environment. Chain.Love can help the agent understand how that MCP should be set up in the local workspace so the agent can connect to it directly.

***

## First test prompt

After restarting your agent, ask:

```
Use Chain.Love MCP and call discover_networks. Which networks are supported?
```

Then try a registry search:

```
Use Chain.Love MCP to search for GitHub MCP in the mcpservers category.
```

{% hint style="info" %}
For a visual overview and more examples, see the MCP Gateway landing page: <https://chain.love/mcp-gateway>
{% endhint %}
