Skip to content

fix: settings page crash — align MCP server API field names#7

Open
fdatoo wants to merge 1 commit intomainfrom
fix/settings-object-keys-crash
Open

fix: settings page crash — align MCP server API field names#7
fdatoo wants to merge 1 commit intomainfrom
fix/settings-object-keys-crash

Conversation

@fdatoo
Copy link
Copy Markdown
Owner

@fdatoo fdatoo commented Apr 30, 2026

Summary

  • The McpServer JSON encoder emitted server_type / args_json / env_json (raw JSON strings), but the TypeScript client expected type / args (array) / env (object). When servers were returned, s.env was undefined and Object.keys(s.env) crashed in McpServerList, breaking the Settings page.
  • Mirrors the prior settings fix (fix: settings page crash on .map() of undefined #1): GET encoder parses stored JSON strings and emits proper array/object under expected field names; POST/PATCH handlers accept array/object and JSON-encode before DB storage.

Test plan

  • gleam build clean
  • gleam test (pre-existing NIF-load failures only, unrelated)
  • tsc -p tsconfig.web.json --noEmit clean
  • Load Settings page in browser — list renders without Object.keys crash
  • Add a custom MCP server (with env vars) — round-trips correctly
  • Edit an existing MCP server — env/args populate correctly

🤖 Generated with Claude Code

The McpServer JSON encoder emitted server_type/args_json/env_json (raw
JSON strings) but the TypeScript client expected type/args/env (parsed
array and object). When servers were returned, s.env was undefined and
Object.keys(s.env) crashed in McpServerList.

Fix both directions following the same pattern as the settings fix:
- GET encoder now parses the stored JSON strings and emits proper
  array/object under the expected field names (type, args, env)
- POST/PATCH handlers now accept array/object and JSON-encode them
  before DB storage

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

1 participant