forcedotcom / forcedotcom/cli

sf agent mcp update --label returns success but resets the label to the server name

Open
#3,624 3 comments 0 reactions 0 assignees View on GitHub
area:afdx bug investigating owned by another team validated
Dominant language
No language data
Stars
571
Forks
80
Avg merge
2d 15h
Merged PRs (30d)
3

Description

### Summary

`sf agent mcp update --label` returns success, but doesn't persist the requested label.

A custom label works when the MCP server is created, but updating it later resets the label to the server name.

`--description` updates correctly on the same server.

I also reproduced the behavior with a direct PUT to the API Catalog endpoint, without using `sf agent mcp update`.

### Steps To Reproduce

A repository is not required to reproduce this issue because the behavior occurs against an org-level API Catalog MCP server resource and can be reproduced directly with Salesforce CLI commands.

1. Create an MCP server with a custom label:

```powershell
sf agent mcp create --name OssMcpLabelTest2 --label "Custom Create Label" --server-url "https://mcptest-daniel-e6e72a8eba7a.herokuapp.com/mcp" -o --json
```

The server is created successfully and the response contains:

```json
{
"name": "OssMcpLabelTest2",
"label": "Custom Create Label"
}
```

2. Update only the label:

```powershell
sf agent mcp update --mcp-server-id --label "Updated Label Test" -o --json
```

The command succeeds with `status: 0`, but the returned server contains:

```json
{
"name": "OssMcpLabelTest2",
"label": "OssMcpLabelTest2"
}
```

rather than the requested value:

```json
{
"label": "Updated Label Test"
}
```

3. Read the server again:

```powershell
sf agent mcp get --mcp-server-id -o --json
```

The persisted value is still:

```json
{
"name": "OssMcpLabelTest2",
"label": "OssMcpLabelTest2"
}
```

4. As a control, update the description:

```powershell
sf agent mcp update --mcp-server-id --description "OSS Description Test" -o --json
```

A subsequent `sf agent mcp get` correctly returns:

```json
{
"description": "OSS Description Test"
}
```

5. I also reproduced the issue without using `sf agent mcp update`, by sending a raw PUT request directly to the API Catalog endpoint:

```powershell
'{"label":"Raw Label Test"}' | sf api request rest '/services/data/v67.0/api-catalog/mcp-servers/' --method PUT --header 'Content-Type: application/json' --body - -o
```

The request succeeds, but the response again contains:

```json
{
"name": "OssMcpLabelTest2",
"label": "OssMcpLabelTest2"
}
```

A subsequent:

```powershell
sf agent mcp get --mcp-server-id -o --json
```

confirms that `"Raw Label Test"` was not persisted.

I reproduced the label update behavior with two separate MCP server registrations.

### Expected result

Running:

```powershell
sf agent mcp update --mcp-server-id --label "Updated Label Test" -o --json
```

should update and persist the MCP server label as:

```json
{
"label": "Updated Label Test"
}
```

### Actual result

The command returns success, but the requested label is not persisted.

Instead, the label becomes equal to the MCP server's `name`:

```json
{
"name": "OssMcpLabelTest2",
"label": "OssMcpLabelTest2"
}
```

The same behavior occurs when sending the update directly to the API Catalog REST endpoint with a raw PUT request.

### Additional information

- Reproduced with two MCP server registrations.
- Custom labels work on create.
- Description updates work correctly.
- The same label behavior occurs with a direct REST PUT.
- `sf doctor` was run before filing; no related diagnostic problems were reported.
- `agent mcp` is currently in Developer Preview.

### System Information

Shell: Windows PowerShell

```json
{
"architecture": "win32-x64",
"cliVersion": "@salesforce/cli/2.146.3",
"nodeVersion": "node-v22.23.1",
"osVersion": "Windows_NT 10.0.26200",
"rootPath": "C:\\Program Files\\sf\\client",
"shell": "cmd.exe",
"pluginVersions": [
"@oclif/plugin-autocomplete 3.2.54 (core)",
"@oclif/plugin-commands 4.1.61 (core)",
"@oclif/plugin-help 6.2.55 (core)",
"@oclif/plugin-not-found 3.2.90 (core)",
"@oclif/plugin-plugins 5.4.86 (core)",
"@oclif/plugin-search 1.2.54 (core)",
"@oclif/plugin-update 4.7.56 (core)",
"@oclif/plugin-version 2.2.52 (core)",
"@oclif/plugin-warn-if-update-available 3.1.70 (core)",
"@oclif/plugin-which 3.2.59 (core)",
"@salesforce/cli 2.146.3 (core)",
"agent 1.45.0 (core)",
"apex 3.9.40 (core)",
"api 1.3.54 (core)",
"auth 4.4.9 (core)",
"data 4.0.115 (core)",
"deploy-retrieve 3.24.61 (core)",
"info 3.4.155 (core)",
"limits 3.3.106 (core)",
"marketplace 1.3.44 (core)",
"org 5.11.26 (core)",
"packaging 2.30.6 (core)",
"schema 3.3.131 (core)",
"settings 2.4.101 (core)",
"sobject 1.4.125 (core)",
"telemetry 3.8.33 (core)",
"templates 56.20.0 (core)",
"trust 3.8.43 (core)",
"user 3.10.9 (core)"
]
}
```

Contributor guide

Open the contributing guide

Research direction

No repository file or test is named. Start at the agent mcp update command and its API Catalog PUT integration, then reproduce the label update and compare it with the working description update; done means the requested label is returned and remains persisted after agent mcp get.

Written by the indexing model from the issue text.

Assessment

Domain
api, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.