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

# Debug HTTP Connections and Sessions

> Use the built-in debug logs and the current HTTP transport behavior to troubleshoot client connections.

When an HTTP client cannot connect, debug the transport before you debug your tools.

## Turn on transport logs

```ts theme={null}
app.listen({
  port: Number(process.env.PORT ?? 3000),
  hostname: "0.0.0.0",
  cors: true,
  debug: true,
});
```

That prints request, session, initialize, and response logs from the HTTP transport.

## Check the endpoint first

The MCP URL is:

```txt theme={null}
http://localhost:3000/mcp
```

Do not point clients at `/mcp/health` or `/mcp/schema`. The current transport does not mount those routes by default. If you enabled `health`, use that custom path for platform checks only, not as the MCP client endpoint.

## What the current transport serves

* `POST /mcp` for JSON-RPC (and `subscriptions/listen` SSE on MCP `2026-07-28`)
* `GET /mcp` for the legacy sessioned event stream
* `DELETE /mcp` for legacy session termination
* an optional health route when you enable `health`

## Practical compatibility notes

* the transport negotiates MCP protocol versions with the client (`2026-07-28` through `2024-11-05`)
* MCP `2026-07-28` is stateless: no `Mcp-Session-Id`, but `Mcp-Method` / `Mcp-Name` are required
* older clients still use sessions and Inspector-style `GET` SSE flows
* it accepts client-provided session IDs for better tooling interoperability on legacy versions

## Common checks

* make sure the client uses the `/mcp` path
* keep one simple tool like `ping` until the handshake succeeds
* if you are using stdio, send logs to stderr, not stdout
