From 208bfe25fd305457f4731e82519e16b93d952047 Mon Sep 17 00:00:00 2001 From: Jonathan Amsterdam Date: Thu, 18 Sep 2025 08:25:24 -0400 Subject: [PATCH] oauthex: new package for oauth extensions (#429) This package will hold externally visible parts of internal/oauthex. For now, just add an alias to the ProtectedResourceMetadata struct. This lets one write MCP-compliant servers. --- README.md | 6 +++++- internal/readme/README.src.md | 6 +++++- oauthex/oauthex.go | 10 ++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 oauthex/oauthex.go diff --git a/README.md b/README.md index 2888b74..ab98902 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ software development kit (SDK) for the Model Context Protocol (MCP). ## Package documentation -The SDK consists of three importable packages: +The SDK consists of several importable packages: - The [`github.com/modelcontextprotocol/go-sdk/mcp`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp) @@ -34,6 +34,10 @@ The SDK consists of three importable packages: [`github.com/modelcontextprotocol/go-sdk/auth`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/auth) package provides some primitives for supporting oauth. +- The + [`github.com/modelcontextprotocol/go-sdk/oauthex`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/oauthex) + package provides extensions to the OAuth protocol, such as ProtectedResourceMetadata. + ## Getting started To get started creating an MCP server, create an `mcp.Server` instance, add diff --git a/internal/readme/README.src.md b/internal/readme/README.src.md index 45a57f6..acd08e4 100644 --- a/internal/readme/README.src.md +++ b/internal/readme/README.src.md @@ -20,7 +20,7 @@ software development kit (SDK) for the Model Context Protocol (MCP). ## Package documentation -The SDK consists of three importable packages: +The SDK consists of several importable packages: - The [`github.com/modelcontextprotocol/go-sdk/mcp`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/mcp) @@ -33,6 +33,10 @@ The SDK consists of three importable packages: [`github.com/modelcontextprotocol/go-sdk/auth`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/auth) package provides some primitives for supporting oauth. +- The + [`github.com/modelcontextprotocol/go-sdk/oauthex`](https://pkg.go.dev/github.com/modelcontextprotocol/go-sdk/oauthex) + package provides extensions to the OAuth protocol, such as ProtectedResourceMetadata. + ## Getting started To get started creating an MCP server, create an `mcp.Server` instance, add diff --git a/oauthex/oauthex.go b/oauthex/oauthex.go new file mode 100644 index 0000000..eb3a3e7 --- /dev/null +++ b/oauthex/oauthex.go @@ -0,0 +1,10 @@ +// Copyright 2025 The Go MCP SDK Authors. All rights reserved. +// Use of this source code is governed by an MIT-style +// license that can be found in the LICENSE file. + +// Package oauthex implements extensions to OAuth2. +package oauthex + +import "github.com/modelcontextprotocol/go-sdk/internal/oauthex" + +type ProtectedResourceMetadata = oauthex.ProtectedResourceMetadata