Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(deps): cap mcp below 1.30, which breaks IBKR OAuth discovery

Haozhe Wu4abd6cc2b045
diff --git a/agent/tests/test_mcp_oauth_schema.py b/agent/tests/test_mcp_oauth_schema.py
index c8118b122..0624af116 100644
--- a/agent/tests/test_mcp_oauth_schema.py
+++ b/agent/tests/test_mcp_oauth_schema.py
@@ -506,3 +506,42 @@ def test_stdio_path_unchanged() -> None:
cfg = MCPServerConfig.model_validate({"command": "uvx", "args": ["demo"]})
transport = _build_transport(cfg)
assert isinstance(transport, StdioTransport)
+
+
+def test_mcp_version_is_capped_below_the_strict_issuer_check() -> None:
+ """The IBKR OAuth path depends on this cap; a silent bump breaks the broker.
+
+ mcp 1.30.0 enforces RFC 8414 section 3.3 — an authorization server's
+ metadata `issuer` must equal the issuer used to build the well-known URL.
+ IBKR's official MCP server advertises the authorization server
+ ``https://api.ibkr.com/oauth2`` while its metadata (both well-known paths,
+ verified live 2026-09-08) reports ``"issuer": "https://api.ibkr.com"``, so
+ discovery raises ``OAuthFlowError`` before any token is requested and no
+ IBKR connection can be established.
+
+ ``test_ibkr_oauth_registration_uses_browser_headers`` above is the same
+ finding at the fixture level, and its fixture mirrors the live document —
+ so making it pass by editing the fixture would hide a broken broker
+ behind a green suite. This test guards the actual remedy instead.
+ """
+ import tomllib
+ from pathlib import Path
+
+ from packaging.requirements import Requirement
+
+ pyproject = Path(__file__).resolve().parents[2] / "pyproject.toml"
+ dependencies = tomllib.loads(pyproject.read_text(encoding="utf-8"))["project"][
+ "dependencies"
+ ]
+ caps = [
+ Requirement(entry)
+ for entry in dependencies
+ if Requirement(entry).name == "mcp"
+ ]
+ assert caps, "the mcp cap is gone from pyproject dependencies"
+ assert not caps[0].specifier.contains("1.30.0"), (
+ f"mcp 1.30.0 satisfies {caps[0]}; IBKR OAuth discovery fails on it"
+ )
+ assert caps[0].specifier.contains("1.29.1"), (
+ f"{caps[0]} excludes the last working version"
+ )
diff --git a/pyproject.toml b/pyproject.toml
index 8cfdefde9..04fdd9da2 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -59,6 +59,15 @@ dependencies = [
# session snapshot shape; tests construct it the 2.x way. Cap until the
# adaptation lands.
"fastmcp>=2.14.0,<4.0.0",
+ # mcp 1.30.0 enforces RFC 8414 section 3.3 strictly: the `issuer` in an
+ # authorization server's metadata must equal the issuer used to build the
+ # well-known URL. IBKR's official MCP server advertises the authorization
+ # server https://api.ibkr.com/oauth2 while its metadata (verified live on
+ # 2026-09-08 at both well-known paths) says `"issuer": "https://api.ibkr.com"`,
+ # so discovery raises OAuthFlowError and the IBKR OAuth connection cannot be
+ # established at all. The cap is on the real broker path, not on the test
+ # that caught it — pulled in transitively through fastmcp.
+ "mcp<1.30",
"ddgs>=6.0.0",
"jinja2>=3.1.0",
"matplotlib>=3.7.0",