Repository navigation
MCP search registry with offline fallback (PR C of 3) - #131
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final PR of the three. Wires pasclaw.dev's MCP registry into the existing catalog + install paths and adds a new
pasclaw mcp searchsubcommand. 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:SearchMCPHub(query, limit)GetMCPHubEntry(slug)TMCPCatalogEntryso callers don't need a separate code path. Returns'not found'on 404.ResolveMCPCatalog(out entries, out source, out skipped, out err)pasclaw mcp catalogdriver. 5 s hub timeout (keepcatalogsnappy), falls back toKnownMCPServerson any failure.source = 'hub'when entries came from pasclaw.dev,'builtin'otherwise.Cmd.MCPchanges:DoCatalogcallsResolveMCPCatalogand 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)DoInstalltriesGetMCPHubEntryfirst; falls back toFindCatalogEntryon miss or network error. Both paths write the sameTMCPServerconfig entry —list/test/showwork identically afterward.DoSearchwired topasclaw mcp search <query>— hub-only.Limitations (v1)
transport: "stdio"); v1 skips them with a debug log + a skipped-count inDoCatalog's attribution line. Adding stdio support means extendingTMCPCatalogEntryto carrycommand + args— separate change.envSchemamapping picks the first required env var and assumesBearer %sformat. Richer mapping (multi-var, custom header format) is a follow-up once the hub'senvSchemashape stabilises in the OpenAPI.Test plan
make smoke11/11 OKpasclaw mcp catalogfalls back cleanly with a yellowhub unreachablenotice and shows the bundled 5 entriespasclaw mcp search <q>fails loudly (search has no fallback, as designed)mcp list/add/remove/test/show/editsubcommands unchangedpasclaw mcp catalogshows the hub's entries with(showing N from pasclaw.dev hub)attributionpasclaw mcp search <q>returns hub matchespasclaw mcp install <hub-only-slug>succeeds and writes a workingmcp_serversentry thatpasclaw mcp test <slug>can probeGenerated by Claude Code