Skip to content

Commit 01ccb3e

Browse files
authored
Merge pull request #87 from docker/scopes-flag-for-oauth
OAuth scopes flag
2 parents f592a22 + c3ab78e commit 01ccb3e

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

cmd/docker-mcp/commands/oauth.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,20 @@ func lsOauthCommand() *cobra.Command {
3535
}
3636

3737
func authorizeOauthCommand() *cobra.Command {
38-
return &cobra.Command{
38+
var opts struct {
39+
Scopes string
40+
}
41+
cmd := &cobra.Command{
3942
Use: "authorize <app>",
4043
Short: "Authorize the specified OAuth app.",
4144
Args: cobra.ExactArgs(1),
4245
RunE: func(cmd *cobra.Command, args []string) error {
43-
return oauth.Authorize(cmd.Context(), args[0])
46+
return oauth.Authorize(cmd.Context(), args[0], opts.Scopes)
4447
},
4548
}
49+
flags := cmd.Flags()
50+
flags.StringVar(&opts.Scopes, "scopes", "", "OAuth scopes to request (space-separated)")
51+
return cmd
4652
}
4753

4854
func revokeOauthCommand() *cobra.Command {

cmd/docker-mcp/oauth/auth.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"github.com/docker/mcp-gateway/cmd/docker-mcp/internal/desktop"
88
)
99

10-
func Authorize(ctx context.Context, app string) error {
10+
func Authorize(ctx context.Context, app string, scopes string) error {
1111
client := desktop.NewAuthClient()
1212

13-
authResponse, err := client.PostOAuthApp(ctx, app, "")
13+
authResponse, err := client.PostOAuthApp(ctx, app, scopes)
1414
if err != nil {
1515
return err
1616
}

docs/generator/reference/docker_mcp_oauth_authorize.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ long: Authorize the specified OAuth app.
44
usage: docker mcp oauth authorize <app>
55
pname: docker mcp oauth
66
plink: docker_mcp_oauth.yaml
7+
options:
8+
- option: scopes
9+
value_type: string
10+
description: OAuth scopes to request (space-separated)
11+
deprecated: false
12+
hidden: false
13+
experimental: false
14+
experimentalcli: false
15+
kubernetes: false
16+
swarm: false
717
deprecated: false
818
hidden: true
919
experimental: false

0 commit comments

Comments
 (0)