> ## Documentation Index
> Fetch the complete documentation index at: https://portkey-docs-feat-rerank-documentation.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Observability

> Log, monitor, and debug MCP interactions.

Every MCP request through the gateway is logged automatically. No setup required.

## What gets logged

Each request captures:

| Field      | Description            |
| ---------- | ---------------------- |
| Tool       | Which tool was called  |
| Parameters | Request payload        |
| Response   | Full response data     |
| User       | Who made the request   |
| Team       | Which team (workspace) |
| Timestamp  | When it happened       |
| Latency    | How long it took       |
| Status     | Success or error       |
| MCP Server | Which upstream server  |

## View logs

Go to **Logs** in the dashboard. Filter by:

* MCP server
* Team
* User
* Tool name
* Time range
* Status (success/error)

Click any entry for full details: the exact request parameters sent, the response received, and timing breakdown.

## Usage analytics

The dashboard shows aggregate metrics:

* Requests over time
* Requests by server
* Requests by team
* Requests by user
* Error rates
* Latency percentiles
* Most used tools

Use these to understand adoption patterns. Which tools are popular? Which teams are using MCP the most? Are error rates increasing?

## Debugging

When something breaks, logs tell you exactly what happened.

**Tool returning errors?** Check the response data. The MCP server's error message is captured.

**Wrong results?** Check the parameters. Maybe the agent sent incorrect arguments.

**Slow responses?** Check the latency breakdown. Is it the MCP server or the network?

**Access denied?** Check the user and team. Do they have permission for this tool?

A typical debugging flow:

1. Filter logs by the user who reported the issue
2. Find the failing request
3. Check parameters and response
4. Identify the root cause

## Metadata

Each request includes rich context from authentication, available for both API key and OAuth flows:

| Field               | Description                                   |
| ------------------- | --------------------------------------------- |
| `organisation_id`   | Organization identifier                       |
| `organisation_name` | Organization display name                     |
| `workspace_id`      | Workspace identifier                          |
| `workspace_name`    | Workspace display name                        |
| `workspace_slug`    | Workspace slug                                |
| `user_id`           | User identifier                               |
| `api_key_id`        | API key identifier (if using API key auth)    |
| `mcp_server_id`     | Which MCP server handled the request          |
| `mcp.auth.type`     | Authentication method (`api_key` or `Bearer`) |

This metadata enables:

* Per-user usage tracking
* Per-team cost allocation
* Compliance auditing
* Chargeback reporting
* Authentication flow analysis

## Forward metadata to MCP servers

Use [Identity Forwarding](/product/mcp-gateway/authentication/identity-forwarding) to send user context to MCP servers.

The MCP server receives information about who made the request. It can then:

* Log with Portkey context
* Enforce its own access controls
* Personalize responses
* Attribute actions to users

## Integration with AI Gateway

For Portkey AI Gateway users, MCP logs integrate with existing observability:

* Traces span LLM calls and tool use
* Single dashboard for agent activity
* Correlate tool calls with model outputs
* See the full picture of what your agents are doing
