Documentation
¶
Overview ¶
Package mcp provides a bridge between MCP (Model Context Protocol) servers and ZAP for high-performance tool calling.
This bridge auto-discovers MCP servers and exposes their capabilities via ZAP, providing 10-30x performance improvement over native MCP JSON-RPC.
Index ¶
- Constants
- type Bridge
- func (b *Bridge) AddServer(name, command string, args ...string) error
- func (b *Bridge) AddServerConfig(cfg ServerConfig) error
- func (b *Bridge) CallTool(ctx context.Context, toolID uint32, args map[string]interface{}) (interface{}, error)
- func (b *Bridge) CallToolByName(ctx context.Context, name string, args map[string]interface{}) (interface{}, error)
- func (b *Bridge) GetTools() []Tool
- func (b *Bridge) Stop()
- type MCPServer
- type ServerConfig
- type Tool
Constants ¶
View Source
const ( MsgTypeToolList uint16 = 100 // List available tools MsgTypeToolCall uint16 = 101 // Call a tool MsgTypeToolResult uint16 = 102 // Tool result // Field offsets FieldToolCount = 0 // uint32 - number of tools FieldToolID = 0 // uint32 - tool ID FieldToolName = 4 // 64 bytes - tool name FieldArgsLen = 68 // uint32 - arguments JSON length FieldArgs = 72 // bytes - arguments JSON FieldResultLen = 0 // uint32 - result length FieldResultData = 4 // bytes - result data )
Message types for MCP-ZAP bridge
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bridge ¶
type Bridge struct {
// contains filtered or unexported fields
}
Bridge manages multiple MCP servers and exposes them via ZAP
func (*Bridge) AddServerConfig ¶
func (b *Bridge) AddServerConfig(cfg ServerConfig) error
AddServerConfig adds a server from a config
func (*Bridge) CallTool ¶
func (b *Bridge) CallTool(ctx context.Context, toolID uint32, args map[string]interface{}) (interface{}, error)
CallTool calls a tool by ID
type MCPServer ¶
type MCPServer struct {
Name string
Command string
Args []string
Tools []Tool
// contains filtered or unexported fields
}
MCPServer represents a connection to an MCP server
Click to show internal directories.
Click to hide internal directories.