Skip to content

fix: VS Code adapter fails to configure HTTP/SSE remote MCP servers (#654)#656

Merged
sergio-sisternes-epam merged 2 commits intomicrosoft:mainfrom
sergio-sisternes-epam:fix/654-vscode-http-transport
Apr 20, 2026
Merged

fix: VS Code adapter fails to configure HTTP/SSE remote MCP servers (#654)#656
sergio-sisternes-epam merged 2 commits intomicrosoft:mainfrom
sergio-sisternes-epam:fix/654-vscode-http-transport

Conversation

@sergio-sisternes-epam
Copy link
Copy Markdown
Collaborator

Description

Fix VS Code adapter failing to configure MCP servers that only have HTTP/SSE remote endpoints (e.g., com.atlassian/atlassian-mcp-server). The adapter silently produced an empty config when transport_type was missing or empty in registry remote data, while the Copilot adapter handled this correctly by defaulting to "http".

Root cause: In _format_server_config, the remotes code path required transport_type to exactly match ("sse", "http", "streamable-http"). When the registry returned remotes without a transport_type field, the check failed silently and server_config stayed empty, triggering the "Unable to configure server" error.

Fix:

  • Default to "http" when transport_type is missing, empty, or whitespace-only (matching Copilot adapter behavior)
  • Raise a clear ValueError for unrecognized non-empty transport types
  • Select the first remote with a valid URL instead of blindly using remotes[0]

Fixes #654

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally
  • All existing tests pass (3797 passed)
  • Added 8 new tests covering: missing/empty/None/whitespace transport_type, unsupported transport, URL-less remotes, header preservation with default http

@sergio-sisternes-epam sergio-sisternes-epam marked this pull request as ready for review April 9, 2026 21:12
Copilot AI review requested due to automatic review settings April 9, 2026 21:12
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

Fixes the VS Code MCP client adapter so registry “remote-only” MCP servers are configured correctly even when transport_type is missing/empty, matching the Copilot adapter’s defaulting behavior and avoiding silent empty configs.

Changes:

  • Default missing/empty/whitespace transport_type to http for VS Code remote endpoints and raise on unsupported non-empty transport types.
  • Select the first remote entry with a usable URL instead of always using remotes[0].
  • Add unit tests covering missing/empty/None/whitespace transport_type, unsupported transports, URL-less remotes, and header/input-var handling; add a changelog entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/apm_cli/adapters/client/vscode.py Fixes remote endpoint formatting/selection and adds validation for remote transports.
tests/unit/test_vscode_adapter.py Adds targeted regression tests for VS Code remote formatting behavior.
CHANGELOG.md Records the VS Code remote configuration fix under Unreleased.

Comment thread src/apm_cli/adapters/client/vscode.py
@danielmeppiel danielmeppiel added CI/CD Deprecated: use area/ci-cd. Kept for issue history; will be removed in milestone 0.10.0. and removed CI/CD Deprecated: use area/ci-cd. Kept for issue history; will be removed in milestone 0.10.0. labels Apr 19, 2026
Sergio Sisternes and others added 2 commits April 20, 2026 17:07
…sing transport_type

When the MCP registry returns remote endpoints without a transport_type
field (or with an empty value), the VS Code adapter now defaults to
"http" instead of silently producing an empty config and failing with
"Unable to configure server".

This aligns with the Copilot adapter behavior which already hardcodes
"http" for all remote servers. The fix also:

- Validates that at least one remote has a non-empty URL
- Raises a clear error for unsupported transport types
- Adds 8 new tests covering missing, empty, None, whitespace,
  unsupported transport types, URL-less remotes, and header
  preservation

Fixes microsoft#654

Co-authored-by: Copilot <[email protected]>
Normalize the URL when building server_config to prevent whitespace-
padded registry URLs from breaking VS Code connections.

Co-authored-by: Copilot <[email protected]>
@danielmeppiel
Copy link
Copy Markdown
Collaborator

APM Review Panel — PR #656

[+] Verdict: APPROVE — merge as-is, file follow-ups

A tight, focused fix for a real first-impression footgun: installing the official Atlassian MCP server (com.atlassian/atlassian-mcp-server) into VS Code returned "Unable to configure server", while the same package worked fine in Copilot. Root cause was the VS Code adapter requiring an explicit transport_type while the registry returns remotes without one. Same package, different runtime, different result — exactly the class of papercut that erodes trust in a package manager.

What's excellent

  • Symptom-first: the bug story (Atlassian MCP server fails silently in VS Code) → the fix (default to http, matching Copilot) is clean and reads in one pass.
  • 8 new tests cover every transport_type variant: missing, empty, None, whitespace, unsupported (raises), URL-less remotes (skipped), header normalization on the default-http path. This is the kind of coverage that locks in the contract.
  • New _select_remote_with_url helper kills the implicit remotes[0] assumption that caused the silent-empty-config behavior — fail-closed on bad remotes is strictly better than silently producing a broken config.
  • CHANGELOG entry present, scoped, and accurate.

Findings

  1. [i] ValueError for unrecognized transport — discussed and accepted as-is. Architect raised a forward-compat concern: when a future websocket/grpc transport lands in the registry, this path now hard-crashes instead of degrading gracefully. We verified the new ValueError follows the file's existing convention at vscode.py:187-189 (except ValueError: raise with comment "Re-raise ValueError for registry errors"). Failing loud is the right default for an unknown transport — the old silent-empty-config behavior was the actual bug. We'll revisit if/when a real-world unsupported transport surfaces. Not blocking.

  2. [i] ValueError message — minor polish opportunity. The text names the offending transport, the server, and the supported list:

    Unsupported remote transport 'grpc' for VS Code. Server: future-srv. Supported transports: http, sse, streamable-http.
    Both cli-logging and devx flagged that it could include a "what to do" hint (e.g., "Check the server's registry entry or file an issue with the server maintainer / open an issue at github.com/microsoft/apm/issues"). Optional same-PR add if you want to land it in one shot; otherwise a doc/UX sweep follow-up is fine.

  3. [i] verbose_detail log on default-to-http fallback — small ergonomic win. When transport_type is empty/missing and the adapter defaults to http, no log fires. A --verbose-only line ("Defaulted transport_type to 'http' for server 'X' (registry field missing)") would help diagnose malformed registry entries fast. Optional.

  4. [i] Test gap: all-URL-less remotes. Architect noted there's no test for the case where every remote in the list has an empty/missing URL — _select_remote_with_url returns None, control falls through to if not server_config: and surfaces "Unable to configure server" gracefully. The behavior is correct, but a one-line test would lock it in. Optional.

  5. [i] CHANGELOG entry doesn't include the user-visible symptom. Anyone Googling "Unable to configure server" to find this fix won't land here. Consider appending "...previously caused 'Unable to configure server' errors." Optional.

Cross-runtime symmetry — file as follow-up

The DevX agent surfaced an interesting asymmetry that's not introduced by this PR but is exposed by the fix: the Copilot adapter has the inverse bug — it hardcodes "type": "http" and performs no validation at all. It would happily accept "grpc" from the registry and write a garbage config. With #656 merged, VS Code is now correctly stricter than Copilot. This deserves a follow-up issue, ideally tagged good first issue since #656 is a perfect reference implementation:

Symmetric transport validation in Copilot adapterapm_cli/adapters/client/copilot.py:188-196 accepts any transport_type value (or none) and silently writes it. Mirror PR #656's defaulting-and-raising logic so both adapters share the same contract.

Two more low-priority follow-ups worth tracking:

  • De-duplicate _select_remote_with_url — same remotes[0] selection pattern lives in both adapters; promote to MCPClientAdapter or a free function (architect nit).
  • Cleartext URL warning at install time — broader hardening; the registry can serve http:// URLs and they pass through unchanged. Out of scope here; file separately if desired (security agent).

Merge call

Ship it. The bug is real and reported by users in the wild, the fix is tight, the tests are thorough, and the contested ValueError follows the file's existing convention. The forward-compat concern is principled future-proofing, not a regression. Sergio has the throughput and the receipts (#638, #656 in flight) — keeping merge latency low on clean fixes is the right call. The remaining signal lives entirely in follow-up issues.

Growth angle

  • Lead the release notes with the Atlassian storyapm install com.atlassian/atlassian-mcp-server for VS Code is a recognizable, "I actually wanted this" name. Reframes the changelog from "fixed an adapter bug" to "APM now installs the MCP servers you actually use, in the runtime you actually use."
  • Cross-runtime parity is becoming a positioning thread. Together with fix(auth): thread dep_ref.port into credential resolution (#785) #788 (auth port-threading parity across SSH/HTTPS), this is the second PR in a row landing "same APM command, same result, every runtime." Worth amplifying as a wedge against per-runtime configuration drift once a third parity fix lands.
  • Contributor funnel: filing the Copilot inverse bug as good first issue with fix: VS Code adapter fails to configure HTTP/SSE remote MCP servers (#654) #656 as the reference implementation is exactly the loop that grows a contributor base — every fix shipped becomes the template for the symmetric one.

Thanks @sergio-sisternes-epam — clean, well-tested, scoped fix with a real user-impact story behind it.

Reviewed via the apm-review-panel skill: python-architect, cli-logging-expert, devx-ux-expert, supply-chain-security-expert; synthesized by apm-ceo with oss-growth-hacker side-channel.

Copy link
Copy Markdown
Collaborator

@danielmeppiel danielmeppiel left a comment

Choose a reason for hiding this comment

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

Approving per the apm-review-panel verdict above (#656 (comment)). Tight, well-tested fix that resolves a real first-impression footgun for the Atlassian MCP server in VS Code.

Filed the symmetric Copilot adapter validation as a good-first-issue follow-up: #791. Other follow-ups (helper deduplication, cleartext URL warning, message polish) tracked in the panel comment.

Thanks @sergio-sisternes-epam — ship it.

@sergio-sisternes-epam sergio-sisternes-epam added this pull request to the merge queue Apr 20, 2026
Merged via the queue into microsoft:main with commit 5921d80 Apr 20, 2026
9 checks passed
@sergio-sisternes-epam sergio-sisternes-epam deleted the fix/654-vscode-http-transport branch April 20, 2026 20:18
danielmeppiel added a commit that referenced this pull request Apr 24, 2026
Mirror PR #656 in the Copilot adapter. Reject unrecognized remote
transports (e.g. 'grpc') with a clear ValueError, default to 'http'
when the registry omits transport_type, and skip remote entries without
URLs. Copilot CLI still emits 'type': 'http' for every remote per its
spec -- only the validation surface changes.

Adds a new tests/unit/test_copilot_adapter.py suite parallel to
tests/unit/test_vscode_adapter.py, covering missing/empty/whitespace/
None transport, the raise-on-unsupported path, the supported transport
set, and the _select_remote_with_url helper.

Fixes #791

Co-authored-by: Daniel Meppiel <[email protected]>
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.

[BUG] "com.atlassian/atlassian-mcp-server installation failed" during apm install

3 participants