Skip to content

Commit daa98fe

Browse files
feat: Add support for User (github#180)
* feat: Add support for user Signed-off-by: Qasim Sarfraz <[email protected]> * update: use "user" in aks Signed-off-by: Qasim Sarfraz <[email protected]> --------- Signed-off-by: Qasim Sarfraz <[email protected]>
1 parent cabcad8 commit daa98fe

File tree

5 files changed

+23
-0
lines changed

5 files changed

+23
-0
lines changed

docs/configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,22 @@ run:
8585
- --transport=stdio
8686
```
8787

88+
## User
89+
90+
If you need to run the container with a specific user, you can do it in the `run` block. If you want the user to be able to define the container user, you will need to create a parameter first and then add the `run` block to the server.
91+
92+
```
93+
run:
94+
user: '{{server_name.container_user}}'
95+
config:
96+
description: example of a user
97+
parameters:
98+
type: object
99+
properties:
100+
container_user:
101+
type: string
102+
```
103+
88104
## Full Example
89105

90106
Here you can see a full example:

pkg/catalog/tile.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ func ToTile(ctx context.Context, server servers.Server) (Tile, error) {
183183
Env: env,
184184
Command: server.Run.Command,
185185
Volumes: server.Run.Volumes,
186+
User: server.Run.User,
186187
DisableNetwork: server.Run.DisableNetwork,
187188
AllowHosts: server.Run.AllowHosts,
188189
Config: config,

pkg/catalog/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ type Tile struct {
147147
Env []Env `json:"env,omitempty" yaml:"env,omitempty"`
148148
Command []string `json:"command,omitempty" yaml:"command,omitempty"`
149149
Volumes []string `json:"volumes,omitempty" yaml:"volumes,omitempty"`
150+
User string `json:"user,omitempty" yaml:"user,omitempty"`
150151
DisableNetwork bool `json:"disableNetwork,omitempty" yaml:"disableNetwork,omitempty"`
151152
AllowHosts []string `json:"allowHosts,omitempty" yaml:"allowHosts,omitempty"`
152153
Prompts int `json:"prompts" yaml:"prompts"`

pkg/servers/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ type Source struct {
107107
type Run struct {
108108
Command []string `yaml:"command,omitempty" json:"command,omitempty"`
109109
Volumes []string `yaml:"volumes,omitempty" json:"volumes,omitempty"`
110+
User string `yaml:"user,omitempty" json:"user,omitempty"`
110111
Env map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
111112
AllowHosts []string `yaml:"allowHosts,omitempty" json:"allowHosts,omitempty"`
112113
DisableNetwork bool `yaml:"disableNetwork,omitempty" json:"disableNetwork,omitempty"`

servers/aks/server.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ run:
2323
volumes:
2424
- '{{aks.azure_dir}}:/home/mcp/.azure'
2525
- '{{aks.kubeconfig}}:/home/mcp/.kube/config'
26+
user: '{{aks.container_user}}'
2627
config:
2728
description: Configuration for AKS-MCP server
2829
parameters:
@@ -44,6 +45,9 @@ config:
4445
additional_tools:
4546
type: string
4647
description: Comma-separated list of additional tools, One of [ helm, cilium ]
48+
container_user:
49+
type: string
50+
description: Username or UID of the container user (format <name|uid>[:<group|gid>] e.g. 10000), ensuring correct permissions to access the Azure and kubeconfig files. Leave empty to use default user in the container.
4751
required:
4852
- azure_dir
4953
- kubeconfig

0 commit comments

Comments
 (0)