Skip to content

fix(registry): show secrets and env vars sections when registry has none pre-defined#1891

Merged
peppescg merged 4 commits intomainfrom
issues/1876
Mar 31, 2026
Merged

fix(registry): show secrets and env vars sections when registry has none pre-defined#1891
peppescg merged 4 commits intomainfrom
issues/1876

Conversation

@peppescg
Copy link
Copy Markdown
Collaborator

@peppescg peppescg commented Mar 31, 2026

Summary

Kapture.2026-03-31.at.12.10.47.mp4
Screenshot 2026-03-31 at 14 17 47
  • When a registry server has no secrets or env vars defined in its metadata, the install form now shows the dynamic "Add secret" / "Add environment variable" components instead of hiding the sections entirely
  • Reuses existing FormFieldsArrayCustomSecrets and FormFieldsArrayCustomEnvVars components (already used in the local MCP form)
  • The schema already supports this — createDynamicNameSchema([]) allows any string name when no pre-defined names exist

Closes #1876

Test plan

  • Install a registry server with no env vars (e.g. Playwright) — verify "Secrets" and "Environment variables" sections appear with "Add" buttons
  • Add a custom env var (e.g. DEBUG=1) and verify it's passed to the server
  • Install a registry server WITH pre-defined env vars — verify the existing behavior is unchanged
  • All 33 existing tests pass

🤖 Generated with Claude Code

…pre-defined vars

When a registry server has no secrets or env vars defined in the
registry metadata, the install form now shows the dynamic add
components instead of hiding the sections entirely.

Closes #1876

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 31, 2026 10:11
@peppescg peppescg self-assigned this Mar 31, 2026
@peppescg peppescg changed the title fix: show secrets and env vars sections when registry has none pre-defined fix(registry): show secrets and env vars sections when registry has none pre-defined Mar 31, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes the “Run from registry” install form so users can add secrets and environment variables even when a registry server’s metadata defines none, by rendering the existing dynamic “Add …” array field components instead of hiding those sections.

Changes:

  • Show FormFieldsArrayCustomSecrets when no registry-defined secrets exist.
  • Show FormFieldsArrayCustomEnvVars when no registry-defined env vars exist.
  • Add the necessary imports in the registry install configuration tab.

Remove unsafe type cast by making value optional in FormWithEnvVars,
matching the registry schema where env var values are optional.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@peppescg
Copy link
Copy Markdown
Collaborator Author

@claude succinct review

@claude
Copy link
Copy Markdown

claude bot commented Mar 31, 2026

Claude finished @peppescg's task in 47s —— View job


Review

Clean, minimal fix. Two observations:

The copilot suggestion is already addressedvalue?: string is now in FormWithEnvVars (line 19 of form-fields-array-custom-env-vars.tsx), and form is passed directly without a cast at line 300 of configuration-tab-content.tsx. Nothing left to fix there.

Potential issue: mixed secrets/envVars when registry has both pre-defined and user-added entries

The current logic is binary — either show the static rows (pre-defined) OR show the dynamic "Add" component. If a registry server defines some env vars but a user also wants to add custom ones, they can't. This is pre-existing behavior, not introduced by this PR, so it's fine to leave for a follow-up.

Overall: LGTM. The change is correct, reuses existing components well, and the type fix (making value optional) is the right approach.


- Always show "Add secret" and "Add environment variable" buttons in the
  registry install form, both for servers with and without pre-defined
  env vars
- Pre-defined rows keep their existing UX (read-only labels, tooltips,
  required indicators)
- Custom rows appear below with editable name/value inputs and remove button
- Relax schema name validation to accept any string, not just pre-defined
  literal names from the registry
- Add 6 tests covering add/remove/submit of custom entries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions github-actions bot added size/M and removed size/XS labels Mar 31, 2026
The Label elements for Secrets and Environment Variables sections need
htmlFor pointing to the first input when pre-defined entries exist,
otherwise getByLabelText in tests can't find the associated form control.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@peppescg peppescg merged commit 6eb5804 into main Mar 31, 2026
29 checks passed
@peppescg peppescg deleted the issues/1876 branch March 31, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Can't add secrets or env vars to MCP server from registry

3 participants