Skip to content

fix(mcp): mcp serve --profiles all starts with no profile on the computer - #3108

Merged
leemour merged 1 commit into
mainfrom
fix/mcp-serve-no-profiles
Nov 18, 2026
Merged

leemour merged 1 commit into
mainfrom
fix/mcp-serve-no-profiles

Conversation

@leemour

@leemour leemour commented Nov 18, 2026

Copy link
Copy Markdown
Member

Task

npx -y @wirecat/tg-cli mcp serve --profiles all on 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

Case Before After
--profiles all, no profile (or only bot profiles) exits, code 3 starts; initialize and tools/list answer; every tools/call is refused with configuration_error
--profiles work where work does not exist refused still refused (no 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 serve with no profile named refused still refused. The server always names its profiles (WC-MCP-9); --profiles all is how to ask for "whatever exists".
--profiles all with profiles unchanged unchanged

The refusal names the command that makes the first profile: <tool> personal setup, <tool> personal session start for 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 same registerCommands catalogue a profile's server uses, read over an in-memory transport (catalogueOf in src/cli/messenger/mcp-command.ts, listedTools in src/mcp/all-profiles.ts).

Permissions: the list a server shows does not depend on a profile's permissions. They decide each command's availability inside tools_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.ts checks this by comparing it, without the profile field, with what cal work mcp serve lists.

The profile field stays required. With no profile it has no enum, 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 through initialize, tools/list (three tools, each requiring profile) and two tools/call that get the setup error. A new case covers --profiles work with 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.
  • Locally: pnpm typecheck, pnpm docs:check, biome, and the affected test files (60 tests) on the current main.
  • Not done: a run against a built tg-cli. tg 0.133 is built against cli-core 0.681. Pointed at this branch, every command (commands --json too) fails with internal_error because 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

…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>
@leemour
leemour merged commit db02a85 into main Nov 18, 2026
43 checks passed
@leemour
leemour deleted the fix/mcp-serve-no-profiles branch November 18, 2026 07:58
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.

1 participant