aliases

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(name string, alias Alias) error

Add adds a user alias using the default store

func List

func List() map[string]Alias

List returns all aliases using the default store

func Remove

func Remove(name string) error

Remove removes a user alias using the default store

Types

type Alias

type Alias struct {
	URL            string             `json:"url"` // Git URL for local servers
	Description    string             `json:"description,omitempty"`
	Runtime        string             `json:"runtime,omitempty"`        // node, python, go, docker
	Transport      string             `json:"transport,omitempty"`      // stdio (default), http, sse
	MCPURL         string             `json:"mcpUrl,omitempty"`         // Remote MCP URL (for http/sse transport)
	OAuth          *OAuth             `json:"oauth,omitempty"`          // OAuth configuration if required
	Package        string             `json:"package,omitempty"`        // npm/pypi package name (e.g., "@figma/mcp-local")
	Variants       map[string]Variant `json:"variants,omitempty"`       // Available variants (local, remote)
	DefaultVariant string             `json:"defaultVariant,omitempty"` // Preferred variant (local or remote)
}

Alias maps a short name to an MCP server configuration

func Resolve

func Resolve(name string) (Alias, bool)

Resolve looks up an alias using the default store

func ResolveVariant

func ResolveVariant(name string, variantPref string) (Alias, string, bool)

ResolveVariant resolves an alias with a specific variant using the default store

func (*Alias) GetVariantNames

func (a *Alias) GetVariantNames() []string

GetVariantNames returns the names of available variants

func (*Alias) HasLocalVariant

func (a *Alias) HasLocalVariant() bool

HasLocalVariant checks if a local variant exists

func (*Alias) HasRemoteVariant

func (a *Alias) HasRemoteVariant() bool

HasRemoteVariant checks if a remote variant exists

func (*Alias) HasVariants

func (a *Alias) HasVariants() bool

HasVariants checks if an alias has multiple variants

type AliasInfo

type AliasInfo struct {
	Name        string
	Description string
	Runtime     string
	URL         string
}

AliasInfo contains alias info for display

func Search(query string) []AliasInfo

Search searches aliases using the default store

type OAuth

type OAuth struct {
	AuthURL     string   `json:"authUrl"`               // OAuth authorization endpoint
	TokenURL    string   `json:"tokenUrl"`              // OAuth token endpoint
	Scopes      []string `json:"scopes,omitempty"`      // Required OAuth scopes
	ClientID    string   `json:"clientId,omitempty"`    // Public client ID (if applicable)
	PKCEEnabled bool     `json:"pkceEnabled,omitempty"` // Use PKCE for security
}

OAuth represents OAuth configuration for remote MCP servers

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store manages alias lookups from bundled and user-defined sources

func Default

func Default() *Store

Default returns the default alias store

func NewStore

func NewStore(userDir string) *Store

NewStore creates a new alias store with optional user directory

func (*Store) Add

func (s *Store) Add(name string, alias Alias) error

Add adds or updates a user alias

func (*Store) IsBundled

func (s *Store) IsBundled(name string) bool

IsBundled checks if an alias is from the bundled set

func (*Store) IsUser

func (s *Store) IsUser(name string) bool

IsUser checks if an alias is user-defined

func (*Store) List

func (s *Store) List() map[string]Alias

List returns all aliases (bundled and user)

func (*Store) ListBundled

func (s *Store) ListBundled() map[string]Alias

ListBundled returns only bundled aliases

func (*Store) ListUser

func (s *Store) ListUser() map[string]Alias

ListUser returns only user-defined aliases

func (*Store) Remove

func (s *Store) Remove(name string) error

Remove removes a user alias

func (*Store) Resolve

func (s *Store) Resolve(name string) (Alias, bool)

Resolve looks up an alias by name, checking user aliases first then bundled

func (*Store) ResolveVariant

func (s *Store) ResolveVariant(name string, variantPref string) (Alias, string, bool)

ResolveVariant resolves an alias with a specific variant preference variantPref can be "local", "remote", or empty (use default)

func (*Store) Search

func (s *Store) Search(query string) []AliasInfo

Search searches for aliases matching the query

type Variant

type Variant struct {
	Transport string `json:"transport,omitempty"` // stdio, http, sse
	Package   string `json:"package,omitempty"`   // npm/pypi package name
	MCPURL    string `json:"mcpUrl,omitempty"`    // Remote MCP URL
	Runtime   string `json:"runtime,omitempty"`   // node, python, etc.
}

Variant represents a specific distribution variant of an MCP server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL