Repository navigation
fix(mcp): mcp serve --profiles all starts with no profile on the computer - #3108
Merged
Merged
Conversation
…mputer
Directories such as Glama start the MCP server in an empty container and ask
for its tools. `<cli> mcp serve --profiles all` exited before the handshake
there ("no tg profile on this computer yet"), so WireCat servers were marked
as not deployable and could not be listed.
With no profile (none configured, or only bot profiles) the server of every
profile now starts, answers initialize and tools/list, and refuses every
tools/call with a configuration_error naming the command that sets up the
first profile (`<cli> personal setup`, or `<cli> personal session start` for a
CLI that signs in with a session). The instructions open with the same line.
The tool list normally comes from a profile's own server, started as a child.
With no profile there is no child to ask, so the list is built in this
process from the program: the same registerCommands catalogue, over an
in-memory transport. Which tools are listed never follows a profile's
permissions (they decide availability inside tools_search), so no profile is
read, picked or made. The `profile` field stays required; with no profile it
has no enum, since an empty enum matches nothing.
Unchanged: bare `mcp serve` with no profile named, and `--profiles a,b` naming
a profile that does not exist, are still refused: the server always names its
profiles (WC-MCP-9), and a wrong name is the owner's mistake to fix.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Task
npx -y @wirecat/tg-cli mcp serve --profiles allon a computer with no profile exits before the MCP handshake with "no tg profile on this computer yet". Directories such as Glama start the server in an empty Docker container only to read its tools, so they mark WireCat servers as "cannot be deployed", and the awesome-mcp-servers listing (punkpeye/awesome-mcp-servers#19867) cannot be merged.What changes, case by case
--profiles all, no profile (or only bot profiles)initializeandtools/listanswer; everytools/callis refused withconfiguration_error--profiles workwhereworkdoes not existno profile named "work" — profiles here: none). A wrong name the owner typed is their mistake to fix, and serving it would stand for a profile that is not there.mcp servewith no profile named--profiles allis how to ask for "whatever exists".--profiles allwith profilesThe refusal names the command that makes the first profile:
<tool> personal setup,<tool> personal session startfor a CLI that signs in with a session, or<tool> personal …for one with neither, then "connect again". It is an error object, with no stack. The instructions open with the same line, read per session, so an HTTP server that gets a profile while it runs stops showing it.Where the tool list comes from with no profile
With profiles, the list comes from a profile's own server, started as a child (
<tool> <profile> mcp serve). With no profile there is no child to ask, and starting one for a made-up name would pick a profile. So the list is built in this process from the program: the sameregisterCommandscatalogue a profile's server uses, read over an in-memory transport (catalogueOfinsrc/cli/messenger/mcp-command.ts,listedToolsinsrc/mcp/all-profiles.ts).Permissions: the list a server shows does not depend on a profile's permissions. They decide each command's
availabilityinsidetools_search, not which tools exist (includeUnavailable: true). So no defaults had to be assumed: the list is the one a new profile would get.src/cli/app-mcp-command.test.tschecks this by comparing it, without theprofilefield, with whatcal work mcp servelists.The
profilefield stays required. With no profile it has noenum, because an empty enum matches nothing and a schema check would reject the tool.Nothing is picked or made: no profile, no config entry, no state folder, no store, no keyring access beyond the existing read-only profile listing. The messenger test asserts that the config has no profile and that the state folder and the store do not exist afterwards.
Testing
src/cli/messenger/mcp-every-profile.test.ts: on an empty computer, a config with no profile, and only bot profiles, the server goes throughinitialize,tools/list(three tools, each requiringprofile) and twotools/callthat get the setup error. A new case covers--profiles workwith none: still refused.src/cli/app-mcp-command.test.ts: a CLI that is not a messenger lists the same tools as a real profile's server.pnpm typecheck,pnpm docs:check, biome, and the affected test files (60 tests) on the currentmain.commands --jsontoo) fails withinternal_errorbecause the versions do not match, so that run would prove nothing. The integration tests above use the real server code over stdio.A fresh-agent review found no bug. From its findings, these were fixed: instructions read per session, a failed list no longer cached, wording for HTTP, and stronger test checks.
🤖 Generated with Claude Code