Class: Anthropic::Resources::Beta::Tunnels

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/tunnels.rb,
lib/anthropic/resources/beta/tunnels/certificates.rb,
sig/anthropic/resources/beta/tunnels.rbs,
sig/anthropic/resources/beta/tunnels/certificates.rbs

Defined Under Namespace

Classes: Certificates

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tunnels

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Tunnels.

Parameters:



245
246
247
248
# File 'lib/anthropic/resources/beta/tunnels.rb', line 245

def initialize(client:)
  @client = client
  @certificates = Anthropic::Resources::Beta::Tunnels::Certificates.new(client: client)
end

Instance Attribute Details

#certificatesAnthropic::Resources::Beta::Tunnels::Certificates (readonly)



8
9
10
# File 'lib/anthropic/resources/beta/tunnels.rb', line 8

def certificates
  @certificates
end

Instance Method Details

#archive(tunnel_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel

The Tunnels API is in research preview. It requires the anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a deprecation period. It supersedes the Admin API endpoints at /v1/organizations/tunnels, which remain available during a migration window.

Archives a tunnel. Archival is irreversible: every non-archived certificate on the tunnel is archived in the same operation, the hostname is retired and never re-allocated, and the tunnel token is invalidated. Retrying against an already-archived tunnel returns the existing record unchanged.

Some parameter documentations has been truncated, see Models::Beta::TunnelArchiveParams for more details.

Parameters:

  • tunnel_id (String)

    Path parameter tunnel_id

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



154
155
156
157
158
159
160
161
162
163
# File 'lib/anthropic/resources/beta/tunnels.rb', line 154

def archive(tunnel_id, params = {})
  parsed, options = Anthropic::Beta::TunnelArchiveParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/tunnels/%1$s/archive?beta=true", tunnel_id],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaTunnel,
    options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **options}
  )
end

#create(display_name: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel

The Tunnels API is in research preview. It requires the anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a deprecation period. It supersedes the Admin API endpoints at /v1/organizations/tunnels, which remain available during a migration window.

Creates a tunnel. Creation allocates a fresh hostname and provisions the tunnel; it is not idempotent. The new tunnel rejects MCP traffic until at least one CA certificate is added.

Some parameter documentations has been truncated, see Models::Beta::TunnelCreateParams for more details.

Parameters:

  • display_name (String, nil)

    Body param: Optional human-readable name for the tunnel (1-255 characters).

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/anthropic/resources/beta/tunnels.rb', line 35

def create(params = {})
  parsed, options = Anthropic::Beta::TunnelCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    method: :post,
    path: "v1/tunnels?beta=true",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaTunnel,
    options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **options}
  )
end

#list(include_archived: nil, limit: nil, page: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaTunnel>

The Tunnels API is in research preview. It requires the anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a deprecation period. It supersedes the Admin API endpoints at /v1/organizations/tunnels, which remain available during a migration window.

Lists tunnels. Results are ordered by creation time, newest first; archived tunnels are excluded unless include_archived is set.

Some parameter documentations has been truncated, see Models::Beta::TunnelListParams for more details.

Parameters:

  • include_archived (Boolean)

    Query param: Whether to include archived tunnels in the results. Defaults to fal

  • limit (Integer)

    Query param: Maximum number of tunnels to return per page. Defaults to 20, maxim

  • page (String)

    Query param: Opaque pagination cursor from a previous list_tunnels response.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/anthropic/resources/beta/tunnels.rb', line 110

def list(params = {})
  query_params = [:include_archived, :limit, :page]
  parsed, options = Anthropic::Beta::TunnelListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/tunnels?beta=true",
    query: query,
    headers: parsed.except(*query_params).transform_keys(
      betas: "anthropic-beta",
      workspace_id: "anthropic-workspace-id"
    ),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::BetaTunnel,
    options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **options}
  )
end

#retrieve(tunnel_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnel

The Tunnels API is in research preview. It requires the anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a deprecation period. It supersedes the Admin API endpoints at /v1/organizations/tunnels, which remain available during a migration window.

Fetches a tunnel by ID.

Some parameter documentations has been truncated, see Models::Beta::TunnelRetrieveParams for more details.

Parameters:

  • tunnel_id (String)

    Path parameter tunnel_id

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



71
72
73
74
75
76
77
78
79
80
# File 'lib/anthropic/resources/beta/tunnels.rb', line 71

def retrieve(tunnel_id, params = {})
  parsed, options = Anthropic::Beta::TunnelRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/tunnels/%1$s?beta=true", tunnel_id],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaTunnel,
    options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **options}
  )
end

#reveal_token(tunnel_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnelToken

The Tunnels API is in research preview. It requires the anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a deprecation period. It supersedes the Admin API endpoints at /v1/organizations/tunnels, which remain available during a migration window.

Reveals a tunnel's connector token. The value is fetched live on each call; Anthropic does not store it. Repeated calls return the same value until the token is rotated. Exposed as POST so the token does not appear in intermediary access logs.

Some parameter documentations has been truncated, see Models::Beta::TunnelRevealTokenParams for more details.

Parameters:

  • tunnel_id (String)

    Path parameter tunnel_id

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



191
192
193
194
195
196
197
198
199
200
# File 'lib/anthropic/resources/beta/tunnels.rb', line 191

def reveal_token(tunnel_id, params = {})
  parsed, options = Anthropic::Beta::TunnelRevealTokenParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/tunnels/%1$s/reveal_token?beta=true", tunnel_id],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaTunnelToken,
    options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **options}
  )
end

#rotate_token(tunnel_id, reason: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaTunnelToken

The Tunnels API is in research preview. It requires the anthropic-beta: mcp-tunnels-2026-06-22 header and may change without a deprecation period. It supersedes the Admin API endpoints at /v1/organizations/tunnels, which remain available during a migration window.

Rotates a tunnel's connector token. Rotation invalidates the current token for new connections and returns a fresh value; established connections are not severed. A connector restarted after rotation must use the new value.

Some parameter documentations has been truncated, see Models::Beta::TunnelRotateTokenParams for more details.

Parameters:

  • tunnel_id (String)

    Path param: Path parameter tunnel_id

  • reason (String, nil)

    Body param: Optional free-text reason for the rotation, recorded for audit.

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/anthropic/resources/beta/tunnels.rb', line 229

def rotate_token(tunnel_id, params = {})
  parsed, options = Anthropic::Beta::TunnelRotateTokenParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    method: :post,
    path: ["v1/tunnels/%1$s/rotate_token?beta=true", tunnel_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaTunnelToken,
    options: {extra_headers: {"anthropic-beta" => "mcp-tunnels-2026-06-22"}, **options}
  )
end