Module: Relay::Models::MCP::Preset
Overview
The Preset module defines the preset catalog and compilation rules for Relay MCP servers.
Constant Summary collapse
- PRESETS =
{ "github" => { id: "github", title: "GitHub", summary: "Connect GitHub with a single token.", transport: "http", data: {"preset" => "github", "url" => "https://api.githubcopilot.com/mcp/", "headers" => {}}, description: "Uses GitHub's hosted MCP endpoint with a Bearer token." }, "forgejo" => { id: "forgejo", title: "Forgejo", summary: "Connect a Forgejo instance with URL and token.", transport: "stdio", data: {"preset" => "forgejo", "argv" => ["forgejo-mcp"], "cwd" => "", "env" => {}}, description: "Requires Forgejo support to be installed on this Relay host." } }.freeze
Instance Method Summary collapse
-
#[](id) ⇒ Hash?
Returns the preset definition for the given id.
-
#all ⇒ Array<Hash>
Returns all visible MCP presets.
-
#attributes_for(form) ⇒ Hash
The persisted MCP model attributes for the preset.
Instance Method Details
#[](id) ⇒ Hash?
Returns the preset definition for the given id
41 42 43 |
# File 'app/models/mcp/preset.rb', line 41 def [](id) PRESETS[id.to_s] end |
#all ⇒ Array<Hash>
Returns all visible MCP presets
32 33 34 |
# File 'app/models/mcp/preset.rb', line 32 def all PRESETS.values end |
#attributes_for(form) ⇒ Hash
Returns The persisted MCP model attributes for the preset.
50 51 52 53 54 55 56 57 58 |
# File 'app/models/mcp/preset.rb', line 50 def attributes_for(form) preset = self[form.preset] { name: preset[:title], description: "", transport: preset[:transport], data: preset[:data].merge(form.data) } end |