proxy

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePrefixedURI

func ParsePrefixedURI(prefixed string) (server, uri string, err error)

ParsePrefixedURI splits a prefixed URI back into server and original URI.

func PrefixURI

func PrefixURI(server, uri string) string

PrefixURI returns a server-prefixed URI.

Types

type DescribeToolArgs

type DescribeToolArgs struct {
	Name string `json:"name"`
}

DescribeToolArgs is the input for the describe_tool meta-tool.

type ExecuteToolArgs

type ExecuteToolArgs struct {
	Name      string          `json:"name"`
	Arguments json.RawMessage `json:"arguments"`
	Timeout   int             `json:"timeout,omitempty"` // seconds
}

ExecuteToolArgs is the input for the execute_tool meta-tool.

type Prompt

type Prompt struct {
	Name        string          `json:"name"`
	Description string          `json:"description,omitempty"`
	Arguments   json.RawMessage `json:"arguments,omitempty"`
	ServerName  string          `json:"server_name"`
}

Prompt represents an MCP prompt from an upstream server.

type Resource

type Resource struct {
	URI         string `json:"uri"`
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	MimeType    string `json:"mimeType,omitempty"`
	ServerName  string `json:"server_name"`
}

Resource represents an MCP resource from an upstream server.

type SearchToolsArgs

type SearchToolsArgs struct {
	Query string `json:"query"`
	Limit int    `json:"limit,omitempty"`
}

SearchToolsArgs is the input for the search_tools meta-tool.

type Server

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

Server is the core MCP proxy that exposes 3 meta-tools.

func New

func New(cat *catalog.Catalog, searcher search.Searcher, tm *transport.Manager) *Server

New creates a new proxy server.

func (*Server) GetPrompt

func (s *Server) GetPrompt(ctx context.Context, prefixedName string) (json.RawMessage, error)

GetPrompt gets a prompt by its prefixed name.

func (*Server) HandleDescribeTool

func (s *Server) HandleDescribeTool(ctx context.Context, rawArgs json.RawMessage) (string, error)

HandleDescribeTool implements the describe_tool meta-tool.

func (*Server) HandleExecuteTool

func (s *Server) HandleExecuteTool(ctx context.Context, rawArgs json.RawMessage) (json.RawMessage, error)

HandleExecuteTool implements the execute_tool meta-tool.

func (*Server) HandleSearchTools

func (s *Server) HandleSearchTools(ctx context.Context, rawArgs json.RawMessage) (string, error)

HandleSearchTools implements the search_tools meta-tool.

func (*Server) Instructions

func (s *Server) Instructions() string

Instructions returns summarized instructions for the proxy. If server instructions are available, they are concatenated with headers. LLM summarization will be added when Gemini integration is complete.

func (*Server) ListPrompts

func (s *Server) ListPrompts(ctx context.Context) ([]Prompt, error)

ListPrompts returns all prompts aggregated from upstream servers.

func (*Server) ListResources

func (s *Server) ListResources(ctx context.Context) ([]Resource, error)

ListResources returns all resources aggregated from upstream servers. Currently returns empty since upstream connections don't support resource listing yet (pending MCP SDK integration).

func (*Server) ReadResource

func (s *Server) ReadResource(ctx context.Context, prefixedURI string) (json.RawMessage, error)

ReadResource reads a resource by its prefixed URI, routing to the correct upstream server.

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run starts the MCP server over stdio and blocks until the context is cancelled or the client disconnects.

func (*Server) RunWithTransport

func (s *Server) RunWithTransport(ctx context.Context, t mcp.Transport) error

RunWithTransport starts the MCP server using the given transport. This is useful for testing with in-memory transports.

Jump to

Keyboard shortcuts

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