Skip to content

fix(mcp): fail fast when seerr.server is not configured#74

Merged
electather merged 1 commit intofix/normalize-server-urlfrom
fix/mcp-fail-fast-no-server
Mar 16, 2026
Merged

fix(mcp): fail fast when seerr.server is not configured#74
electather merged 1 commit intofix/normalize-server-urlfrom
fix/mcp-fail-fast-no-server

Conversation

@electather
Copy link
Owner

Summary

mcp serve previously started the HTTP listener (or stdio transport) even when seerr.server was not configured, causing confusing failures only when a tool was first called. This PR adds an explicit validation step that rejects the blank-or-slash-only case immediately after logger init, before any tool is registered or any port is bound.

Depends on #72 (NormalizeServerURL).

Closes #64

Changes

  • Call ValidateServeConfig() early in runServe, after initLogger and before auth/transport validation
  • Add ValidateServeConfig() error as an exported function so unit tests can exercise it without starting the server
  • Import seerr-cli/cmd/apiutil in serve.go to reuse NormalizeServerURL for the empty-after-normalisation check
  • Add table-driven tests covering missing server, slash-only value, valid URL, and valid URL with trailing slash

Test plan

  • go test -v ./... passes
  • go fmt ./... produces no diff
  • go build succeeds

Checklist

  • New tests added for new behaviour
  • Documentation updated (README, command --help, comments)
  • No unrelated changes included

Validate seerr.server immediately after logger init in runServe so the
process exits with a clear error before registering tools or binding a
port. Uses NormalizeServerURL so trailing-slash-only values are also
rejected. Adds ValidateServeConfig as an exported helper for unit tests.

Closes #64
@electather electather merged commit c576502 into fix/normalize-server-url Mar 16, 2026
@electather electather deleted the fix/mcp-fail-fast-no-server branch March 16, 2026 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant