Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"sync"
"time"

"github.com/tuannvm/oauth-mcp-proxy/provider"
"github.com/Vungle/oauth-mcp-proxy/provider"
)

// Re-export User from provider for backwards compatibility
Expand Down
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package oauth
import (
"fmt"

"github.com/tuannvm/oauth-mcp-proxy/provider"
"github.com/Vungle/oauth-mcp-proxy/provider"
)

// Config holds OAuth configuration
Expand Down
2 changes: 1 addition & 1 deletion context_propagation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

"github.com/Vungle/oauth-mcp-proxy/provider"
"github.com/golang-jwt/jwt/v5"
"github.com/mark3labs/mcp-go/mcp"
"github.com/tuannvm/oauth-mcp-proxy/provider"
)

// TestContextPropagation validates Phase 2.1 context propagation fix
Expand Down
4 changes: 2 additions & 2 deletions examples/mark3labs/advanced/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"net/http"
"os"

oauth "github.com/Vungle/oauth-mcp-proxy"
"github.com/Vungle/oauth-mcp-proxy/mark3labs"
"github.com/mark3labs/mcp-go/mcp"
mcpserver "github.com/mark3labs/mcp-go/server"
oauth "github.com/tuannvm/oauth-mcp-proxy"
"github.com/tuannvm/oauth-mcp-proxy/mark3labs"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/mark3labs/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"net/http"
"os"

oauth "github.com/Vungle/oauth-mcp-proxy"
"github.com/Vungle/oauth-mcp-proxy/mark3labs"
"github.com/mark3labs/mcp-go/mcp"
mcpserver "github.com/mark3labs/mcp-go/server"
oauth "github.com/tuannvm/oauth-mcp-proxy"
"github.com/tuannvm/oauth-mcp-proxy/mark3labs"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/official/advanced/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
"os"
"time"

oauth "github.com/Vungle/oauth-mcp-proxy"
mcpoauth "github.com/Vungle/oauth-mcp-proxy/mcp"
"github.com/modelcontextprotocol/go-sdk/mcp"
oauth "github.com/tuannvm/oauth-mcp-proxy"
mcpoauth "github.com/tuannvm/oauth-mcp-proxy/mcp"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions examples/official/simple/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (
"net/http"
"os"

oauth "github.com/Vungle/oauth-mcp-proxy"
mcpoauth "github.com/Vungle/oauth-mcp-proxy/mcp"
"github.com/modelcontextprotocol/go-sdk/mcp"
oauth "github.com/tuannvm/oauth-mcp-proxy"
mcpoauth "github.com/tuannvm/oauth-mcp-proxy/mcp"
)

func main() {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/tuannvm/oauth-mcp-proxy
module github.com/Vungle/oauth-mcp-proxy

go 1.24.9

Expand Down
2 changes: 1 addition & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"testing"
"time"

"github.com/Vungle/oauth-mcp-proxy/provider"
"github.com/golang-jwt/jwt/v5"
"github.com/mark3labs/mcp-go/mcp"
mcpserver "github.com/mark3labs/mcp-go/server"
"github.com/tuannvm/oauth-mcp-proxy/provider"
)

// TestIntegration validates core architecture and integration.
Expand Down
2 changes: 1 addition & 1 deletion mark3labs/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"fmt"

oauth "github.com/Vungle/oauth-mcp-proxy"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
oauth "github.com/tuannvm/oauth-mcp-proxy"
)

// NewMiddleware creates an authentication middleware for mark3labs/mcp-go SDK.
Expand Down
2 changes: 1 addition & 1 deletion mark3labs/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"net/http"

oauth "github.com/Vungle/oauth-mcp-proxy"
mcpserver "github.com/mark3labs/mcp-go/server"
oauth "github.com/tuannvm/oauth-mcp-proxy"
)

// WithOAuth returns a server option that enables OAuth authentication
Expand Down
2 changes: 1 addition & 1 deletion mcp/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http"
"strings"

oauth "github.com/Vungle/oauth-mcp-proxy"
"github.com/modelcontextprotocol/go-sdk/mcp"
oauth "github.com/tuannvm/oauth-mcp-proxy"
)

// WithOAuth returns an OAuth-protected HTTP handler for the official
Expand Down
2 changes: 1 addition & 1 deletion middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (
"strings"
"time"

"github.com/Vungle/oauth-mcp-proxy/provider"
"github.com/mark3labs/mcp-go/mcp"
"github.com/mark3labs/mcp-go/server"
"github.com/tuannvm/oauth-mcp-proxy/provider"
)

// Middleware returns an authentication middleware for MCP tools.
Expand Down
29 changes: 20 additions & 9 deletions oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/http/httputil"
"strings"
"time"

"github.com/Vungle/oauth-mcp-proxy/provider"
mcpserver "github.com/mark3labs/mcp-go/server"
"github.com/tuannvm/oauth-mcp-proxy/provider"
)

// Server represents an OAuth authentication server instance.
Expand Down Expand Up @@ -90,14 +91,24 @@ func NewServer(cfg *Config) (*Server, error) {
// Note: WithOAuth() calls this automatically. Only call directly if using
// NewServer() for advanced use cases.
func (s *Server) RegisterHandlers(mux *http.ServeMux) {
mux.HandleFunc("/.well-known/oauth-authorization-server", s.handler.HandleAuthorizationServerMetadata)
mux.HandleFunc("/.well-known/oauth-protected-resource", s.handler.HandleProtectedResourceMetadata)
mux.HandleFunc("/.well-known/jwks.json", s.handler.HandleJWKS)
mux.HandleFunc("/oauth/authorize", s.handler.HandleAuthorize)
mux.HandleFunc("/oauth/callback", s.handler.HandleCallback)
mux.HandleFunc("/oauth/token", s.handler.HandleToken)
mux.HandleFunc("/oauth/register", s.handler.HandleRegister)
mux.HandleFunc("/.well-known/openid-configuration", s.handler.HandleOIDCDiscovery)
mux.HandleFunc("/.well-known/oauth-authorization-server", s.LogRequestMiddleware(s.handler.HandleAuthorizationServerMetadata))
mux.HandleFunc("/.well-known/oauth-protected-resource", s.LogRequestMiddleware(s.handler.HandleProtectedResourceMetadata))
mux.HandleFunc("/.well-known/jwks.json", s.LogRequestMiddleware(s.handler.HandleJWKS))
mux.HandleFunc("/oauth/authorize", s.LogRequestMiddleware(s.handler.HandleAuthorize))
mux.HandleFunc("/oauth/callback", s.LogRequestMiddleware(s.handler.HandleCallback))
mux.HandleFunc("/oauth/token", s.LogRequestMiddleware(s.handler.HandleToken))
mux.HandleFunc("/oauth/register", s.LogRequestMiddleware(s.handler.HandleRegister))
mux.HandleFunc("/.well-known/openid-configuration", s.LogRequestMiddleware(s.handler.HandleOIDCDiscovery))
}

// LogRequestMiddleware creates a server-level authentication hook for all MCP requests.
func (s *Server) LogRequestMiddleware(next func(http.ResponseWriter, *http.Request)) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
// leave error unhandled since it's a debug print
req, _ := httputil.DumpRequest(r, true)
s.logger.Info(fmt.Sprintf("\nLog Request dumped = %q\n", req))
next(w, r)
}
}

// ValidateTokenCached validates a token with caching support.
Expand Down