Class: McpToolkit::Gateway::UpstreamRegistry::Upstream

Inherits:
Data
  • Object
show all
Defined in:
lib/mcp_toolkit/gateway/upstream_registry.rb

Overview

public_tool_list is the gateway-cache contract: an upstream's tools/list MUST be caller-INDEPENDENT (the same public tools for every valid token; scope is enforced only when a tool is CALLED). That invariant is what lets the Aggregator share one cache entry per upstream across all callers. An upstream that filters its list by the caller's privilege (e.g. hides superuser-only tools) breaks it and MUST register public_tool_list: false, which opts it out of the shared cache so a privileged caller's list can't leak to an unprivileged one. Default true — the overwhelming common case.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, url:, public_tool_list: true) ⇒ Upstream

Returns a new instance of Upstream.



32
33
34
# File 'lib/mcp_toolkit/gateway/upstream_registry.rb', line 32

def initialize(key:, url:, public_tool_list: true)
  super
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key

Returns:

  • (Object)

    the current value of key



31
32
33
# File 'lib/mcp_toolkit/gateway/upstream_registry.rb', line 31

def key
  @key
end

#public_tool_listObject (readonly)

Returns the value of attribute public_tool_list

Returns:

  • (Object)

    the current value of public_tool_list



31
32
33
# File 'lib/mcp_toolkit/gateway/upstream_registry.rb', line 31

def public_tool_list
  @public_tool_list
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



31
32
33
# File 'lib/mcp_toolkit/gateway/upstream_registry.rb', line 31

def url
  @url
end

Instance Method Details

#name_for(tool_name) ⇒ Object



36
37
38
# File 'lib/mcp_toolkit/gateway/upstream_registry.rb', line 36

def name_for(tool_name)
  "#{key}#{NAMESPACE_SEPARATOR}#{tool_name}"
end