You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add multi-provider OAuth support and flexible storage options
- Add support and documentation for multiple OAuth providers: GitHub, GitLab, and Gitea
- Introduce flexible storage options with both in-memory and Redis-backed persistence
- Update instructions and examples to use the new oauth-server and oauth-client structure
- Expand setup and usage sections with detailed steps for both development (memory store) and production (Redis store) environments
- Add command-line flag documentation for server configuration, including new provider and storage options
- Provide new curl examples for client registration and resource metadata endpoints
- Clarify and generalize references to OAuth tokens instead of GitHub-specific tokens
- Add links to additional documentation and relevant external resources
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This project demonstrates an OAuth 2.0 protected [Model Context Protocol (MCP)](https://github.com/mark3labs/mcp-go) server written in Go. It integrates with GitHub as the OAuth provider and showcases authenticated MCP tool execution with token context propagation.
3
+
This project demonstrates an OAuth 2.0 protected [Model Context Protocol (MCP)](https://github.com/mark3labs/mcp-go) server written in Go. It supports multiple OAuth providers (GitHub, GitLab, Gitea) and showcases authenticated MCP tool execution with token context propagation.
4
+
5
+
The implementation includes both an OAuth authorization server (`oauth-server/`) and an example OAuth client (`oauth-client/`), demonstrating the complete OAuth 2.0 flow with PKCE support and flexible storage options.
4
6
5
7
---
6
8
@@ -9,6 +11,7 @@ This project demonstrates an OAuth 2.0 protected [Model Context Protocol (MCP)](
9
11
The server provides:
10
12
11
13
-**Multi-Provider OAuth Integration**: Supports GitHub, GitLab, and Gitea as OAuth 2.0 providers for user authentication
14
+
-**Flexible Storage Backends**: Choose between in-memory or Redis-backed storage for OAuth data persistence
12
15
-**MCP Server with Authentication**: Requires valid OAuth tokens for all MCP endpoint access
13
16
-**Context-based Token Propagation**: Injects and propagates authentication tokens through Go's `context.Context`
14
17
-**Two Authenticated MCP Tools**:
@@ -169,64 +172,92 @@ flowchart TD
169
172
1. Change to the server directory:
170
173
171
174
```bash
172
-
cd 03-oauth-mcp/server
175
+
cd 03-oauth-mcp/oauth-server
173
176
```
174
177
175
178
2. Start the server with your OAuth credentials:
176
179
177
-
**GitHub (default):**
180
+
**GitHub (default with memory store):**
181
+
182
+
```bash
183
+
go run . -client_id="your-github-client-id" -client_secret="your-github-client-secret"
184
+
```
185
+
186
+
**GitHub with Redis store:**
178
187
179
188
```bash
180
-
go run server.go -client_id="your-github-client-id" -client_secret="your-github-client-secret"
189
+
# Start Redis first
190
+
docker run -d -p 6379:6379 redis:alpine
191
+
192
+
# Run server with Redis
193
+
go run . -client_id="your-id" -client_secret="your-secret" -store redis -redis-addr localhost:6379
181
194
```
182
195
183
196
**GitLab.com:**
184
197
185
198
```bash
186
-
go run server.go -provider="gitlab" -client_id="your-gitlab-client-id" -client_secret="your-gitlab-client-secret"
199
+
go run . -provider="gitlab" -client_id="your-gitlab-client-id" -client_secret="your-gitlab-client-secret"
187
200
```
188
201
189
202
**Self-hosted GitLab:**
190
203
191
204
```bash
192
-
go run server.go -provider="gitlab" -gitlab-host="https://gitlab.example.com" -client_id="your-client-id" -client_secret="your-client-secret"
205
+
go run . -provider="gitlab" -gitlab-host="https://gitlab.example.com" -client_id="your-client-id" -client_secret="your-client-secret"
193
206
```
194
207
195
208
**Gitea:**
196
209
197
210
```bash
198
-
go run server.go -provider="gitea" -gitea-host="https://gitea.example.com" -client_id="your-client-id" -client_secret="your-client-secret"
211
+
go run . -provider="gitea" -gitea-host="https://gitea.example.com" -client_id="your-client-id" -client_secret="your-client-secret"
199
212
```
200
213
201
-
3. Optional: Specify a different port:
214
+
3. Optional flags:
202
215
203
216
```bash
204
-
go run server.go -provider="gitlab" -client_id="your-id" -client_secret="your-secret" -addr=":8095"
217
+
go run . -client_id="your-id" -client_secret="your-secret" \
0 commit comments