diff --git a/README.md b/README.md index 0772035..e9357ee 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Adapt Platform CLI `adapt` is the command-line client for [Adapt Platform](https://platform.adapt.com). -It manages sandboxes, runs commands, transfers files, and calls connected tools. +It manages sandboxes, runs commands, and transfers files. ## Install @@ -190,28 +190,6 @@ Download a file from a sandbox: adapt files get SANDBOX_ID /tmp/output.txt ./output.txt ``` -## Call connected tools - -Find tools on your connected Model Context Protocol (MCP) services: - -```sh -adapt connections search "files" -``` - -In the following commands, replace `CONNECTION_ID` and `TOOL_NAME` with values from the search results. -Show the tool's input schema: - -```sh -adapt connections describe CONNECTION_ID TOOL_NAME -``` - -Put the required arguments in `arguments.json`. -Then call the tool: - -```sh -adapt connections call CONNECTION_ID TOOL_NAME --arguments @arguments.json -``` - ## Install the skill Install the Adapt skill for Codex, Claude Code, Pi, and OpenCode: diff --git a/docs/api-coverage.md b/docs/api-coverage.md index 21dacc4..20bd79e 100644 --- a/docs/api-coverage.md +++ b/docs/api-coverage.md @@ -4,6 +4,7 @@ Based on the resource OpenAPI document from `../platform` at `f20ded3`, plus its auth integrations. The `query` filter on `GET /v1/sandboxes` and the `name` and `status` filters on `GET /v1/images` come from platform `2396647`. `GET /v1/sandboxes/{id}/usage` comes from platform `d3b6c77`. The model routes come from platform `8747699`. +Platform removed the external-tool gateway in [PR #308](https://github.com/adapt/platform/pull/308). Every resource operation has a named command, except model provider writes (`POST`, `PUT`, and `DELETE` on `/v1/model-gateway/providers`); configure providers in the Platform dashboard. `adapt api METHOD PATH` also exposes same-origin JSON requests for less common account operations. @@ -64,20 +65,6 @@ one from the CLI, or reuse the UUID supplied with `--idempotency-key`. | `GET /v1/models` | `models list` | | `GET /v1/model-gateway/providers` | `models providers` | | `GET /v1/model-gateway/providers/{id}/models` | `models discover ID` | -| `POST /v1/gateway/connections` | `connections create --data JSON` | -| `GET /v1/gateway/connections` | `connections list` | -| `GET /v1/gateway/connections/{id}` | `connections get ID` | -| `PUT /v1/gateway/connections/{id}` | `connections update ID --data JSON` | -| `DELETE /v1/gateway/connections/{id}` | `connections delete ID` | -| `POST /v1/gateway/connections/{id}/refresh` | `connections refresh ID` | -| `PUT /v1/gateway/connections/{id}/grants` | `connections grant ID --data JSON` | -| `POST /v1/gateway/connections/{id}/oauth` | `connections oauth ID` | -| `POST /v1/gateway/connections/{id}/oauth/complete` | `connections oauth-complete ID --data JSON` | -| `GET /v1/gateway/connections/{id}/calls` | `connections calls ID` | -| `GET /v1/gateway/principals` | `connections principals` | -| `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`. diff --git a/docs/cli-reference.md b/docs/cli-reference.md index 65c6687..77b71ff 100644 --- a/docs/cli-reference.md +++ b/docs/cli-reference.md @@ -43,7 +43,6 @@ For example, use `adapt org members ls` or `adapt sandbox ls --all`. | `images` | `list`, `get`, `import`, `pull`, `wait`, `delete` | | `env` | `list`, `get`, `create`, `update`, `delete` | | `registry` | `list`, `create`, `update`, `delete` | -| `connections` | `list`, `get`, `create`, `update`, `delete`, `refresh`, `grant`, `oauth`, `oauth-complete`, `calls`, `principals`, `search`, `describe`, `call` | | `models` | `list`, `providers`, `discover` | | `keys` | `list`, `create`, `delete` | | `sessions` | `list`, `revoke`, `revoke-others` | @@ -53,7 +52,6 @@ For example, use `adapt org members ls` or `adapt sandbox ls --all`. | `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 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`. @@ -532,7 +530,7 @@ On the cloud backend, these resources accept full UUIDs or unique ID prefixes: - Sandboxes and executions. - Images and registry credentials. - Volumes and endpoints. -- Environment variable sets and tool connections. +- Environment variable sets. - Model providers. This also applies to references such as `--image-id`, `--credential`, and both IDs in an endpoint binding. @@ -557,7 +555,7 @@ Use full IDs in scripts. The Platform API must support resource ID prefixes. Authentication and organization commands require exact identifiers. -This includes `--org`, members, invitations, keys, sessions, and grant principals. +This includes `--org`, members, invitations, keys, and sessions. `org use` accepts a full organization ID or an exact slug. Pagination cursors, idempotency keys, and credential tokens also require exact values. @@ -568,10 +566,6 @@ The `--data` option accepts a JSON object, `@file.json`, or `-` for stdin. ```sh adapt registry create --data @registry-credential.json adapt env update VARIABLE_SET_ID --data @variable-patch.json -adapt connections create --data '{"name":"Tools","url":"https://tools.example.com/mcp","authType":"oauth"}' -adapt connections oauth CONNECTION_ID -adapt connections search "files" -adapt connections call CONNECTION_ID read_file --arguments '{"path":"/report.txt"}' ``` Updates require these fields: @@ -580,7 +574,6 @@ Updates require these fields: | --- | --- | | Registry credential | All credential fields and the current `version` | | Environment variable set | `name`, `version`, and `env`; use null values to remove variables | -| Tool connection | `version`, `name`, `enabled`, and `allowedTools` | Platform validates request data and permissions. It reports conflicts and unsupported operations. @@ -623,10 +616,7 @@ If you use `--cursor` to request each page yourself, supply the same filters wit Resource lists use cursor pagination. Use `--all` to retrieve all pages. -Connection lists and call history use a page size that the server sets. -Do not supply `--limit` for those commands. Member and API-key lists use `--offset` with pages of 50 entries. -Tool search returns a `nextOffset` value for the next page. ## Output and retries diff --git a/skills/adapt/SKILL.md b/skills/adapt/SKILL.md index bfafd76..3c91282 100644 --- a/skills/adapt/SKILL.md +++ b/skills/adapt/SKILL.md @@ -1,9 +1,8 @@ --- name: adapt description: >- - Use the adapt CLI to manage Adapt Platform sandboxes, run remote commands, - transfer files, and discover or execute tools from connected MCP servers. - Use when the user asks to work with Platform resources or their connected tools. + Use the adapt CLI to manage Adapt Platform resources, run commands in + sandboxes, transfer files, and inspect Platform's built-in MCP tools. --- # Adapt Platform @@ -11,7 +10,7 @@ description: >- Use `adapt COMMAND --help` for exact arguments. `adapt skill show` prints this guide offline. Discover resource IDs with list/search commands rather than guessing. Core resource selectors (sandboxes, executions, images, registries, volumes, -endpoints, variable sets, and tool connections), including linked IDs such as +endpoints, and variable sets), including linked IDs such as `--image-id`, `--credential`, and both IDs in `endpoints bind`, accept full UUIDs or unambiguous hexadecimal prefixes. Platform resolves them within the caller's authorized scope; ambiguity returns @@ -122,26 +121,6 @@ must listen on `0.0.0.0`. Endpoint tokens authenticate the hosted app with sends only `-H` headers plus the endpoint token from `--token`/`--new-token`, never follows redirects, and exits 1 after printing the body of a non-2xx response. -## Connected MCP tools - -```sh -adapt connections list --all --json -adapt connections search "slack channels" -adapt connections describe CONNECTION_ID TOOL_NAME -adapt connections call CONNECTION_ID TOOL_NAME --arguments @arguments.json -``` - -Search finds tools across the user's connections. Describe the chosen tool to -get its input schema before constructing arguments; provider tool names and -schemas vary. `--arguments` accepts a JSON object inline, `@file.json`, or `-` -for stdin. Use the returned connection ID and exact tool name. - -For Slack, discover the channel-listing tool, inspect its schema, and call it -to resolve a channel name to its ID. When posting is requested, discover and -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. - ## Models ```sh @@ -165,8 +144,7 @@ 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. +sessions are refused. `mcp list` shows authorized MCP clients. ## Output, pagination, and retries @@ -175,8 +153,7 @@ and log commands stream raw output unless `--json` is supplied, in which case they emit newline-delimited events. Progress and idempotency keys go to stderr. Resource listings return objects such as `{"sandboxes": [...], "nextCursor": ...}`. -Use `--all` to follow cursor pages. Tool search uses `--offset` and its returned -`nextOffset`; connection listings have a server-defined page size. +Use `--all` to follow cursor pages. JSON API reads retry transient connection and gateway failures with backoff, honoring `Retry-After` within the original `--timeout` budget. Readiness waits keep diff --git a/src/api.rs b/src/api.rs index 52fbdef..14069ff 100644 --- a/src/api.rs +++ b/src/api.rs @@ -182,15 +182,9 @@ impl Api { path: &str, field: &str, page: &Page, - supports_limit: bool, filters: &[(String, String)], ) -> Result { - let mut query = Vec::new(); - if supports_limit { - query.push(("limit".into(), page.limit.unwrap_or(50).to_string())); - } else if page.limit.is_some() { - bail!("This endpoint has a fixed page size; omit --limit"); - } + let mut query = vec![("limit".into(), page.limit.unwrap_or(50).to_string())]; // Filters apply to every page; following pages replace only the cursor. query.extend_from_slice(filters); if let Some(cursor) = page.cursor { diff --git a/src/auth.rs b/src/auth.rs index d5e69ff..9df47ef 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -41,7 +41,7 @@ pub fn now() -> u64 { .as_secs() } -pub fn open_browser(url: &str) -> Result<()> { +fn open_browser(url: &str) -> Result<()> { validate_http_url(&Url::parse(url)?)?; #[cfg(target_os = "macos")] let mut command = Command::new("open"); diff --git a/src/backend/cloud.rs b/src/backend/cloud.rs index 9678581..3ab693c 100644 --- a/src/backend/cloud.rs +++ b/src/backend/cloud.rs @@ -25,7 +25,7 @@ impl Backend for CloudBackend<'_> { .map(|text| ("query".into(), text.clone())) .collect::>(); self.0 - .list("/v1/sandboxes", "sandboxes", &args.page, true, &filters) + .list("/v1/sandboxes", "sandboxes", &args.page, &filters) .await } async fn sandbox_get(&self, id: ResourceRef) -> Result { diff --git a/src/cli.rs b/src/cli.rs index 2e02e1b..340a0f4 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -88,9 +88,6 @@ pub enum Command { /// Manage private registry credentials #[command(subcommand)] Registry(RegistryCommand), - /// Manage upstream MCP connections and call tools - #[command(subcommand)] - Connections(ConnectionCommand), /// Inspect model providers and the enabled model catalog #[command(subcommand, visible_alias = "model")] Models(ModelCommand), @@ -656,70 +653,6 @@ pub enum RegistryCommand { }, } -#[derive(Subcommand)] -pub enum ConnectionCommand { - #[command(visible_alias = "ls")] - List(Page), - Get { - id: ResourceRef, - }, - /// JSON: name, url, authType (none/bearer/oauth), optional token and visibility - Create(Data), - /// JSON: version, name, enabled, allowedTools, optional token - Update { - id: ResourceRef, - #[command(flatten)] - data: Data, - }, - Delete { - id: ResourceRef, - }, - Refresh { - id: ResourceRef, - }, - /// JSON: principalType (mcp/apiKey), principalId, tools - Grant { - id: ResourceRef, - #[command(flatten)] - data: Data, - }, - /// Open upstream authorization in a browser - Oauth { - id: ResourceRef, - #[arg(long)] - no_browser: bool, - }, - /// Complete upstream authorization with JSON: code, state, optional iss - OauthComplete { - id: ResourceRef, - #[command(flatten)] - data: Data, - }, - Calls { - id: ResourceRef, - #[command(flatten)] - page: Page, - }, - Principals, - Search { - #[arg(default_value = "")] - query: String, - #[arg(long, default_value_t = 0)] - offset: u32, - }, - Describe { - connection: ResourceRef, - tool: String, - }, - Call { - connection: ResourceRef, - tool: String, - /// Tool argument object: inline JSON, @file, or - - #[arg(long, default_value = "{}")] - arguments: String, - }, -} - #[derive(Subcommand)] pub enum KeyCommand { #[command(visible_alias = "ls")] diff --git a/src/commands.rs b/src/commands.rs index a2ef96b..6f2939f 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -183,19 +183,18 @@ pub async fn run(cli: Cli) -> Result { | Command::Volumes(_) | Command::Endpoints(_) | Command::Images(_)) => return resources(&CloudBackend(&api), command, cli.json).await, Command::Env(command) => match command { - EnvCommand::List(page) => api.list("/v1/environment-variable-sets", "sets", &page, true, &[]).await?, + EnvCommand::List(page) => api.list("/v1/environment-variable-sets", "sets", &page, &[]).await?, EnvCommand::Get { id } => api.get(&format!("/v1/environment-variable-sets/{id}")).await?, EnvCommand::Create(data) => api.post("/v1/environment-variable-sets", &input::object(Some(&data.data))?).await?, EnvCommand::Update { id, data } => put(&api, &format!("/v1/environment-variable-sets/{id}"), input::object(Some(&data.data))?).await?, EnvCommand::Delete { id } => delete(&api, &format!("/v1/environment-variable-sets/{id}")).await?, }, Command::Registry(command) => match command { - RegistryCommand::List(page) => api.list("/v1/registry-credentials", "credentials", &page, true, &[]).await?, + RegistryCommand::List(page) => api.list("/v1/registry-credentials", "credentials", &page, &[]).await?, RegistryCommand::Create(data) => api.post("/v1/registry-credentials", &input::object(Some(&data.data))?).await?, RegistryCommand::Update { id, data } => put(&api, &format!("/v1/registry-credentials/{id}"), input::object(Some(&data.data))?).await?, RegistryCommand::Delete { id } => delete(&api, &format!("/v1/registry-credentials/{id}")).await?, }, - Command::Connections(command) => connections(&api, command).await?, Command::Models(command) => match command { ModelCommand::List => api.get("/v1/models").await?, ModelCommand::Providers => api.get("/v1/model-gateway/providers").await?, @@ -332,7 +331,7 @@ async fn filtered_list( no_match: Option, json: bool, ) -> Result { - let result = api.list(path, field, page, true, filters).await?; + let result = api.list(path, field, page, filters).await?; print_filtered_list(result, field, no_match, json) } @@ -673,7 +672,7 @@ pub(crate) async fn files(api: &Api, command: FileCommand) -> Result { pub(crate) async fn volumes(api: &Api, command: VolumeCommand) -> Result { match command { - VolumeCommand::List(page) => api.list("/v1/volumes", "volumes", &page, true, &[]).await, + VolumeCommand::List(page) => api.list("/v1/volumes", "volumes", &page, &[]).await, VolumeCommand::Get { id } => api.get(&format!("/v1/volumes/{id}")).await, VolumeCommand::Delete { id } => delete(api, &format!("/v1/volumes/{id}")).await, VolumeCommand::Create { @@ -705,10 +704,7 @@ pub(crate) async fn volumes(api: &Api, command: VolumeCommand) -> Result pub(crate) async fn endpoints(api: &Api, command: EndpointCommand) -> Result { match command { - EndpointCommand::List(page) => { - api.list("/v1/ingresses", "ingresses", &page, true, &[]) - .await - } + EndpointCommand::List(page) => api.list("/v1/ingresses", "ingresses", &page, &[]).await, EndpointCommand::Get { id } => api.get(&format!("/v1/ingresses/{id}")).await, EndpointCommand::Create { name, @@ -903,31 +899,6 @@ pub(crate) async fn images(api: &Api, command: ImageCommand) -> Result { } } -async fn connections(api: &Api, command: ConnectionCommand) -> Result { - let root = "/v1/gateway/connections"; - match command { - ConnectionCommand::List(page) => api.list(root, "connections", &page, false, &[]).await, - ConnectionCommand::Get { id } => api.get(&format!("{root}/{id}")).await, - ConnectionCommand::Create(data) => api.post(root, &input::object(Some(&data.data))?).await, - ConnectionCommand::Update { id, data } => put(api, &format!("{root}/{id}"), input::object(Some(&data.data))?).await, - ConnectionCommand::Delete { id } => delete(api, &format!("{root}/{id}")).await, - ConnectionCommand::Refresh { id } => api.post(&format!("{root}/{id}/refresh"), &json!({})).await, - ConnectionCommand::Grant { id, data } => put(api, &format!("{root}/{id}/grants"), input::object(Some(&data.data))?).await, - ConnectionCommand::Oauth { id, no_browser } => { - let result = api.post(&format!("{root}/{id}/oauth"), &json!({})).await?; - let url = result["url"].as_str().context("Missing OAuth URL")?; - if !no_browser && let Err(error) = auth::open_browser(url) { eprintln!("{error}. Open the returned URL manually."); } - Ok(result) - }, - ConnectionCommand::OauthComplete { id, data } => api.post(&format!("{root}/{id}/oauth/complete"), &input::object(Some(&data.data))?).await, - ConnectionCommand::Calls { id, page } => api.list(&format!("{root}/{id}/calls"), "calls", &page, false, &[]).await, - ConnectionCommand::Principals => api.get("/v1/gateway/principals").await, - ConnectionCommand::Search { query, offset } => api.json(Method::GET, "/v1/gateway/search", None, &[("query".into(),query),("offset".into(),offset.to_string())], None).await, - ConnectionCommand::Describe { connection, tool } => api.post("/v1/gateway/describe", &json!({"connectionId":connection.to_string(),"tool":tool})).await, - ConnectionCommand::Call { connection, tool, arguments } => api.post("/v1/gateway/call", &json!({"connectionId":connection.to_string(),"tool":tool,"arguments":input::object(Some(&arguments))?})).await, - } -} - async fn keys(api: &Api, command: KeyCommand) -> Result { match command { KeyCommand::List { offset } => { diff --git a/tests/backend/mod.rs b/tests/backend/mod.rs index f976774..88c47ea 100644 --- a/tests/backend/mod.rs +++ b/tests/backend/mod.rs @@ -36,7 +36,6 @@ fn local_unsupported_operations_fail_before_config_credentials_or_bootstrap() { vec!["endpoints", "list"], vec!["env", "list"], vec!["registry", "list"], - vec!["connections", "list"], vec!["models", "list"], vec!["keys", "list"], vec!["sessions", "list"], diff --git a/tests/cli.rs b/tests/cli.rs index c61a222..aad7f3a 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -29,6 +29,7 @@ fn help_and_argument_validation() { assert!(help.contains("Usage: adapt")); assert!(help.contains("auth")); for args in [ + vec!["connections", "list"], vec!["sandbox", "create", "--cpu", "0"], vec!["sandbox", "create", "--image", "alpine", "--image-id", ID], vec!["exec", ID], @@ -219,25 +220,18 @@ fn named_commands_match_platform_resource_contracts() { format!("/v1/images/{ID}/pull"), Some(json!({"registryCredentialId":null})), ), - ( - vec![ - "connections", - "call", - ID, - "read_file", - "--arguments", - "{\"path\":\"a b\"}", - ], - "POST", - "/v1/gateway/call".into(), - Some(json!({"connectionId":ID,"tool":"read_file","arguments":{"path":"a b"}})), - ), ( vec!["sessions", "revoke", ID], "POST", "/v1/auth/sessions/revoke".into(), Some(json!({"id":ID})), ), + ( + vec!["mcp", "list"], + "GET", + "/v1/auth/mcp/connections".into(), + None, + ), ( vec!["mcp", "revoke", ID], "POST", diff --git a/tests/resource_prefixes/mod.rs b/tests/resource_prefixes/mod.rs index 8f21761..1793c44 100644 --- a/tests/resource_prefixes/mod.rs +++ b/tests/resource_prefixes/mod.rs @@ -93,12 +93,6 @@ fn resource_commands_and_linked_ids_send_prefixes_to_the_api() { "/v1/execs/abcdef01", None, ), - ( - vec!["connections", "describe", "abcdef01", "search"], - "POST", - "/v1/gateway/describe", - Some(json!({"connectionId":"abcdef01","tool":"search"})), - ), ] { let server = Server::start(vec![step(method, path.into(), body, json!({"id":ID}))]); let dir = tempfile::tempdir().unwrap();