# errorgap — AI installation guides

errorgap is a managed error-tracking and observability platform. These guides are written for AI coding agents installing an errorgap SDK into an application or `errorgap-agent` into a deployment.

## Server agent

- [errorgap-agent for logs and infrastructure metrics](./errorgap-agent.md)

The remaining sections document application SDK installation.

## Reading production context (MCP)

These guides cover *sending* data to errorgap. To *read* it back — errors,
incidents, likely causes, proposed fixes — errorgap runs an MCP server:

- Endpoint: `POST /mcp` on your organization's origin, e.g. `https://<your-org>.errorgap.com/mcp`
- Transport: JSON-RPC 2.0 (`initialize`, `tools/list`, `tools/call`)
- Auth: `Authorization: Bearer <agent token>` — created in the app under
  Organization → Agent access
- Tools: `list_errors`, `get_error`, `list_incidents`, `get_incident`,
  `explain_incident`, `find_likely_cause`, `propose_fix`, `uptime_status`
- Exposure is scoped per project across six data categories, with regex
  redaction applied before anything reaches an agent.

Full reference: https://errorgap.com/docs/organization/agent-access

## Values you need

These are provided in the prompt that referred you here. They are referred to as placeholders throughout these docs:

- `ERRORGAP_API_KEY` — project API key (format `flk_...`)
- `ERRORGAP_ENDPOINT` — base URL of the errorgap instance (no trailing slash)
- `ERRORGAP_PROJECT_SLUG` — project identifier

Never commit the API key to version control. Prefer environment variables or the framework's secret mechanism.

## API basics

- Error ingestion: `POST {ERRORGAP_ENDPOINT}/api/projects/{ERRORGAP_PROJECT_SLUG}/notices`
- Auth header: `x-errorgap-project-key: {ERRORGAP_API_KEY}`
- Minimal payload:

```json
{"errors":[{"type":"SomeError","message":"description"}]}
```

Optional fields: `context` (object; `context.environment` sets the environment), `environment`, `session`, `params`, and per-error `backtrace` (array of `{file, line, function}`).

- Success response: HTTP `201` with JSON containing `group_id`. HTTP `202` means the event was received but sampled or rate-limited — still a successful connection.
- HTTP `401` means the API key is wrong or missing.

## Verification

After configuring the SDK, verify connectivity directly:

```sh
curl -sS -X POST "$ERRORGAP_ENDPOINT/api/projects/$ERRORGAP_PROJECT_SLUG/notices" \
  -H "content-type: application/json" \
  -H "x-errorgap-project-key: $ERRORGAP_API_KEY" \
  -d '{"errors":[{"type":"ErrorgapInstallTest","message":"Errorgap install verification"}],"context":{"environment":"development"}}'
```

Then trigger a real error through the installed SDK to prove the in-app integration works. The user's errorgap onboarding screen ("Send test event" step) advances automatically once any event arrives.

## Per-stack guides

- [Ruby on Rails](./rails.md)
- [Rack / Sinatra](./rack.md)
- [Node.js](./node.md)
- [Browser JavaScript / React](./browser.md)
- [Python / Django](./django.md)
- [Python / Flask](./flask.md)
- [Python / FastAPI](./fastapi.md)
- [Laravel](./laravel.md)
- [PHP (Symfony / plain)](./php.md)
- [WordPress](./wordpress.md)
- [Go](./go.md)
- [Java / Spring Boot](./java.md)
- [.NET / ASP.NET Core](./dotnet.md)
- [Elixir / Phoenix](./elixir.md)
- [iOS / macOS (Swift)](./swift.md)
- [Android (Kotlin)](./android.md)
- [React Native](./react-native.md)
- [Flutter](./flutter.md)
- [Rust](./rust.md)
- [Deno](./deno.md)
- [Bun](./bun.md)
- [Nuxt](./nuxt.md)
- [Next.js](./nextjs.md)
- [Other / plain HTTP](./http.md)
