Skip to content

MCP search registry with offline fallback (PR C of 3) - #131

Merged
FMXExpress merged 1 commit into
mainfrom
claude/mcp-hub
Jun 4, 2026
Merged

FMXExpress merged 1 commit into
mainfrom
claude/mcp-hub

Conversation

@FMXExpress

Copy link
Copy Markdown
Owner

Summary

Final PR of the three. Wires pasclaw.dev's MCP registry into the existing catalog + install paths and adds a new pasclaw mcp search subcommand. Hub-first by default with automatic fallback to the bundled 5-entry catalog when the registry is unreachable.

What's new

New unit src/pkg/mcp/PasClaw.MCP.Hub.pas:

Function Purpose
SearchMCPHub(query, limit) Hub-only query — no fallback (bundled 5-entry list is too small to be worth searching).
GetMCPHubEntry(slug) Single-entry lookup that projects the hub response onto TMCPCatalogEntry so callers don't need a separate code path. Returns 'not found' on 404.
ResolveMCPCatalog(out entries, out source, out skipped, out err) pasclaw mcp catalog driver. 5 s hub timeout (keep catalog snappy), falls back to KnownMCPServers on any failure. source = 'hub' when entries came from pasclaw.dev, 'builtin' otherwise.

Cmd.MCP changes:

  • DoCatalog calls ResolveMCPCatalog and prefixes the table with one of:
    • (showing N from pasclaw.dev hub)
    • ! hub unreachable (…) — showing built-in N entries (yellow)
    • (showing built-in N entries)
  • DoInstall tries GetMCPHubEntry first; falls back to FindCatalogEntry on miss or network error. Both paths write the same TMCPServer config entry — list/test/show work identically afterward.
  • New DoSearch wired to pasclaw mcp search <query> — hub-only.
  • Help text updated.

Limitations (v1)

  • HTTP transport only. The hub may carry stdio entries (transport: "stdio"); v1 skips them with a debug log + a skipped-count in DoCatalog's attribution line. Adding stdio support means extending TMCPCatalogEntry to carry command + args — separate change.
  • envSchema mapping picks the first required env var and assumes Bearer %s format. Richer mapping (multi-var, custom header format) is a follow-up once the hub's envSchema shape stabilises in the OpenAPI.

Test plan

  • FPC build clean
  • make smoke 11/11 OK
  • Network-down spot check:
    • pasclaw mcp catalog falls back cleanly with a yellow hub unreachable notice and shows the bundled 5 entries
    • pasclaw mcp search <q> fails loudly (search has no fallback, as designed)
    • All existing mcp list/add/remove/test/show/edit subcommands unchanged
  • Manual with a live pasclaw.dev: pasclaw mcp catalog shows the hub's entries with (showing N from pasclaw.dev hub) attribution
  • Manual pasclaw mcp search <q> returns hub matches
  • Manual pasclaw mcp install <hub-only-slug> succeeds and writes a working mcp_servers entry that pasclaw mcp test <slug> can probe

Generated by Claude Code

Wires pasclaw.dev's MCP registry into the existing catalog +
install paths and adds a new `pasclaw mcp search` subcommand.
Hub-first by default with automatic fallback to the bundled 5-
entry catalog when the registry is unreachable.

New unit src/pkg/mcp/PasClaw.MCP.Hub.pas:
  - SearchMCPHub(query, limit) — hub-only query, no fallback
    (the bundled 5-entry list is too small to search usefully).
  - GetMCPHubEntry(slug) — single-entry lookup that projects the
    hub's response onto the existing TMCPCatalogEntry record so
    callers don't need a separate code path. Returns 'not found'
    on 404, surfaces other errors as-is.
  - ResolveMCPCatalog(out entries, out source, out hubSkipped,
    out hubErr) — `pasclaw mcp catalog` driver. 5 s hub timeout
    (keep `catalog` snappy), falls back to KnownMCPServers on
    any failure (DNS / TLS / 5xx / parse error). Source = 'hub'
    when entries came from pasclaw.dev, 'builtin' otherwise.

Transport handling: v1 maps only transport=='http' hub entries
onto TMCPCatalogEntry (URL + EnvVar + AuthFmt is HTTP-only).
Non-HTTP entries surface as a skipped-count in DoCatalog's
attribution line. Adding stdio support means extending the
TMCPCatalogEntry shape to carry command + args — separate change.

EnvSchema mapping: the hub's per-entry envSchema can declare
multiple required env vars; v1 picks the first required one for
EnvVar and assumes Bearer-token format. Most entries have a single
auth token; richer mapping (multi-var, custom header format) is a
follow-up once the hub's envSchema shape stabilises in the
OpenAPI.

Cmd.MCP changes:
  - DoCatalog now calls ResolveMCPCatalog and prefixes the table
    with "(showing N from pasclaw.dev hub)" / "(offline — showing
    built-in N entries)" / "(showing built-in N entries)".
  - DoInstall tries GetMCPHubEntry first; falls back to
    FindCatalogEntry on hub miss or network error. Both paths
    write the same TMCPServer config entry, so list/test/show
    work identically afterwards.
  - New DoSearch wired to `pasclaw mcp search <query>`.
  - Help text updated.

Verified end-to-end with the FPC build (smoke 11/11 OK) plus a
network-down spot check:
  - `pasclaw mcp catalog` falls back cleanly with a yellow "hub
    unreachable" notice and shows the bundled 5 entries
  - `pasclaw mcp search foo` fails loudly (search has no fallback)
  - All existing `mcp list/add/remove/test/show/edit` subcommands
    unchanged

PR ordering: A (#129 merged) wired skills hub-first; B (#130, in
review) added the vault tool + CLI + onboarding opt-in; this is C
— each is independent.

https://claude.ai/code/session_01TBcLtmpj7dqA5tyFbGnQon
@FMXExpress
FMXExpress merged commit 2bb322c into main Jun 4, 2026
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