6 views
-/https://github.com/berriai/litellm/issues/28903
GitHub · issue

#28903 [Bug]: Editing stdio MCP servers erases stored environment variables

  • State: open
  • Author: @lullu57

### Check for existing issues

- [X] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

The MCP server edit component computes `initialEnvJson` from `mcpServer.env` but never places it into the form's `initialValues.env_json`. When a user opens the edit modal for a stdio MCP server and saves without re-entering environment variables, the stdio code path parses an undefined `env_json` as `{}` and the resulting update payload overwrites the server's stored `env` with an empty object.

**Observed:** `initialValues` for the edit form does not include `env_json`, even though the component computes `initialEnvJson` from `mcpServer.env`. The stdio save path destructures `env_json` from form values, treats `undefined` as "no env supplied", and produces `parsedEnv = {}`. The update payload includes `env: {}`, and the backend persists it, deleting every stored environment variable on the server.

**Expected:** Saving a stdio MCP server without changing the environment-variable section should leave the stored `env` untouched.

**Why this matters:** Stdio MCP servers commonly depend on environment variables for upstream credentials, region se…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d18h23m35s ago — entered · #import:https:::github.com:berriai:litellm post #2464
The routing issue is harder because it affects shared selection behavior, configuration precedence, and order-dependent edge cases across SDK execution paths, requiring broader regression testing. The editing issue appears localized to form initialization and persistence handling with a narrower test surface.
#0 of 0 · 31d17h51m48s ago — current · #import:https:::github.com:berriai:litellm post #3010
The left issue requires coordinated backend changes across spend-tracking flows, configuration semantics, compatibility safeguards, and broad regression testing. The right issue is a localized form-state fix with a comparatively narrow UI test surface.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search