OpenTelemetry Pattern Refactoring Plan
Implementation Status
Overview
Original State
Proposed Structure
oauth-mcp-proxy/
├── [core package - SDK-agnostic]
│ ├── server.go (Server, NewServer, RegisterHandlers, WrapHandler)
│ ├── config.go (Config, validation)
│ ├── cache.go (TokenCache, token caching logic)
│ ├── context.go (WithOAuthToken, GetOAuthToken, GetUserFromContext)
│ ├── handlers.go (OAuth HTTP endpoints)
│ ├── logger.go (Logger interface, defaultLogger)
│ ├── metadata.go (OAuth metadata structures)
│ └── provider/ (TokenValidator interface, HMAC/OIDC validators)
│ ├── provider.go
│ └── provider_test.go
│
├── mark3labs/ [SDK-specific adapter]
│ ├── oauth.go (WithOAuth → ServerOption)
│ └── middleware.go (Middleware adapter for mark3labs types)
│
└── mcp/ [SDK-specific adapter]
└── oauth.go (WithOAuth → http.Handler)Package Naming Convention
API Examples
mark3labs (existing SDK)
Official SDK (new support)
Pros
1. Clean Separation of Concerns
2. Easier Maintenance
3. Clear API Contracts
4. Discoverability
5. Future Extensibility
6. Follows Go Ecosystem Patterns
Cons
1. Import Path Changes (Breaking Change)
2. Requires Major Version Bump
3. More Files
4. Documentation Updates Required
Refactoring Complexity Assessment
Code Distribution
Component
Lines
Location
Effort
What Moves Where
Migration Effort Breakdown
Phase
Tasks
Time Estimate
Migration Strategy
For Library Maintainers
For Library Users
Implementation Results
What Was Implemented
Implementation Time
Deviations from Plan
Outstanding Work
Open Questions
Answered (Based on Gemini 2.5 Pro Review)
References
Last updated
Was this helpful?