Skip to content

Normalize missing MCP transport collection fields for ACP compatibility#498

Open
CsBigDataHub wants to merge 2 commits intoxenodium:mainfrom
CsBigDataHub:main
Open

Normalize missing MCP transport collection fields for ACP compatibility#498
CsBigDataHub wants to merge 2 commits intoxenodium:mainfrom
CsBigDataHub:main

Conversation

@CsBigDataHub
Copy link
Copy Markdown

@CsBigDataHub CsBigDataHub commented Apr 2, 2026

Error I have been getting

((:object (jsonrpc . "2.0") (id . 4)
  (error (code . -32602) (message . "Invalid params")
         (data . "data did not match any variant of untagged enum McpServer at line 1 column 118")))
 (:json
  . "{\"jsonrpc\":\"2.0\",\"id\":4,\"error\":{\"code\":-32602,\"message\":\"Invalid params\",\"data\":\"data did not match any variant of untagged enum McpServer at line 1 column 118\"}}"))

my config -

(setq agent-shell-mcp-servers
        '(((name . "context7-mcp")
          (command . "context7-mcp"))
         ((name . "splunk-nonprod")
          (command . "/Users/mymac/GitRepos/mcp-scripts/splunk-mcp.py")
          (env . (((name . "SPLUNK_HOST") (value . "stage.splunk.com")))))
         ((name . "splunk-prod")
          (command . "/Users/mymac/GitRepos/mcp-scripts/splunk-mcp.py")
          (env . (((name . "SPLUNK_HOST") (value . "prod.splunk.com")))))))

This change makes MCP server normalization more robust when users provide minimal hand-written configs.

agent-shell--mcp-servers now fills in the collection fields ACP expects based on transport type before normalizing list values into vectors:

  • stdio-style transports now default missing args and env to empty vectors
  • HTTP/SSE transports now default missing headers to an empty vector

This prevents downstream consumers from receiving incomplete payloads when optional collection fields are omitted from user config.

Checklist

  • I agree to communicate (PR description and comments) with the author myself (not AI-generated).
  • I've reviewed all code in PR myself and will vouch for its quality.
  • I've read and followed the Contributing guidelines.
  • I've filed a feature request/discussion for a new feature.
  • I've added tests where applicable.
  • I've updated documentation where necessary.
  • I've run M-x checkdoc and M-x byte-compile-file.

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