feat(DATAGO-118768): Support remote MCP server configuration in sam add agent --gui #735
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.




What is the purpose of this change?
This PR adds support for configuring remote MCP (Model Context Protocol) servers through the agent configuration GUI (
sam add agent --gui). Previously, users had to manually edit YAML files to configure remote MCP servers with authentication. This change provides a user-friendly form-based interface for all MCP transport types (stdio, SSE, streamable-http) with built-in authentication support.How was this change implemented?
Frontend (React/TypeScript):
Created two new reusable input components:
KeyValueInput.tsx: Manages key-value pairs (environment variables, config options) with inline editingListInput.tsx: Manages ordered lists (command arguments) with move up/down functionalityEnhanced
AgentToolsStep.tsxwith transport-specific configuration forms:Updated
AddAgentFlow.tsx:tool_typefield is always first in generated YAML for better readabilityBackend (Python):
agent_cmd.py: Adds default 30s timeout to MCP connection params, usessort_keys=Falsefor YAML preservationsetup.py: Enhanced MCP tool loader with SSE and streamable-http transport support, authentication header constructionKey Design Decisions (optional - delete if not applicable)
Why store auth fields separately?
Auth credentials are stored both in
connection_params.headers(for runtime use) and as separate fields (auth_type,auth_token,auth_header_name) to enable proper round-trip editing. When users edit an existing MCP tool, the form fields are pre-populated from these separate fields.Why restrict environment variables to stdio?
The backend only applies environment variables to stdio connections (local process environments). While the UI previously allowed setting env vars for all transport types, they were ignored for remote transports. We restricted the UI to match backend behavior and avoid user confusion.
Why auto-include web tools for remote transports?
Remote MCP servers (SSE/streamable-http) require network access. The "web" builtin tool group is automatically added to ensure agents have the necessary capabilities to connect to remote servers.
How was this change tested?
Manual testing:
Unit tests: None added (UI component tests would be beneficial future work)
Integration tests: Tested through live config portal server
Known limitations:
Is there anything the reviewers should focus on/be aware of?
Key areas for review:
connection_params.type- verify this works for all scenariosThis PR supersedes: Original PR #673 by @RZuchniak - I've taken over shepherding this feature to main with the improvements listed above.
Breaking changes: None - fully backwards compatible with existing agent configurations.