Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
281f290
docs: Add OAuth extra parameters investigation and implementation plan
technicalpickles Nov 27, 2025
e8a184c
feat: add OAuth config serialization and error parsing (Phase 0 Tasks…
technicalpickles Nov 27, 2025
bbf125e
feat: enhance OAuth diagnostics in auth status and doctor commands (P…
technicalpickles Nov 27, 2025
42b64f8
feat: return full Protected Resource Metadata including resource para…
technicalpickles Nov 27, 2025
cc3b0cd
feat: add ExtraParams field with validation for OAuth config
technicalpickles Nov 27, 2025
38c943d
feat: extract resource parameter from Protected Resource Metadata
technicalpickles Nov 28, 2025
717d2be
feat: add OAuth wrapper utility for extra parameter injection
technicalpickles Nov 28, 2025
051503f
feat: document extraParams limitation in connection layer (mcp-go int…
technicalpickles Nov 28, 2025
05a5d53
feat: add IsOAuthCapable for zero-config OAuth capability detection
technicalpickles Nov 28, 2025
5683d4e
docs: add zero-config OAuth user guide and README section
technicalpickles Nov 29, 2025
358411a
docs: update plan with completion status and known limitations
technicalpickles Nov 29, 2025
aaee586
Merge remote-tracking branch 'upstream/main' into zero-config-oauth
technicalpickles Dec 1, 2025
0321b90
test: add E2E tests for zero-config OAuth with resource parameters
technicalpickles Dec 1, 2025
d9ebaa7
docs: add PR descriptions for zero-config OAuth
technicalpickles Dec 1, 2025
77e500a
docs: add speckit specification for zero-config OAuth (006)
technicalpickles Dec 1, 2025
d309611
chore: relocate working files to .scratch directory
technicalpickles Dec 1, 2025
abcd512
regenerate
technicalpickles Dec 1, 2025
c9df1cb
feat: implement OAuth extra parameters workaround for RFC 8707 Runlay…
technicalpickles Dec 1, 2025
66bd133
docs: document authenticated field bug in OAuth status API
technicalpickles Dec 1, 2025
c57f8d2
test: add E2E tests for URL injection workaround in OAuth flow
technicalpickles Dec 1, 2025
5606ba6
feat: add PendingAuth state for OAuth-required servers
technicalpickles Dec 1, 2025
efa03a6
test: add unit tests for PendingAuth state and ErrOAuthPending
technicalpickles Dec 1, 2025
c433bb3
fix: use detailed connection state for CLI/UI status display
technicalpickles Dec 1, 2025
2a90234
feat: add ⏳ icon for PendingAuth servers in tray UI
technicalpickles Dec 1, 2025
b9e6d63
fix: populate authenticated field with actual OAuth token state
technicalpickles Dec 1, 2025
678f38b
wip: add E2E test skeleton for OAuth PendingAuth state verification
technicalpickles Dec 1, 2025
91fb270
test: add comprehensive unit tests for OAuth HasValidToken() method
technicalpickles Dec 1, 2025
3e816bd
test: add E2E test for OAuth auth status validation after login
technicalpickles Dec 1, 2025
ea7e05b
refactor: change OAuth debug logs from ERROR to DEBUG level
technicalpickles Dec 1, 2025
2b301de
docs: add comprehensive OAuth server states and troubleshooting guide
technicalpickles Dec 1, 2025
54b3a65
docs: add optional followup tasks to OAuth extra params plan
technicalpickles Dec 1, 2025
eb3c8df
fix: improve OAuth UI feedback and diagnostics display
technicalpickles Dec 1, 2025
760f032
fix: resolve OAuth UI feedback issues - error display and login flow …
technicalpickles Dec 1, 2025
1ff4739
feat: improve OAuth UX - surface auth-required servers and prioritize…
technicalpickles Dec 1, 2025
1d1e4a9
test: add unit tests and improve OAuth detection for tray menu
technicalpickles Dec 1, 2025
37f617f
fix: OAuth login now opens browser when triggered manually
technicalpickles Dec 1, 2025
33990bf
docs: document OAuth deferral bypass fix (Part 3)
technicalpickles Dec 1, 2025
918c921
docs: add comprehensive UX specifications and update implementation s…
technicalpickles Dec 1, 2025
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
84 changes: 84 additions & 0 deletions .worktree-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Worktree: Zero-Config OAuth Implementation

**Branch**: `zero-config-oauth`
**Based on**: `origin/oauth-diagnostics-phase0`
**Created**: 2025-11-27

## Purpose

Implement zero-config OAuth with automatic RFC 8707 resource parameter detection.

## Base Branch Features (Inherited from Phase 0)

This worktree includes Phase 0 OAuth diagnostics infrastructure:

✅ **OAuth Error Parsing** - `OAuthParameterError` type
✅ **Config Serialization** - `ExtraParams` in contracts
✅ **Enhanced Diagnostics** - `auth status` and `doctor` commands
✅ **Test Coverage** - OAuth error parsing tests

## Implementation Plan

See: `docs/plans/2025-11-27-zero-config-oauth.md`

### Phase 1: Resource Parameter Extraction (Week 1)
- [ ] Enhance `internal/oauth/discovery.go` - Add `DiscoverProtectedResourceMetadata()`
- [ ] Update `internal/oauth/config.go` - Extract resource parameter
- [ ] Add resource fallback logic
- [ ] Return `(OAuthConfig, extraParams)` tuple
- [ ] Add unit tests

### Phase 2: OAuth Wrapper (Week 1-2)
- [ ] Create `internal/oauth/wrapper.go`
- [ ] Implement URL interception
- [ ] Wire up in `tryOAuthAuth()`
- [ ] Test with Runlayer

### Phase 3: Capability Detection (Week 2)
- [ ] Add `IsOAuthCapable()` function
- [ ] Update `auth status` to use new function
- [ ] Update `doctor` to use new function

## Quick Commands

```bash
# Build
go build -o mcpproxy ./cmd/mcpproxy

# Run tests
go test ./internal/oauth/... -v

# Test with Runlayer
./mcpproxy auth status
./mcpproxy doctor
```

## Documentation

- **Implementation Plan**: `docs/plans/2025-11-27-zero-config-oauth.md`
- **Branch Strategy**: `docs/plans/branch-strategy-zero-config-oauth.md`
- **Research**: `docs/oauth-auto-detection-analysis.md`
- **Feasibility**: `docs/zero-config-oauth-analysis.md`

## Git Commands

```bash
# View base commits
git log --oneline -10

# Compare with main
git log main..HEAD --oneline

# Push branch
git push -u origin zero-config-oauth

# Create PR (when ready)
gh pr create --base main --title "feat: zero-config OAuth with auto-detection" \
--body "Implements automatic RFC 8707 resource parameter detection. See docs/plans/2025-11-27-zero-config-oauth.md"
```

## Notes

- Based on `oauth-diagnostics-phase0` for 45% code reuse
- Inherits OAuth error handling infrastructure
- Focus on net-new features (resource extraction + wrapper)
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,33 @@ MCPProxy provides **seamless OAuth 2.1 authentication** for MCP servers that req

### 📝 **OAuth Server Configuration**

> **Note**: The `"oauth"` configuration is **optional**. MCPProxy will automatically detect when OAuth is required and use sensible defaults in most cases. You only need to specify OAuth settings if you want to customize scopes or have pre-registered client credentials.
#### Zero-Config OAuth

MCPProxy automatically detects OAuth requirements. No manual configuration needed:

```jsonc
{
"mcpServers": [
{
"name": "slack",
"url": "https://oauth.example.com/mcp"
}
]
}
```

MCPProxy automatically:
- Detects OAuth requirement from 401 response
- Fetches Protected Resource Metadata (RFC 9728)
- Extracts RFC 8707 resource parameters
- Auto-discovers scopes
- Launches browser for authentication

See `docs/oauth-zero-config.md` for details.

#### Manual OAuth Configuration (Optional)

> **Note**: The `"oauth"` configuration is **optional**. MCPProxy will automatically detect when OAuth is required and use sensible defaults. Specify OAuth settings only to customize scopes or provide pre-registered client credentials.

```jsonc
{
Expand Down
185 changes: 185 additions & 0 deletions WORKTREE-STATUS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
# Worktree Status: Zero-Config OAuth

**Created**: 2025-11-27
**Branch**: `zero-config-oauth`
**Based On**: `origin/oauth-diagnostics-phase0`
**Location**: `/Users/josh.nichols/workspace/mcpproxy-go/.worktrees/zero-config-oauth`

## ✅ Setup Complete

The worktree has been successfully created and verified:

- ✅ Branch `zero-config-oauth` tracking `origin/oauth-diagnostics-phase0`
- ✅ Phase 0 commits present (OAuth diagnostics infrastructure)
- ✅ Build successful (`make build` completed)
- ✅ Binary created: `./mcpproxy`
- ✅ Ready for implementation

## 📋 Phase 0 Features (Inherited)

This worktree includes all Phase 0 OAuth diagnostics work:

### Infrastructure Already Present ✅

1. **OAuth Error Parsing** (`internal/upstream/core/connection.go`)
- `OAuthParameterError` type
- `parseOAuthError()` function
- Detects missing `resource` parameter

2. **Config Serialization** (`internal/contracts/types.go`)
- `OAuthConfig.ExtraParams` field
- API serialization support

3. **Enhanced Diagnostics**
- `cmd/mcpproxy/auth_cmd.go` - OAuth error display
- `internal/management/diagnostics.go` - OAuth issue detection
- `cmd/mcpproxy/doctor_cmd.go` - OAuth diagnostics output

4. **Test Coverage** (`internal/upstream/core/oauth_error_test.go`)
- Error parsing tests
- FastAPI validation error tests

### Commits Included

```
bbf125e feat: enhance OAuth diagnostics in auth status and doctor commands (Phase 0 Tasks 4-5)
e8a184c feat: add OAuth config serialization and error parsing (Phase 0 Tasks 1-3)
281f290 docs: Add OAuth extra parameters investigation and implementation plan
```

## 🎯 Implementation Plan

See: `docs/plans/2025-11-27-zero-config-oauth.md`

### Phase 1: Resource Parameter Extraction (Next Steps)

**Focus**: Extract resource parameter from Protected Resource Metadata

**Files to Modify**:
1. [ ] `internal/oauth/discovery.go` - Add `DiscoverProtectedResourceMetadata()`
2. [ ] `internal/oauth/config.go` - Extract resource in `CreateOAuthConfig()`
3. [ ] `internal/config/config.go` - Add `ExtraParams` to config schema
4. [ ] Tests for new functionality

**Goal**: Return `(OAuthConfig, extraParams)` from `CreateOAuthConfig()`

### Phase 2: OAuth Wrapper

**Focus**: Inject resource parameter into OAuth URLs

**Files to Create**:
1. [ ] `internal/oauth/wrapper.go` - NEW FILE
2. [ ] `internal/oauth/wrapper_test.go` - NEW FILE

**Files to Modify**:
1. [ ] `internal/upstream/core/connection.go` - Use wrapper in `tryOAuthAuth()`
2. [ ] `internal/transport/http.go` - Support wrapped clients

### Phase 3: Capability Detection

**Focus**: Detect OAuth without explicit config

**Files to Modify**:
1. [ ] `internal/oauth/config.go` - Add `IsOAuthCapable()`
2. [ ] `cmd/mcpproxy/auth_cmd.go` - Use new function
3. [ ] `internal/management/diagnostics.go` - Use new function

## 🚀 Quick Start

```bash
# Navigate to worktree
cd /Users/josh.nichols/workspace/mcpproxy-go/.worktrees/zero-config-oauth

# Build
make build

# Run tests
go test ./internal/oauth/... -v

# Test auth status (with daemon running)
./mcpproxy auth status

# Test doctor command
./mcpproxy doctor
```

## 📚 Documentation

**Implementation Plan**: `docs/plans/2025-11-27-zero-config-oauth.md`
**Branch Strategy**: `docs/plans/branch-strategy-zero-config-oauth.md`
**Auto-Detection Research**: `docs/oauth-auto-detection-analysis.md`
**Zero-Config Analysis**: `docs/zero-config-oauth-analysis.md`
**Summary**: `docs/oauth-implementation-summary.md`

## 🔄 Git Workflow

```bash
# View status
git status

# Create feature branch for Phase 1
git checkout -b feat/resource-parameter-extraction

# Make changes, commit
git add internal/oauth/discovery.go internal/oauth/config.go
git commit -m "feat: extract resource parameter from Protected Resource Metadata"

# Push when ready
git push -u origin zero-config-oauth

# Create PR (when all phases complete)
gh pr create --base main \
--title "feat: zero-config OAuth with automatic resource parameter detection" \
--body "Implements zero-config OAuth with RFC 8707 resource parameter auto-detection. See docs/plans/2025-11-27-zero-config-oauth.md"
```

## 📊 Progress Tracking

### Phase 1: Resource Extraction
- [ ] `DiscoverProtectedResourceMetadata()` function
- [ ] Extract resource in `CreateOAuthConfig()`
- [ ] Resource fallback logic
- [ ] Return extra params tuple
- [ ] Unit tests

### Phase 2: OAuth Wrapper
- [ ] Create wrapper file
- [ ] URL interception
- [ ] Integration in `tryOAuthAuth()`
- [ ] Integration tests

### Phase 3: Capability Detection
- [ ] `IsOAuthCapable()` function
- [ ] Update callers
- [ ] Documentation

### Phase 4: Testing
- [ ] Unit tests complete
- [ ] Integration tests complete
- [ ] E2E test with Runlayer

### Phase 5: Documentation
- [ ] User guide updated
- [ ] API docs updated
- [ ] Examples added

## 🎉 Success Criteria

- ✅ Zero-config OAuth works (no `"oauth": {}` needed)
- ✅ Resource parameter auto-detected from metadata
- ✅ Runlayer Slack MCP server authenticates successfully
- ✅ Backward compatible with existing configs
- ✅ MCP spec 2025-06-18 compliant

## 📝 Notes

- This worktree is based on `oauth-diagnostics-phase0` for 45% code reuse
- Phase 0 features (error parsing, diagnostics) already implemented
- Focus on net-new features: resource extraction + wrapper
- Estimated timeline: 2-3 weeks for full implementation

---

**Ready to start Phase 1!** 🚀

Start with: `docs/plans/2025-11-27-zero-config-oauth.md`
Loading
Loading