NiWaRe commited on
Commit
d097b9a
Β·
verified Β·
1 Parent(s): 7d190a0

Update AUTH_README.md

Browse files
Files changed (1) hide show
  1. AUTH_README.md +17 -42
AUTH_README.md CHANGED
@@ -33,8 +33,8 @@ Authorization: Bearer YOUR_WANDB_API_KEY
33
 
34
  In Mistral LeChat, add a Custom MCP Connector:
35
 
36
- 1. **Server URL**: `https://your-space.hf.space/mcp`
37
- 2. **Authentication**: Choose "HTTP Bearer Token"
38
  3. **Token**: Enter your W&B API key
39
 
40
  ### Claude Desktop / Cursor
@@ -46,7 +46,7 @@ Configure in your MCP settings:
46
  "mcpServers": {
47
  "wandb": {
48
  "transport": "http",
49
- "url": "http://localhost:8080/mcp",
50
  "headers": {
51
  "Authorization": "Bearer YOUR_WANDB_API_KEY",
52
  "Accept": "application/json, text/event-stream"
@@ -67,7 +67,7 @@ import requests
67
 
68
  # Initialize MCP session
69
  response = requests.post(
70
- "http://localhost:8080/mcp",
71
  headers={
72
  "Authorization": "Bearer YOUR_WANDB_API_KEY",
73
  "Accept": "application/json, text/event-stream",
@@ -82,41 +82,28 @@ response = requests.post(
82
  )
83
  ```
84
 
85
- ## Security Considerations
86
 
87
- ### Non-Expiring API Keys
88
-
89
- W&B API keys don't expire by default, similar to GitHub Personal Access Tokens or OpenAI API keys. This is a design choice by W&B for developer convenience.
90
-
91
- **Best Practices:**
92
- - Rotate keys regularly (quarterly recommended)
93
- - Use separate keys for different services
94
- - Monitor usage at [wandb.ai/settings](https://wandb.ai/settings)
95
- - Revoke compromised keys immediately
96
- - Never commit keys to version control
97
-
98
- ### Multi-User Deployment
99
-
100
- For HuggingFace Spaces or shared deployments:
101
- - Server requires no API key configuration
102
- - Each user provides their own key
103
- - Keys are used transiently per request
104
- - No keys are stored or logged
105
-
106
- ## OAuth: Why We Can't Support Full OAuth 2.0
107
 
108
- ### What We Tried
 
 
 
 
 
 
109
 
110
- We attempted to implement OAuth 2.0 support to provide a seamless authentication experience, especially for clients like Mistral LeChat that expect OAuth for custom connectors. This included:
 
111
 
112
  1. **OAuth Discovery Endpoints**: `/.well-known/oauth-authorization-server`
113
  2. **Authorization Flow**: Redirect to W&B's Auth0 login
114
  3. **Token Exchange**: Accept W&B API keys as "access tokens"
115
  4. **Device Flow**: Guide users to get their API key
116
 
117
- ### Why It Doesn't Work
118
-
119
- **Fundamental Limitations:**
120
 
121
  1. **W&B Doesn't Provide OAuth for Third Parties**
122
  - W&B uses Auth0 internally but doesn't allow third-party OAuth client registration
@@ -133,8 +120,6 @@ We attempted to implement OAuth 2.0 support to provide a seamless authentication
133
  - W&B's Auth0 instance (`wandb.auth0.com`) doesn't know about our server
134
  - Can't validate tokens or handle callbacks
135
 
136
- ### What Would Be Needed for Full OAuth
137
-
138
  For proper OAuth 2.0 support, W&B would need to:
139
 
140
  1. **Allow OAuth Client Registration**
@@ -152,16 +137,6 @@ For proper OAuth 2.0 support, W&B would need to:
152
  - Revocation endpoint for invalidating tokens
153
  - JWKS endpoint for JWT validation
154
 
155
- ### Current Solution
156
-
157
- Given these limitations, we use W&B API keys directly as Bearer tokens. This approach:
158
- - βœ… Works with all W&B functionality
159
- - βœ… Compatible with MCP specification
160
- - βœ… Simple and reliable
161
- - βœ… Follows industry patterns (GitHub, OpenAI)
162
- - ❌ Requires manual key management
163
- - ❌ No automatic token refresh
164
-
165
  ## Troubleshooting
166
 
167
  ### Common Issues
 
33
 
34
  In Mistral LeChat, add a Custom MCP Connector:
35
 
36
+ 1. **Server URL**: `https://niware-wandb-mcp-server.hf.space/mcp`
37
+ 2. **Authentication**: Choose "API Key Authentication"
38
  3. **Token**: Enter your W&B API key
39
 
40
  ### Claude Desktop / Cursor
 
46
  "mcpServers": {
47
  "wandb": {
48
  "transport": "http",
49
+ "url": "https://niware-wandb-mcp-server.hf.space/mcp",
50
  "headers": {
51
  "Authorization": "Bearer YOUR_WANDB_API_KEY",
52
  "Accept": "application/json, text/event-stream"
 
67
 
68
  # Initialize MCP session
69
  response = requests.post(
70
+ "https://niware-wandb-mcp-server.hf.space/mcp",
71
  headers={
72
  "Authorization": "Bearer YOUR_WANDB_API_KEY",
73
  "Accept": "application/json, text/event-stream",
 
82
  )
83
  ```
84
 
85
+ ## OAuth: WIP
86
 
87
+ ### Current Solution
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
+ We currently use W&B API keys directly as Bearer tokens. This approach:
90
+ - βœ… Works with all W&B functionality
91
+ - βœ… Compatible with MCP specification
92
+ - βœ… Simple and reliable
93
+ - βœ… Follows industry patterns (GitHub, OpenAI)
94
+ - ❌ Requires manual key management
95
+ - ❌ No automatic token refresh
96
 
97
+ ### Tests
98
+ We attempted to implement a OAuth-assisted authentication flow (clients like ChatGPT would forward to login in the beginning):
99
 
100
  1. **OAuth Discovery Endpoints**: `/.well-known/oauth-authorization-server`
101
  2. **Authorization Flow**: Redirect to W&B's Auth0 login
102
  3. **Token Exchange**: Accept W&B API keys as "access tokens"
103
  4. **Device Flow**: Guide users to get their API key
104
 
105
+ ### Still WIP
106
+ We're running into some issues with the OAuth-assisted approach we tried out (forward clients to wandb.ai/protect and return OAuth style metdata) - with some issus:
 
107
 
108
  1. **W&B Doesn't Provide OAuth for Third Parties**
109
  - W&B uses Auth0 internally but doesn't allow third-party OAuth client registration
 
120
  - W&B's Auth0 instance (`wandb.auth0.com`) doesn't know about our server
121
  - Can't validate tokens or handle callbacks
122
 
 
 
123
  For proper OAuth 2.0 support, W&B would need to:
124
 
125
  1. **Allow OAuth Client Registration**
 
137
  - Revocation endpoint for invalidating tokens
138
  - JWKS endpoint for JWT validation
139
 
 
 
 
 
 
 
 
 
 
 
140
  ## Troubleshooting
141
 
142
  ### Common Issues