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

# MCP Integration

> Connect the Agntor MCP server to your agent stack

# MCP Integration

The Agntor MCP server exposes 13 tools for agent trust, certification, security, and payments over the [Model Context Protocol](https://modelcontextprotocol.io).

## Install

```bash theme={null}
npm install @agntor/mcp
```

## Connecting to Claude Desktop

Add the Agntor MCP server to your Claude Desktop config (`claude_desktop_config.json`):

```json theme={null}
{
  "mcpServers": {
    "agntor": {
      "command": "npx",
      "args": ["agntor-mcp-server"],
      "env": {
        "AGNTOR_API_KEY": "your-api-key",
        "AGNTOR_SECRET_KEY": "your-secret-key",
        "AGNTOR_API_URL": "http://localhost:3000",
        "AGNTOR_AGENT_ID": "agent://my-agent",
        "AGNTOR_CHAIN": "base"
      }
    }
  }
}
```

## Running the HTTP server

The MCP server also runs as an HTTP endpoint for Streamable HTTP transport:

```bash theme={null}
# Set environment variables
export AGNTOR_SECRET_KEY="your-secret-key"
export AGNTOR_API_KEY="your-api-key"
export PORT=3100

# Start the server
npx agntor-mcp-server
```

The server exposes:

* `POST /mcp` — MCP protocol endpoint (requires API key)
* `GET /health` — health check

## Programmatic usage

```typescript theme={null}
import { createAgntorMcpServer } from '@agntor/mcp';
import { TicketIssuer } from '@agntor/sdk';

const issuer = new TicketIssuer({
  signingKey: process.env.AGNTOR_SECRET_KEY,
  issuer: 'agntor.com',
});

const server = createAgntorMcpServer(issuer);
```

## Available tools

The server registers 13 tools:

### Agent discovery & trust

| Tool                     | Description                                                    |
| ------------------------ | -------------------------------------------------------------- |
| `get_agent_card`         | Retrieve the public AgentCard (passport) for an agent          |
| `get_agent_registration` | Get an EIP-8004 registration file for agent discovery          |
| `is_agent_certified`     | Check if an agent has valid certification                      |
| `get_trust_score`        | Calculate comprehensive trust score with behavioral factors    |
| `check_agent_pulse`      | Get real-time health and behavioral metrics                    |
| `query_agents`           | Search for agents by trust score, audit level, or capabilities |
| `verify_agent_identity`  | Trigger identity verification via the SDK                      |

### Security

| Tool            | Description                                                |
| --------------- | ---------------------------------------------------------- |
| `guard_input`   | Scan prompts for injection attacks and unsafe instructions |
| `redact_output` | Redact PII, secrets, and sensitive data from outputs       |
| `guard_tool`    | Check tool execution against allow/deny policies           |

### Operations

| Tool                   | Description                                        |
| ---------------------- | -------------------------------------------------- |
| `issue_audit_ticket`   | Generate a signed JWT ticket for x402 transactions |
| `create_escrow`        | Create an escrow task for payment                  |
| `activate_kill_switch` | Emergency disable an agent                         |

## Environment variables

| Variable            | Required | Description                                                        |
| ------------------- | -------- | ------------------------------------------------------------------ |
| `AGNTOR_SECRET_KEY` | Yes      | Secret key for JWT ticket signing                                  |
| `AGNTOR_API_KEY`    | Yes      | API key for authentication                                         |
| `AGNTOR_API_URL`    | No       | API base URL (default: `http://localhost:3000`)                    |
| `AGNTOR_AGENT_ID`   | No       | Agent ID for the MCP server itself (default: `agent://mcp-server`) |
| `AGNTOR_CHAIN`      | No       | Blockchain network (default: `base`)                               |
| `PORT`              | No       | HTTP server port (default: `3100`)                                 |

## Security

The HTTP server validates API keys on every `/mcp` request via the `x-agntor-api-key` header or `Authorization: Bearer` header. Keys are checked against:

1. The `AGNTOR_API_KEY` environment variable (bootstrap key)
2. The database `api_keys` table (for production multi-tenant setups)

In development mode (no `AGNTOR_API_KEY` set), authentication is bypassed.
