Skip to content

MCP server config + builtin server infrastructure#583

Open
NamN8Tr wants to merge 8 commits into
archi-physics:mainfrom
NamN8Tr:mcp-submit-status
Open

MCP server config + builtin server infrastructure#583
NamN8Tr wants to merge 8 commits into
archi-physics:mainfrom
NamN8Tr:mcp-submit-status

Conversation

@NamN8Tr

@NamN8Tr NamN8Tr commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Config-driven and builtin MCP server support for agents:

  • base_react: get_mcp_servers_config() merges an agent's BUILTIN_MCP_SERVERS with deployment-config servers; _build_mcp_tools passes them through and skips cleanly when none are configured.
  • tools/mcp: initialize_mcp_client accepts explicit server definitions.
  • cms_comp_ops_agent: BUILTIN_MCP_SERVERS hook (submit_status example).
  • templates_manager + base-compose: bind-mount host files for stdio MCP servers and mount ~/.ssh into the chat container.
  • Dockerfile-chat(-gpu): install openssh-client for SSH-based servers.
  • examples/agents: submit-cluster agent + mcp tool on cms-comp-ops.

Config-driven and builtin MCP server support for agents:

- base_react: get_mcp_servers_config() merges an agent's BUILTIN_MCP_SERVERS
  with deployment-config servers; _build_mcp_tools passes them through and
  skips cleanly when none are configured.
- tools/mcp: initialize_mcp_client accepts explicit server definitions.
- cms_comp_ops_agent: BUILTIN_MCP_SERVERS hook (submit_status example).
- templates_manager + base-compose: bind-mount host files for stdio MCP
  servers and mount ~/.ssh into the chat container.
- Dockerfile-chat(-gpu): install openssh-client for SSH-based servers.
- examples/agents: submit-cluster agent + mcp tool on cms-comp-ops.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Comment thread examples/agents/submit-cluster.md Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this should be in a submit specific repo

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please don't modify this either

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please remove the builtin mcp servers

Warren Nam and others added 7 commits June 22, 2026 11:02
langchain-mcp-adapters (0.1.11) sets each tool's  to the MCP
server's raw JSON-schema dict rather than a pydantic model. langchain-core
(1.2.13)  then calls
on it; for a non-pydantic input that helper recurses on ,
which for a dict (then None) never terminates -> RecursionError on every
MCP tool call. It's caught and logged at DEBUG, so it's non-fatal, but it
burns ~1000 stack frames per call and floods the logs.

Install a guarded  at MCP-client init that
adds the missing base case: a non-type with no generic origin returns no
annotations instead of recursing. Real pydantic args_schema models are
unaffected. The patch is idempotent and applies to all MCP tools.
All MCP tools share one client/session on a single background loop, so
concurrent calls (when the model emits parallel tool calls) corrupt response
routing and leak server-side connections. Hold a lock in the sync wrapper so
they run one at a time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
MCP servers can be declared in a .mcp.json file next to the deployment config
(the project-scoped format Claude Code uses), instead of or alongside the YAML
mcp_servers: block:

- src/utils/mcp_json.py owns the format: parses {"mcpServers": ...}, maps
  Claude 'type' (stdio/http/sse) onto langchain transports (http ->
  streamable_http), infers type from command/url when omitted, validates
  per-transport required fields, drops '_'-prefixed comment keys, and passes
  archi-only fields (path, host_file_mounts, env_from_secrets, build_context,
  image, skill) through so one file serves both archi and Claude Code.
- ConfigurationManager discovers .mcp.json beside each config file (or the file
  named by an explicit mcp_servers_file: key) and merges it into
  config['mcp_servers']; YAML entries win on name collision (warned).
- ${VAR} / ${VAR:-default} placeholders are expanded at connect time in
  initialize_mcp_client against the container env, before the stdio os.environ
  merge; an unset variable without default disables that server with a logged
  error.
- base-config template renders 'headers' so HTTP auth survives into the seeded
  runtime config.
- 19 unit tests (loader, expansion, merge precedence) + docs section.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add a runtime MCP server registry and a Settings -> MCP servers panel so
users can view, connect, reconnect, inspect, and remove MCP servers
without redeploying. Servers are split into Deployment (read-only, from
the deployment config) and User (added at runtime) sections; each
server's status is a single pill (green Connected / red Disconnected,
click to reconnect), and its config + full tool list open in a detail
window with a back arrow.

- src/utils/mcp_server_registry.py: whitelisted runtime server store
  (HTTP/SSE only; stdio and deploy-time fields rejected).
- tools/mcp.py: get_effective_mcp_servers (config + runtime merge),
  per-server probe, and last-build status for the UI.
- base_react.py: agents load the effective server set and can reset
  cached MCP tools when the runtime set changes.
- app.py: /api/mcp/servers CRUD + per-server reconnect endpoints.
- frontend (chat.js/chat.css, index.html): the Settings MCP panel.

Reachable via the Settings gear; the /mcp slash command is intentionally
not ported (this branch has no command palette). Registry unit tests:
19 passing.

Co-Authored-By: Claude Opus 4.8 <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.

2 participants