Repository navigation
Add a command to list the Platform MCP server's tools - #25
Merged
Merged
Conversation
`adapt mcp tools` sends a JSON-RPC `tools/list` request to Platform's
hosted MCP server at `/mcp` and lists its built-in tools: a NAME / ACCESS /
DESCRIPTION table in a terminal, or the server's `{"tools":[...]}` result
as JSON. `adapt mcp tools NAME` prints one tool's full definition,
including its input schema.
Platform serves 2025-era MCP statelessly, so one request per page needs no
initialize handshake. The CLI sends the required Accept and
MCP-Protocol-Version (2025-03-26) headers, reads JSON or event-stream
replies, follows nextCursor, and exits non-zero on JSON-RPC errors.
`/mcp` accepts organization API keys but never CLI sign-in sessions, so the
command refuses a saved browser login before sending it, and 401 and 403
replies explain the API-key requirement instead of suggesting a new login.
The terminal table renderer moves into a shared `output::table` function
with unit tests; existing tables are unchanged.
Closes #3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Confidence Score: 4/5
Summary
Adds API-key-authenticated MCP tool discovery, pagination, and terminal output. Risk centers on transport compatibility and shared rendering. Local formatting, Clippy, 99 tests, and 14 additional checks passed; deployed Platform integration was not exercised.
Deployed verification not applicable: adapt/platform-cli is outside the adapt/adapt and adapt/platform pilot. Its CI builds CLI artifacts, not PR previews. No webhook sent.
Important Files Changed
| File | Changes |
|---|---|
| src/mcp.rs | MCP transport, response matching, pagination, authentication guidance, and tool formatting. |
| src/commands.rs | Credential-kind detection and MCP tools dispatch using existing origin and organization resolution. |
| src/cli.rs | New tools subcommand and MCP client-management help. |
| src/output.rs | Shared table renderer extraction and formatting tests. |
| src/stream.rs | Exposes the existing incremental SSE decoder within the crate. |
| tests/mcp_tools/mod.rs | Mock-server coverage for transport, pagination, authentication, errors, and named tool lookup. |
| docs/cli-reference.md | Documents tool discovery, API-key authentication, output, and transport limits. |
| skills/adapt/SKILL.md | Distinguishes hosted Platform tools from connected services and authorized MCP clients. |
Run info
| Field | ID |
|---|---|
| Agent | 0d6ccd7e-b62f-4075-a561-199d1a7b1bf0 |
| Automation | ec14e69d-634f-4af0-a6dd-27aa06a1f6b3 |
| Run | 270e68e1-15de-472b-99aa-645cfa712cf6 |
Reviewed: 27e068c-dae4675 · ↻ Re-run review
Contributor
|
This isn't an acceptable ux |
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.
Closes #3
Summary
adapt mcp toolslists the built-in tools of Platform's hosted MCP server (POST /mcp, JSON-RPCtools/list). A terminal shows NAME, ACCESS (read-only,writeordestructive, from each tool's annotations) and the first sentence of each description. Piped or--jsonoutput is the server's{"tools":[...]}result, unchanged.adapt mcp tools NAMEprints one tool's full description, input schema and annotations.Accept: application/json, text/event-streamandMCP-Protocol-Version: 2025-03-26, the version Platform's docs and tests use, and reads either a JSON or an event-stream reply. It skips notifications and returns as soon as the response with its request ID arrives.nextCursorto the last page and stops on a repeated cursor. Platform currently returns every tool in one page.MCP tools/list failed: CODE MESSAGE).Authentication
The issue asks for the existing authentication, but
/mcpdeliberately accepts organization API keys and never CLI sign-in sessions. Platform'smcp.integration.test.tshas a test named "never accepts session bearer tokens". So:adapt auth login --token-stdin(optionally in its own--profile) or useADAPT_TOKEN.adapt auth login", which would only produce another session. A session token supplied throughADAPT_TOKENcan't be detected up front, so it gets this message.X-Organization-Idis sent as for every other command.Changes beyond mcp tools
output::printintooutput::table, which takes any writer. Existing tables are byte-for-byte unchanged (checked in a terminal against the 0.1.0 release), and the renderer now has unit tests.Decoderinstream.rsis nowpub(crate)so the new module can reuse it.mcp listandmcp revokeget help text.Docs
docs/cli-reference.mdgets a Platform MCP tools section and drops the line that put the/mcptransport out of scope.docs/api-coverage.mdand the bundled skill are updated.Testing
tests/mcp_tools/mod.rshas 13 mock-server tests: SSE and JSON replies, request headers and body, following two pages, a repeated cursor, a JSON-RPC error, a stream that ends before the result, the 401 and 403 hints, refusing a saved session without sending a request, a saved API key, not signed in, a tool by name and an unknown name.mainmerged), using an API key from a throwaway local account:mcp tools --jsonis identical to the result of the docs' curl request (39 tools).--org, and an unknown name all exit 1 with the expected messages.cargo fmt --check,cargo clippy --all-targets -- -D warningsandcargo test --lockedpass.Known limits
2025-03-26. If Platform stops serving 2025-era MCP, the command fails with the server's unsupported-version error.🤖 Generated with Claude Code