Skip to content

docs: derive the MCP endpoint and owner from the primary connection; server-neutral gateway text - #5982

Merged
qingyun-wu merged 5 commits into
mainfrom
docs/server-neutral-mcp
Oct 29, 2026
Merged

qingyun-wu merged 5 commits into
mainfrom
docs/server-neutral-mcp

Conversation

@qingyun-wu

@qingyun-wu qingyun-wu commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What changed, and why

The owner's rule after the ag2.space → s.space move: derive every server-specific value from the connection record or the homeserver's DotSpace entry, never from a literal, for any number of servers (ag2.space + s.space + dev.s.space). This PR removes the remaining docs/manifest literals.

  • src/dotspace.py DEFAULT_INSTANCES: every built-in DotSpace now names its mcp_url (mcp. / dev-mcp. under ag2.space and s.space, path /mcp). The registry is the one place a per-server literal is allowed. Vendored copy regenerated with packages/ag2-sparrow/tools/sync_from_src.py.
  • docs/codex-core.md: no longer tells agents to use a fixed mcp.ag2.space/mcp. It shows how to take the primary connection's server from connections.py list --json and read that server's mcp_url from src/dotspace.py.
  • skills/skill-usage-report/manifest.json: AG2_CLOUD_ORIGIN is declared empty. The manifest value outranks the computed default, so a pinned https://sutando.ag2.space overrode dotspace.default_cloud_origin() on every install.
  • skills/schedule-crons/SKILL.md: the cron-room owner is the primary row's owner_mxid, not @<owner>:ag2.space. Created rooms are described as !id:<server>.
  • Server-neutral wording: the header text of the gateway-bridge launchd installer, plist and wrapper no longer names one server (docs/src-map.md regenerated from those headers). The user-facing health-check messages are reworded in the companion health/status PR, because that PR already rewrites those same lines.

Where to look first

src/dotspace.py (DEFAULT_INSTANCES), then docs/codex-core.md and skills/skill-usage-report/manifest.json.

Evidence

The MCP endpoints were checked live. Each returns an OAuth 401 that names its own protected-resource metadata:

https://mcp.ag2.space/mcp:     resource_metadata="https://mcp.ag2.space/.well-known/oauth-protected-resource/mcp"
https://dev-mcp.ag2.space/mcp: resource_metadata="https://dev-mcp.ag2.space/.well-known/oauth-protected-resource/mcp"
https://mcp.s.space/mcp:       resource_metadata="https://mcp.s.space/.well-known/oauth-protected-resource/mcp"
https://dev-mcp.s.space/mcp:   resource_metadata="https://dev-mcp.s.space/.well-known/oauth-protected-resource/mcp"

The documented lookup, run against an s.space-primary row list:

server=s.space
https://mcp.s.space/mcp

Manifest default, before and after (resolve_cloud_origin({}, shipped manifest)): before it returned the pinned manifest literal whatever default_cloud_origin() said; now the test asserts the shipped value is "" and that resolution equals dotspace.default_cloud_origin().

Tests

python3 tests/dotspace.test.py                                 OK (new: each built-in instance names its mcp_url; dev.s.space resolves per server)
python3 tests/dotspace-literal-guard.test.py                   OK (manifest allowlist entry removed: no literal left)
python3 tests/skill-usage-report-cloud-origin-precedence.test.py OK
python3 tests/skill-usage-report-standalone-import.test.py     OK (one assertion now runs with core hidden, as the test intends; it passed before only because the manifest literal equalled the core default)
python3 tests/ag2-sparrow-drift.test.py, cloud-auth, connections, agent-api-connections, runtime-api-connections-view, ag2space-links: OK
gateway-bridge launchd/wrapper suites (plist escaping, interpreter resolution, restart, fix label, wrapper agent-bridges / primary-room / self-heal): OK
bash scripts/review-checks.sh --diff <(git diff origin/main...HEAD)   PASS
python3 skills/release/scripts/docs_audit.py                   PASS
python3 scripts/gen-src-map.py --check                         up to date
bash scripts/lint-workspace-resolution.sh                      rc=0

Diff coverage: the only changed Python is the DEFAULT_INSTANCES literal and test files, and the new dotspace test covers it.

Feature/documentation consistency

docs/dotspace.md (registry fields and how callers use mcp_url) and docs/codex-core.md are updated, and the docs/catalog.json date for codex-core is bumped. The dotspace.md date is bumped in the companion health/status PR, so the two PRs don't conflict on that line.

Risks / edge cases

  • A configured core.dotspace.instances list replaces the built-ins, so an operator-written entry without mcp_url names none. A well-known mcp_url still fills it for a registered server, as before.
  • Coordination: the open Codex-launcher PR also edits docs/codex-core.md, in different hunks (setup and launcher sections). There is no textual overlap.

Follow-ups

  • skills/skill-usage-report/scripts/report-usage.py could pass the primary connection's server to default_cloud_origin(primary_server=...) once the companion PR (which adds that parameter) lands.
  • skills/schedule-crons/ensure-cron-room.py still posts through the legacy gateway token. Moving it to the primary connection belongs with the shared room/connection resolver.

🤖 Generated with Claude Code

Behaviour change: with AG2_CLOUD_ORIGIN empty and core absent, skill-usage-report resolves no origin and skips reporting; it no longer posts to the manifest URL.

…server-neutral gateway text

- dotspace: each built-in DotSpace names its mcp_url (the registry is the one
  place a per-server endpoint is written down; vendored copy synced).
- docs/codex-core.md: take the MCP URL from the primary connection's DotSpace
  instead of a fixed ag2.space endpoint.
- skill-usage-report: the manifest declares AG2_CLOUD_ORIGIN empty, so the
  default is dotspace.default_cloud_origin() rather than a pinned server that
  outranked it.
- schedule-crons: the cron-room owner is the primary row's owner_mxid; created
  rooms carry their own server.
- gateway-bridge launchd installer, plist and wrapper headers no longer name one
  server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@qingyun-wu
qingyun-wu requested a review from sonichi October 28, 2026 19:15
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@liususan091219 liususan091219 left a comment

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.

Requesting changes: the new Codex MCP lookup quietly prints an empty URL when there is no primary connection, and the doc then tells the reader to paste it.

  • Repro: I ran the docs/codex-core.md snippet at head against a workspace with no connections record. server came out empty, python3 src/dotspace.py "" returned "mcp_url": "", and echo "$mcp_url" printed nothing, with no error. The next steps write url = "" or run codex mcp add ag2-space --url "". That section is for "a Codex core set up without the app", the install least likely to have a primary row. The literal it replaces worked there. Please guard the empty case: say there is no primary connection and what to do, as the schedule-crons text already does for an empty OWNER.
  • Non-blocking: with AG2_CLOUD_ORIGIN now "", skill-usage-report with core absent resolves no origin and skips reporting. Before, it posted to the manifest URL. That is consistent with _cloud_fallback's docstring, but the PR body doesn't name it as a behaviour change.
  • Checked, fine: DEFAULT_INSTANCES mcp_url values match the endpoints listed in the evidence. The new dotspace test calls registered_instances/dotspace_for for real. The literal-guard allowlist entry is correctly dropped. No added line has a hardcoded workspace path. The touched tests pass locally at head.
  • CI: shard 1/9 (remote-gateway-bridge) is fixed on main by #5984, so rebase. Shard 4/9 (pool-restart-deliveries) passes locally at head, and this PR touches nothing in worker-pool, so it looks flaky (unverified). license/cla is present.
  • There are no approvals yet.

— Sutando (susans-MacBook-Pro)

@qingyun-wu

Copy link
Copy Markdown
Collaborator Author

Addressed in 3e4436c (merged main in at a10ae15, which carries the #5984 fix):

  • Empty URL: the docs/codex-core.md snippet now prints "no primary connection" and names the fix (AG2_SERVER=<homeserver>) when there is no primary, and prints "no mcp_url registered" when the server has none. $mcp_url stays empty and the doc says not to continue. A new test runs the doc snippet for real: no record, explicit server, and unregistered server.
  • Non-blocking: the skill-usage-report behaviour change is now named in the PR body.

@github-actions

Copy link
Copy Markdown
Contributor

@cla-assistant check

@github-actions

Copy link
Copy Markdown
Contributor

Coverage Gate

✅ Diff coverage PASSES the 95% bar. Whole-tree (informational): 94%.

Diff Coverage

Diff: origin/main...HEAD, staged and unstaged changes

No lines with coverage information in this diff.

@qingyun-wu
qingyun-wu merged commit 294d564 into main Oct 29, 2026
42 checks passed
@qingyun-wu
qingyun-wu deleted the docs/server-neutral-mcp branch October 29, 2026 00:15
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