Class: Riffer::Mcp::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/riffer/mcp/manifest.rb,
sig/generated/riffer/mcp/manifest.rbs

Overview

Holds the configuration for a single MCP server.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, endpoint:, tags: nil, discovery_headers: nil, credentials_scope: nil) ⇒ Manifest

Raises Riffer::ArgumentError unless name is present and endpoint is a valid HTTPS URL.

: (name: String, endpoint: String, ?tags: Array?, ?discovery_headers: (Hash[String, untyped] | ::Proc)?, ?credentials_scope: (String | Symbol)?) -> void

Parameters:

  • name: (String)
  • endpoint: (String)
  • tags: (Array[untyped], nil) (defaults to: nil)
  • discovery_headers: (Hash[String, untyped], ::Proc, nil) (defaults to: nil)
  • credentials_scope: (String, Symbol, nil) (defaults to: nil)


28
29
30
31
32
33
34
35
36
37
38
# File 'lib/riffer/mcp/manifest.rb', line 28

def initialize(name:, endpoint:, tags: nil, discovery_headers: nil, credentials_scope: nil)
  @name = name.to_s.strip
  raise Riffer::ArgumentError, "MCP manifest name is required" if @name.empty?

  @endpoint = endpoint.to_s.strip
  raise Riffer::ArgumentError, "MCP manifest endpoint must be a valid HTTPS URL" unless valid_endpoint?

  @tags = Array(tags).map(&:to_sym)
  @discovery_headers = discovery_headers
  @credentials_scope = credentials_scope&.to_sym
end

Instance Attribute Details

#credentials_scopeSymbol? (readonly)

Optional hint (+:global+/+:tenant+/+:user+) for whether invocation credentials depend on tenant/user keys in context.

Returns:

  • (Symbol, nil)


22
23
24
# File 'lib/riffer/mcp/manifest.rb', line 22

def credentials_scope
  @credentials_scope
end

#discovery_headersHash[String, untyped], ... (readonly)

Headers (or a Proc) resolved once when building the discovery client.

Returns:

  • (Hash[String, untyped], ::Proc, nil)


18
19
20
# File 'lib/riffer/mcp/manifest.rb', line 18

def discovery_headers
  @discovery_headers
end

#endpointString (readonly)

HTTPS URL passed to the MCP transport.

Returns:

  • (String)


15
16
17
# File 'lib/riffer/mcp/manifest.rb', line 15

def endpoint
  @endpoint
end

#nameString (readonly)

Identifier used as the registration key and generated-agent identifier.

Returns:

  • (String)


9
10
11
# File 'lib/riffer/mcp/manifest.rb', line 9

def name
  @name
end

#tagsArray[Symbol] (readonly)

Tags for matching use_mcp.

Returns:

  • (Array[Symbol])


12
13
14
# File 'lib/riffer/mcp/manifest.rb', line 12

def tags
  @tags
end

Instance Method Details

#valid_endpoint?Boolean

Returns:

  • (Boolean)


42
43
44
45
46
47
# File 'lib/riffer/mcp/manifest.rb', line 42

def valid_endpoint?
  uri = URI.parse(@endpoint)
  uri.is_a?(URI::HTTPS) && uri.host
rescue URI::InvalidURIError
  false
end