Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cmrigney
Copy link
Contributor

@cmrigney cmrigney commented Oct 23, 2025

Working Sets

Working sets allow you to organize and manage collections of MCP servers as a single unit.

See docs/working-sets.md for more info and limitations of the current implementation.

Tests will be coming in a follow up PR.

Quickstart

# Enable the feature
docker mcp feature enable working-sets

# Create a working set
docker mcp workingset create --name dev-tools \
  --server docker://mcp/fetch

# Use it with the gateway
docker mcp gateway run --working-set dev-tools

@cmrigney cmrigney requested a review from a team as a code owner October 23, 2025 21:31
@bobbyhouse
Copy link
Contributor

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 51 to 72
func (servers *ServerList) Scan(value any) error {
str, ok := value.(string)
if !ok {
return errors.New("failed to scan server list")
}
return json.Unmarshal([]byte(str), &servers)
}

func (secrets SecretMap) Value() (driver.Value, error) {
b, err := json.Marshal(secrets)
if err != nil {
return nil, err
}
return string(b), nil
}

func (secrets *SecretMap) Scan(value any) error {
str, ok := value.(string)
if !ok {
return errors.New("failed to scan secret list")
}
return json.Unmarshal([]byte(str), &secrets)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fix Scan implementations to populate ServerList/SecretMap

Both ServerList.Scan and SecretMap.Scan pass &servers/&secrets to json.Unmarshal. Because servers is already a pointer (*ServerList), passing the address of that pointer gives **ServerList and json.Unmarshal only updates the local pointer variable, leaving the caller’s slice/map unchanged. Any read from the database will therefore return empty server and secret lists even though the JSON is valid. Unmarshal directly into the pointer (json.Unmarshal(..., servers) and json.Unmarshal(..., secrets)) so that retrieved working sets contain their stored values.

Useful? React with 👍 / 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally sure why, but this does already work as is. I'll update it anyway.

}
}

return "", fmt.Errorf("failed to create working set id: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return "", fmt.Errorf("failed to create working set id: %w", err)
return "", fmt.Errorf("failed to create working set id")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I trusted AI too much on that one lol

} else {
id, err = createWorkingSetID(ctx, name, dao)
if err != nil {
return fmt.Errorf("failed to create working set id: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return fmt.Errorf("failed to create working set id: %w", err)
return fmt.Errorf("failed to create working set id: %w", id)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is actually correct, since we want to wrap the error given. id will just be blank if there's an error.

workingSet.Servers[i] = s
}

if err := workingSet.Validate(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: should we validate server uniqueness?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The db does have the id as the primary key, which ensures primary key uniqueness. Is there something else you were also thinking of?

if !ok {
return errors.New("failed to scan secret list")
}
return json.Unmarshal([]byte(str), &secrets)
Copy link
Contributor

@bobbyhouse bobbyhouse Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Better to use secrets instead of &secrets?

I wasn't able to actually uncover a bug here because json.Unmarshal will automatically deference pointers until it gets the value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that explains why both work. I'll switch it.

if !ok {
return errors.New("failed to scan server list")
}
return json.Unmarshal([]byte(str), &servers)
Copy link
Contributor

@bobbyhouse bobbyhouse Oct 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Better to use servers instead of &servers?

@cmrigney cmrigney merged commit aa873b5 into main Oct 29, 2025
8 checks passed
@cmrigney cmrigney deleted the workingsets branch October 29, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants