stability: fail fast with clear error when host/token are unset #12

Open
opened 2026-05-23 18:31:01 +00:00 by Klaus · 0 comments
Owner

Problem

cmd/cmd.go defaults GITEA_HOST to https://gitea.com and treats an empty GITEA_ACCESS_TOKEN as "use Authorization header per request". This is fine for HTTP mode, but in stdio mode a missing token surfaces as opaque 401 errors on every tool call — the user has no idea they forgot the env var.

Suggested direction

  • In Execute(), validate that, in stdio mode, a token is set via flag or env. If not, print a one-line setup hint and exit 1 before tool registration.
  • For HTTP mode, log a single Info line at startup describing the auth precedence (header > flag > env) so operators can confirm their setup.
## Problem `cmd/cmd.go` defaults `GITEA_HOST` to `https://gitea.com` and treats an empty `GITEA_ACCESS_TOKEN` as "use Authorization header per request". This is fine for HTTP mode, but in stdio mode a missing token surfaces as opaque 401 errors on every tool call — the user has no idea they forgot the env var. ## Suggested direction - In `Execute()`, validate that, in stdio mode, a token is set via flag or env. If not, print a one-line setup hint and exit 1 before tool registration. - For HTTP mode, log a single `Info` line at startup describing the auth precedence (header > flag > env) so operators can confirm their setup.
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Klaus/gitea-mcp#12