✨ feat: Add Support for customUserVar
Replacement in 'args' Field
#8743
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This pull request adds support for custom user variables (e.g.,
{{MY_API_KEY}}
) substitution in MCP server command arguments during reinitialization. Previously, TheprocessMCPEnv
function was only processingenv
,headers
, andurl
fields but did not handle theargs
field used by MCP servers such as those generated by Smithery. During MCP server reinitialization through the UI, custom user variables in command arguments remained as unsubstituted placeholders (e.g.,'{{MY_API_KEY}}'
instead of the actual API key value), causing HTTP 401 authentication errors. Related to discussion #8731Example Use Case:
Backend Changes:
packages/api/src/utils/env.ts
:args
field inprocessMCPEnv
function to handle custom user variable substitution in MCP server command arguments by iterating through the command arguments and replacing placeholders like{{MY_API_KEY}}
with user-provided values.packages/api/src/mcp/mcp.spec.ts
:"should process customUserVars in args field"
to verify that custom user variables are now substituted properly in the args fieldChange Type
Testing
Checklist