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

# Event batching and delivery

> How mcp-tap buffers and sends events

Both libraries buffer events and send them in batches via HTTP POST to the configured endpoint.

## Parameters

| Parameter       | Value                                                  |
| --------------- | ------------------------------------------------------ |
| Flush interval  | 2 seconds                                              |
| Flush threshold | 20 events                                              |
| Transport       | HTTP POST with JSON body                               |
| Auth header     | `x-api-key: <apiKey>`                                  |
| Error handling  | All errors silently swallowed — never affects host app |

## TypeScript

Uses `globalThis.fetch`. The timer is `unref`'d so it doesn't keep the process alive. Call `shutdown()` to flush remaining events and stop the timer.

## Python

Uses `urllib.request` (stdlib). The timer is a daemon thread. An `atexit` handler calls `shutdown()` automatically on process exit.
