Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/api-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ one from the CLI, or reuse the UUID supplied with `--idempotency-key`.
| `GET /v1/gateway/search` | `connections search QUERY` |
| `POST /v1/gateway/describe` | `connections describe ID TOOL` |
| `POST /v1/gateway/call` | `connections call ID TOOL --arguments JSON` |
| `POST /mcp` (JSON-RPC `tools/list`) | `mcp tools [NAME]` |

Auth commands use `/v1/auth/device/code`, `/device/token`, `/get-session`, and `/sign-out`.
Organization commands use Better Auth's `/v1/auth/organization/*` routes; organization
Expand Down
38 changes: 35 additions & 3 deletions docs/cli-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ For example, use `adapt org members ls` or `adapt sandbox ls --all`.
| `connections` | `list`, `get`, `create`, `update`, `delete`, `refresh`, `grant`, `oauth`, `oauth-complete`, `calls`, `principals`, `search`, `describe`, `call` |
| `keys` | `list`, `create`, `delete` |
| `sessions` | `list`, `revoke`, `revoke-others` |
| `mcp` | `list`, `revoke` |
| `mcp` | `list`, `revoke`, `tools` |
| `events` | Show organization changes, or personal changes with `--personal` |
| `health` | Test API availability, or database readiness with `--ready` |
| `profiles` | Show saved API URLs, organizations, and credential status |
| `api` | Send an authenticated request to a path on the selected API server |

`connections` manages upstream MCP services.
`mcp` manages clients with permission to connect to Platform.
Named commands do not cover internal compute administration, OAuth provider internals, or the `/mcp` transport.
`mcp list` and `mcp revoke` manage clients with permission to connect to Platform.
`mcp tools` lists the tools that Platform's own MCP server provides.
Named commands do not cover internal compute administration, OAuth provider internals, or calling tools through `/mcp`.
See [API coverage](api-coverage.md) for routes and API version details.

## Authentication and profiles
Expand Down Expand Up @@ -516,6 +517,37 @@ To revoke the key, use `adapt keys delete KEY_ID`.
Logout always uses the saved credential.
It never revokes a key from `ADAPT_TOKEN`.

## Platform MCP tools

Platform hosts an MCP server at `/mcp` on the API origin.
To list its built-in tools, run:

```sh
adapt mcp tools
adapt mcp tools read_file
adapt mcp tools --json
```

A terminal shows each tool's name, access hint, and the first sentence of its description.
The access hint comes from the tool's annotations: `read-only`, `write`, or `destructive`.
It describes the tool, not the permissions of your key.
With a tool name, the command prints that tool's full description, input schema, and annotations.
JSON output is the server's `tools/list` result, `{"tools":[...]}`, after the CLI follows every page.

The command authenticates with an organization API key.
The MCP server rejects CLI sign-in sessions, so the command refuses a saved browser login before it sends a request.
To keep your browser login, save a key in its own profile:

```sh
adapt keys create mcp-tools --json
adapt --profile agent auth login --token-stdin < /path/to/private/key-file
adapt --profile agent mcp tools
```

The CLI sends one stateless `tools/list` request per page with MCP protocol version `2025-03-26`.
It accepts JSON and event-stream responses.
It does not retry this request automatically.

## Configuration

| Setting | Option | Environment variable |
Expand Down
13 changes: 13 additions & 0 deletions skills/adapt/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ describe the message-posting tool and use that channel ID. Listing channels is
a separate action from sending a message. Inspect tool results for reported
errors as well as the CLI exit status.

## Platform MCP server

```sh
adapt mcp tools
adapt mcp tools TOOL_NAME
```

`mcp tools` lists the built-in tools of Platform's own MCP server, and
`mcp tools TOOL_NAME` prints one tool's input schema. It requires an organization
API key (`adapt auth login --token-stdin` or `ADAPT_TOKEN`); browser sign-in
sessions are refused. These are not the user's connected tools; use
`connections search` for those. `mcp list` shows authorized MCP clients, not tools.

## Output, pagination, and retries

Normal commands print JSON when piped; `--json` requests it explicitly. Execution
Expand Down
14 changes: 11 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub enum Command {
/// Manage your browser and CLI sessions
#[command(subcommand)]
Sessions(SessionCommand),
/// Inspect and revoke connected MCP clients
/// Inspect connected MCP clients and the tools the Platform MCP server provides
#[command(subcommand)]
Mcp(McpCommand),
/// Watch resource changes as newline-delimited JSON
Expand Down Expand Up @@ -690,10 +690,18 @@ pub enum SessionCommand {

#[derive(Subcommand)]
pub enum McpCommand {
/// List MCP clients you have authorized
#[command(visible_alias = "ls")]
List,
Revoke {
id: Uuid,
/// Revoke an authorized MCP client
Revoke { id: Uuid },
/// List the Platform MCP server's built-in tools (requires an API key)
#[command(
after_help = "The Platform MCP server accepts organization API keys, not browser sign-in sessions.\nSave a key with `adapt auth login --token-stdin` (optionally in its own --profile) or set ADAPT_TOKEN.\nWith NAME, prints that tool's full description, input schema, and annotations."
)]
Tools {
/// Show one tool's full definition
name: Option<String>,
},
}

Expand Down
11 changes: 10 additions & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::{
auth,
cli::*,
config::{self, Config, Credential, CredentialKind},
input, output, shell, skill, stream,
input, mcp, output, shell, skill, stream,
};
use anyhow::{Context, Result, bail};
use clap::ValueEnum;
Expand Down Expand Up @@ -48,6 +48,13 @@ pub async fn run(cli: Cli) -> Result<u8> {
let origin = config::origin(cli.api_url.as_deref().unwrap_or(&saved.api_url))?;
let same_origin = config::origin(&saved.api_url)?.origin() == origin.origin();
let env_token = std::env::var("ADAPT_TOKEN").ok().filter(|s| !s.is_empty());
// Platform's MCP server rejects sign-in sessions, so `mcp tools` refuses one up front.
let session_credential = env_token.is_none()
&& same_origin
&& saved
.credential
.as_ref()
.is_some_and(|c| c.kind == CredentialKind::Session);
let token = env_token.as_deref().or_else(|| {
same_origin
.then_some(saved.credential.as_ref())
Expand Down Expand Up @@ -184,7 +191,9 @@ pub async fn run(cli: Cli) -> Result<u8> {
SessionCommand::Revoke { id } => api.post("/v1/auth/sessions/revoke", &json!({"id":id.to_string()})).await?,
SessionCommand::RevokeOthers => api.post("/v1/auth/sessions/revoke-others", &json!({})).await?,
},
Command::Mcp(McpCommand::Tools { name }) => return mcp::tools(&api, name, session_credential, cli.json).await,
Command::Mcp(command) => match command {
McpCommand::Tools { .. } => unreachable!("MCP tool lists are dispatched separately"),
McpCommand::List => api.get("/v1/auth/mcp/connections").await?,
McpCommand::Revoke { id } => api.post("/v1/auth/mcp/revoke", &json!({"id":id.to_string()})).await?,
},
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ mod cli;
mod commands;
mod config;
mod input;
mod mcp;
mod output;
mod shell;
mod skill;
Expand Down
Loading
Loading