mcp

package
v1.261203.3 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: MPL-2.0 Imports: 22 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

This section is empty.

Types

type Handler

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

Handler handles MCP configuration HTTP requests

func NewHandler

func NewHandler(cfg *config.Config, rt ...*mcpruntime.Runtime) *Handler

NewHandler creates a new MCP handler. rt is an optional shared Runtime; when provided (e.g. from the main server) it is reused so the transport handler sees already-connected sources and registered builtins. When nil (e.g. in openapi/CLI mode) a fresh runtime is created from config.

func (*Handler) CallTool added in v1.261026.0

func (h *Handler) CallTool(c *gin.Context)

func (*Handler) CheckSource added in v1.261026.0

func (h *Handler) CheckSource(c *gin.Context)

func (*Handler) CreateSource added in v1.261026.0

func (h *Handler) CreateSource(c *gin.Context)

func (*Handler) DeleteProfile added in v1.261026.0

func (h *Handler) DeleteProfile(c *gin.Context)

func (*Handler) DeleteSource added in v1.261026.0

func (h *Handler) DeleteSource(c *gin.Context)

func (*Handler) GetCatalog added in v1.261026.0

func (h *Handler) GetCatalog(c *gin.Context)

func (*Handler) GetLocalHandler added in v0.260414.2000

func (h *Handler) GetLocalHandler() *local.Handler

GetLocalHandler returns the local mode handler

func (*Handler) GetMCPRuntimeConfig

func (h *Handler) GetMCPRuntimeConfig(c *gin.Context)

GetMCPRuntimeConfig returns the global MCP runtime configuration

func (*Handler) GetRouting added in v1.261026.0

func (h *Handler) GetRouting(c *gin.Context)

func (*Handler) GetTransportHandler added in v0.260414.2000

func (h *Handler) GetTransportHandler() *local.TransportHandler

GetTransportHandler returns the transport handler for local mode

func (*Handler) GetWebToolSetup added in v1.261203.1

func (h *Handler) GetWebToolSetup(c *gin.Context)

GetWebToolSetup returns the Web Tool rows and key states.

func (*Handler) ListProfiles added in v1.261026.0

func (h *Handler) ListProfiles(c *gin.Context)

func (*Handler) PatchSource added in v1.261026.0

func (h *Handler) PatchSource(c *gin.Context)

func (*Handler) ProbeClient added in v1.261026.0

func (h *Handler) ProbeClient(c *gin.Context)

func (*Handler) ReconnectSource added in v1.261026.0

func (h *Handler) ReconnectSource(c *gin.Context)

func (*Handler) RegisterRoutes added in v1.261002.1

func (h *Handler) RegisterRoutes(rt *module.Routes)

func (*Handler) SaveProfile added in v1.261026.0

func (h *Handler) SaveProfile(c *gin.Context)

func (*Handler) SetMCPRuntimeConfig

func (h *Handler) SetMCPRuntimeConfig(c *gin.Context)

SetMCPRuntimeConfig sets the global MCP runtime configuration

func (*Handler) TestWebTool added in v1.261203.1

func (h *Handler) TestWebTool(c *gin.Context)

TestWebTool runs one real call with the candidate source/key, without saving.

func (*Handler) UpdateWebToolSetup added in v1.261203.1

func (h *Handler) UpdateWebToolSetup(c *gin.Context)

UpdateWebToolSetup sets the source per tool and the keys, shared by every rule.

type MCPCatalogResponse added in v1.261026.0

type MCPCatalogResponse struct {
	Success bool                      `json:"success"`
	Sources []mcpruntime.SourceStatus `json:"sources"`
	Error   string                    `json:"error,omitempty"`
}

type MCPClientProbeRequest added in v1.261026.0

type MCPClientProbeRequest struct {
	ToolName  string         `json:"tool_name,omitempty"`
	Arguments map[string]any `json:"arguments,omitempty"`
}

MCPClientProbeRequest traverses the production MCP HTTP endpoint. An empty tool name checks initialize + tools/list only; a named tool also performs call.

type MCPClientProbeResponse added in v1.261026.0

type MCPClientProbeResponse struct {
	Success       bool                 `json:"success"`
	Endpoint      string               `json:"endpoint"`
	Tools         []string             `json:"tools"`
	Result        *coretool.ToolResult `json:"result,omitempty"`
	ExecutionTime int64                `json:"execution_time"`
	Error         string               `json:"error,omitempty"`
}

type MCPProfilesResponse added in v1.261026.0

type MCPProfilesResponse struct {
	Success  bool             `json:"success"`
	Profiles []typ.MCPProfile `json:"profiles"`
	Error    string           `json:"error,omitempty"`
}

type MCPRoutingResponse added in v1.261026.0

type MCPRoutingResponse struct {
	Success bool                       `json:"success"`
	Routing mcpruntime.RoutingSnapshot `json:"routing"`
	Error   string                     `json:"error,omitempty"`
}

type MCPRuntimeConfigRequest

type MCPRuntimeConfigRequest struct {
	Sources               []typ.MCPSourceConfig `json:"sources,omitempty"`
	RequestTimeout        *int                  `json:"request_timeout,omitempty"`          // seconds, default: 30
	StripDisabledMCPTools *bool                 `json:"strip_disabled_mcp_tools,omitempty"` // dangerous: strip disabled MCP declarations/tool_calls
}

MCPRuntimeConfigRequest is the API request for setting MCP runtime config

type MCPRuntimeConfigResponse

type MCPRuntimeConfigResponse struct {
	Success bool                  `json:"success"`
	Config  *typ.MCPRuntimeConfig `json:"config,omitempty"`
	Error   string                `json:"error,omitempty"`
}

MCPRuntimeConfigResponse is the API response for MCP runtime config

type MCPSourceStatusResponse added in v1.261026.0

type MCPSourceStatusResponse struct {
	Success bool                    `json:"success"`
	Status  mcpruntime.SourceStatus `json:"status"`
	Error   string                  `json:"error,omitempty"`
}

type MCPToolCallRequest added in v1.261026.0

type MCPToolCallRequest struct {
	SourceID  string         `json:"source_id" binding:"required"`
	ToolName  string         `json:"tool_name" binding:"required"`
	Arguments map[string]any `json:"arguments,omitempty"`
}

type MCPToolCallResponse added in v1.261026.0

type MCPToolCallResponse struct {
	Success       bool                 `json:"success"`
	Result        *coretool.ToolResult `json:"result,omitempty"`
	ExecutionTime int64                `json:"execution_time"`
	Error         string               `json:"error,omitempty"`
}

type WebToolKey added in v1.261203.1

type WebToolKey struct {
	Set  bool   `json:"set"`
	Hint string `json:"hint,omitempty"`
}

WebToolKey describes a stored key without revealing it.

type WebToolSetup added in v1.261203.1

type WebToolSetup struct {
	Tools []WebToolStatus       `json:"tools"`
	Keys  map[string]WebToolKey `json:"keys"`
}

type WebToolSetupRequest added in v1.261203.1

type WebToolSetupRequest struct {
	Backends map[string]string `json:"backends,omitempty"`
	Keys     map[string]string `json:"keys,omitempty"`
}

WebToolSetupRequest updates sources and keys. Omitted entries are unchanged; an empty key removes it.

type WebToolSetupResponse added in v1.261203.1

type WebToolSetupResponse struct {
	Success bool          `json:"success"`
	Setup   *WebToolSetup `json:"setup,omitempty"`
	Error   string        `json:"error,omitempty"`
}

type WebToolStatus added in v1.261203.1

type WebToolStatus struct {
	Name     string   `json:"name"`
	Backend  string   `json:"backend"`
	Backends []string `json:"backends"`
	// State is ready | needs_key | invalid_backend (webtools.KeyState).
	State string `json:"state"`
}

WebToolStatus is one tool row.

type WebToolTestRequest added in v1.261203.1

type WebToolTestRequest struct {
	Tool    string `json:"tool"`
	Backend string `json:"backend,omitempty"`
	Key     string `json:"key,omitempty"`
}

WebToolTestRequest runs one real call with the given (possibly unsaved) source and key; empty fields fall back to the saved ones. Nothing is stored.

type WebToolTestResponse added in v1.261203.1

type WebToolTestResponse struct {
	Success   bool   `json:"success"`
	ElapsedMs int64  `json:"elapsed_ms"`
	Error     string `json:"error,omitempty"`
}

Jump to

Keyboard shortcuts

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