This workshop provides a comprehensive guide to building MCP (Model Context Protocol) servers and clients using the Go programming language. You will learn how to leverage MCP to streamline your workflow and enhance your development environment.
This project demonstrates an OAuth 2.1 protected Model Context Protocol (MCP) server written in Go. It supports multiple OAuth providers (GitHub, GitLab, Gitea) and showcases authenticated MCP tool execution with token context propagation.
The implementation includes both an OAuth authorization server (oauth-server/) and an example OAuth client (oauth-client/), demonstrating the complete OAuth 2.1 flow with PKCE support and flexible storage options.
The server provides:
* Multi-Provider OAuth Integration: Supports GitHub, GitLab, and Gitea as OAuth 2.0 providers for user authentication
* Flexible Storage Backends: Choose between in-memory or Redis-backed storage for OAuth data persistence
* MCP Server with Authentication: Requires valid OAuth tokens for all MCP endpoint access
* Context-based Token Propagation: Injects and propagates authentication tokens through Go's context.Context
Two Authenticated MCP Tools:
* make_authenticated_request: Makes authenticated HTTP requests to external APIs using the user's token
* show_auth_token: Displays a masked version of the current authorization token
* OAuth 2.0 Endpoints: Implements required OAuth endpoints with provider integration
* Dynamic Client Registration: Supports automatic client registration for MCP clients
Conference URL: https://hwdc.ithome.com.tw/2025/lab-page/3994