# AGENTS.md — Go2

Links for AI agents.

Go2 is the link, attribution, and click-event primitive for AI agents. Every link an agent creates carries (agent_id, run_id, tool_call_id, actor_id) — captured at the edge, queryable from REST, MCP, or webhooks. Built on Cloudflare Workers + D1 + KV. Open source (AGPL). Humans get a dashboard; agents get a tool.

## Machine-readable references

- LLM index: https://go2.gg/llms.txt
- Full LLM corpus: https://go2.gg/llms-full.txt
- OpenAPI: https://go2.gg/openapi.json
- MCP discovery: https://go2.gg/.well-known/mcp.json
- ChatGPT plugin manifest: https://go2.gg/.well-known/ai-plugin.json

## How to call Go2

### MCP (recommended)

Stdio:
```bash
npx -y @go2/mcp-server@latest --api-key "$GO2_API_KEY"
```

Remote (OAuth 2.1):
- Streamable HTTP: https://mcp.go2.gg/mcp
- SSE: https://mcp.go2.gg/sse
- Authorization: https://api.go2.gg/api/v1/auth/oauth2/authorize

### REST

```bash
curl -X POST https://api.go2.gg/api/v1/links \
  -H "Authorization: Bearer $GO2_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"destinationUrl":"https://example.com","agentId":"claude-code","agentRunId":"<run-uuid>"}'
```

## Agent attribution conventions

- `link` — A short URL with destination, expiry, geo/device targeting, password gating, click cap, and optional agent attribution context.
- `click` — A single redirect event with geo, device, browser, OS, referrer, bot detection, uniqueness, and any agent attribution captured at redirect time.
- `agent_id` — Stable identifier for the agent that created or invoked the link (e.g. claude-code, cursor, gpt-5-task-runner).
- `agent_run_id` — Per-execution identifier so you can attribute every click back to the specific agent run that produced the link.
- `agent_actor_id` — Optional end-user / persona identifier for the human the agent acted on behalf of.
- `agent_tool_call_id` — Optional MCP tool-call id captured at click time so individual tool invocations resolve to clicks.

## Available MCP tools

- `create_link` (links) — Create a short link.
- `list_links` (links) — List links for the authenticated org.
- `get_link` (links) — Fetch a single link by id.
- `update_link` (links) — Update an existing link.
- `delete_link` (links) — Archive a link.
- `bulk_create_links` (links) — Create many links in one call.
- `get_analytics` (links) — Per-link analytics roll-up.
- `track_agent_link` (attribution) — Create a link and stamp it with agent_id, agent_run_id, agent_actor_id.
- `get_run_attribution` (attribution) — Click stream for a given agent_run_id / agent_id / link.
- `list_agent_runs` (attribution) — Distinct agent runs with click counts and first/last timestamps.
- `create_revocable_link` (lifecycle) — Create a single-use link that 410s after one click.
- `create_expiring_link` (lifecycle) — Create a link with TTL in minutes.
- `revoke_run_links` (lifecycle) — Archive every link associated with a given agent_run_id.
- `search_docs` (docs) — Search Go2 documentation.
- `get_doc` (docs) — Fetch a documentation page by slug.
- `list_docs` (docs) — Enumerate documentation pages.

## Authentication

Get an API key from https://go2.gg/dashboard/developer. For remote MCP, complete OAuth 2.1 sign-in via the authorization URL above.

