Skip to content

Feature: Share the HTTP server plumbing via pkg/mcphttp - #476

Merged
rafaeljusto merged 1 commit into
mainfrom
feature/expose-pkgs
Aug 19, 2026
Merged

Feature: Share the HTTP server plumbing via pkg/mcphttp#476
rafaeljusto merged 1 commit into
mainfrom
feature/expose-pkgs

Conversation

@rafaeljusto

Copy link
Copy Markdown
Contributor

Description

The middleware chain, bearer auth and the health and RFC 9728 endpoints lived in cmd/mcp-http, a main package, so another server could only copy them. Auth especially must not be forked: two copies drift, and the one that drifts stops rejecting what it should.

Moved to pkg/mcphttp and wired this server onto it too, which is what actually keeps the two from diverging.

Also adds config.WithDefaultMCPURL. MCPURL was hardcoded to this server's host, so a second server left it advertising the wrong "resource" and pointing its 401 challenges here.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Testing

  • Tests pass locally (go test -v ./...)
  • Added/updated tests for new functionality

Checklist

  • Code follows project style guidelines
  • Self-reviewed the code
  • Added necessary documentation
  • No new warnings or errors

The middleware chain, bearer auth and the health and RFC 9728 endpoints
lived in cmd/mcp-http, a main package, so another server could only copy
them. Auth especially must not be forked: two copies drift, and the one
that drifts stops rejecting what it should.

Moved to pkg/mcphttp and wired this server onto it too, which is what
actually keeps the two from diverging. main.go drops 616 -> 243 lines;
the server-specific bits (favicon, homepage redirect, OpenAI challenge)
stay put.

Also adds config.WithDefaultMCPURL. MCPURL was hardcoded to this
server's host, so a second server left it advertising the wrong
"resource" and pointing its 401 challenges here. The env var still wins.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@rafaeljusto
rafaeljusto requested a review from a team as a code owner August 19, 2026 16:28
@rafaeljusto
rafaeljusto merged commit 117e43b into main Aug 19, 2026
4 checks passed
@rafaeljusto
rafaeljusto deleted the feature/expose-pkgs branch August 19, 2026 16:42
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