OpenCode.Generated.Mcp (opencode_sdk v0.1.64)

Copy Markdown View Source

Provides API endpoints related to mcp

Summary

Types

mcp_auth_remove_200_json_resp()

@type mcp_auth_remove_200_json_resp() :: %{success: true}

mcp_auth_start_200_json_resp()

@type mcp_auth_start_200_json_resp() :: %{
  authorization_url: String.t(),
  oauth_state: String.t()
}

Functions

mcp_add(body, opts \\ [])

@spec mcp_add(body :: map(), opts :: keyword()) ::
  {:ok, map()} | {:error, OpenCode.Generated.BadRequestError.t()}

Add MCP server

Dynamically add a new Model Context Protocol (MCP) server to the system.

Options

  • directory
  • workspace

Request Body

Content Types: application/json

mcp_auth_authenticate(name, opts \\ [])

Authenticate MCP OAuth

Start OAuth flow and wait for callback (opens browser).

Options

  • directory
  • workspace

mcp_auth_callback(name, body, opts \\ [])

Complete MCP OAuth

Complete OAuth authentication for a Model Context Protocol (MCP) server using the authorization code.

Options

  • directory
  • workspace

Request Body

Content Types: application/json

mcp_auth_remove(name, opts \\ [])

@spec mcp_auth_remove(name :: String.t(), opts :: keyword()) ::
  {:ok, mcp_auth_remove_200_json_resp()}
  | {:error, OpenCode.Generated.NotFoundError.t()}

Remove MCP OAuth

Remove OAuth credentials for an MCP server.

Options

  • directory
  • workspace

mcp_auth_start(name, opts \\ [])

Start MCP OAuth

Start OAuth authentication flow for a Model Context Protocol (MCP) server.

Options

  • directory
  • workspace

mcp_connect(name, opts \\ [])

@spec mcp_connect(name :: String.t(), opts :: keyword()) :: {:ok, boolean()} | :error

post /mcp/{name}/connect

Connect an MCP server.

Options

  • directory
  • workspace

mcp_disconnect(name, opts \\ [])

@spec mcp_disconnect(name :: String.t(), opts :: keyword()) ::
  {:ok, boolean()} | :error

post /mcp/{name}/disconnect

Disconnect an MCP server.

Options

  • directory
  • workspace

mcp_status(opts \\ [])

@spec mcp_status(opts :: keyword()) :: {:ok, map()} | :error

Get MCP status

Get the status of all Model Context Protocol (MCP) servers.

Options

  • directory
  • workspace