Commit Graph
1 Commits
Author SHA1 Message Date
lucio cc26953d5e Add POST /api/links REST endpoint for short-link creation
Programmatic short-link creation that shares the same bearer key as the
MCP endpoint. Registered only when [mcp].enabled is true and api_key is
set, so a misconfigured server never exposes the route unauthenticated;
unauthenticated visitors hitting /api/links get a plain 404.

- POST /api/links accepts {"url","slug?"}, returns 201/200 with the
  same snake_case payload shape as the MCP create_link tool.
- Constant-time Bearer / X-API-Key auth (reuses mcpAPIKeyAuth helper).
- 4 KB body cap, DisallowUnknownFields, URL auto-scheme, dedupe on URL.
- 13 unit tests cover auth, validation, dedupe, and duplicate-slug.
2026-06-08 21:17:39 -07:00