Documentation
¶
Index ¶
- type Client
- type Config
- type ConnectionInput
- type ConnectionStatus
- type ConnectionView
- type Manager
- func (m *Manager) CallTool(ctx context.Context, id, name string, args map[string]any) (*mcp.CallToolResult, error)
- func (m *Manager) Close(ctx context.Context) error
- func (m *Manager) Configure(config clientcfg.Connection, secret clientcfg.Secrets)
- func (m *Manager) Refresh(ctx context.Context, id string) ([]*mcp.Tool, error)
- func (m *Manager) Remove(id string)
- func (m *Manager) SetAccess(config clientcfg.Connection)
- func (m *Manager) Status(id string) ConnectionStatus
- func (m *Manager) Tools(id string) []*mcp.Tool
- type Repository
- type Service
- func (s *Service) Close(ctx context.Context) error
- func (s *Service) DeleteConnection(id string) error
- func (s *Service) ListConnections() []ConnectionView
- func (s *Service) Refresh(ctx context.Context, id string) ([]ToolView, error)
- func (s *Service) SaveConnection(input ConnectionInput) (ConnectionView, error)
- func (s *Service) SetConnectionEnabled(id string, enabled bool) error
- func (s *Service) SetToolAllowed(id, tool string, allowed bool) error
- func (s *Service) Tools(id string) ([]ToolView, error)
- type ToolView
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 持有 SDK 返回的连接对象。Close 会释放传输连接, 使用 stdio 时也会关闭子进程。
type ConnectionInput ¶ added in v1.7.0
type ConnectionInput struct {
clientcfg.ConnectionSettings
// nil 保留现有凭据;非 nil 整体替换,空对象显式清除凭据。
Credentials *clientcfg.Secrets `json:"credentials"`
}
type ConnectionStatus ¶ added in v1.7.0
type ConnectionView ¶ added in v1.7.0
type ConnectionView struct {
Config clientcfg.Connection `json:"config"`
EnvKeys []string `json:"env_keys"`
HasBearerToken bool `json:"has_bearer_token"`
Status ConnectionStatus `json:"status"`
}
type Manager ¶ added in v1.7.0
type Manager struct {
// contains filtered or unexported fields
}
Manager 按 server 隔离连接与请求。配置替换立即取消旧连接的请求,旧刷新结果不会回填新目录。
func NewManager ¶ added in v1.7.0
func NewManager() *Manager
func (*Manager) CallTool ¶ added in v1.7.0
func (m *Manager) CallTool(ctx context.Context, id, name string, args map[string]any) (*mcp.CallToolResult, error)
CallTool 在发送前重新核对当前配置与许可;新发现的工具默认不可调用。
func (*Manager) Configure ¶ added in v1.7.0
func (m *Manager) Configure(config clientcfg.Connection, secret clientcfg.Secrets)
Configure 接收后端私有快照,不接受前端直接传入的运行时连接对象。
func (*Manager) SetAccess ¶ added in v1.7.0
func (m *Manager) SetAccess(config clientcfg.Connection)
SetAccess 保留管理员已发现的工具列表,但撤销旧连接及其在途请求。
func (*Manager) Status ¶ added in v1.7.0
func (m *Manager) Status(id string) ConnectionStatus
type Repository ¶ added in v1.7.0
type Service ¶ added in v1.7.0
type Service struct {
// contains filtered or unexported fields
}
Service 编排持久授权和运行时连接;磁盘更新失败不会发布新外部配置。 网络请求在 client Manager 中执行,不占用配置锁或数据库事务。
func NewService ¶ added in v1.7.0
func NewService(store Repository, client *Manager) (*Service, error)
New 加载失败时仍返回停用的 Service,供应用展示错误并统一关闭;异常配置不会被覆盖。
func (*Service) DeleteConnection ¶ added in v1.7.0
func (*Service) ListConnections ¶ added in v1.7.0
func (s *Service) ListConnections() []ConnectionView
func (*Service) SaveConnection ¶ added in v1.7.0
func (s *Service) SaveConnection(input ConnectionInput) (ConnectionView, error)
func (*Service) SetConnectionEnabled ¶ added in v1.7.0
func (*Service) SetToolAllowed ¶ added in v1.7.0
Click to show internal directories.
Click to hide internal directories.