Documentation
¶
Overview ¶
Package mcpclient provides an MCP client wrapper for CLI commands.
Index ¶
- Constants
- type Client
- func (c *Client) CallTool(ctx context.Context, name string, args map[string]interface{}) (*mcp.CallToolResult, error)
- func (c *Client) CallToolJSON(ctx context.Context, name string, args map[string]interface{}, ...) error
- func (c *Client) CallToolText(ctx context.Context, name string, args map[string]interface{}) (string, error)
- func (c *Client) Close() error
- func (c *Client) CrawlCreate(ctx context.Context, opts CrawlCreateOpts) (*protocol.CrawlCreateResponse, error)
- func (c *Client) CrawlGet(ctx context.Context, flowID string) (*protocol.CrawlGetResponse, error)
- func (c *Client) CrawlPoll(ctx context.Context, sessionID string, opts CrawlPollOpts) (*protocol.CrawlPollResponse, error)
- func (c *Client) CrawlSeed(ctx context.Context, sessionID string, seedURLs, seedFlows string) (*protocol.CrawlSeedResponse, error)
- func (c *Client) CrawlSessions(ctx context.Context, limit int) (*protocol.CrawlSessionsResponse, error)
- func (c *Client) CrawlStatus(ctx context.Context, sessionID string) (*protocol.CrawlStatusResponse, error)
- func (c *Client) CrawlStop(ctx context.Context, sessionID string) error
- func (c *Client) OastCreate(ctx context.Context, label string) (*protocol.OastCreateResponse, error)
- func (c *Client) OastDelete(ctx context.Context, oastID string) error
- func (c *Client) OastGet(ctx context.Context, oastID, eventID string) (*protocol.OastGetResponse, error)
- func (c *Client) OastList(ctx context.Context, limit int) (*protocol.OastListResponse, error)
- func (c *Client) OastPoll(ctx context.Context, oastID string, opts OastPollOpts) (*protocol.OastPollResponse, error)
- func (c *Client) ProxyGet(ctx context.Context, flowID string) (*protocol.ProxyGetResponse, error)
- func (c *Client) ProxyPoll(ctx context.Context, opts ProxyPollOpts) (*protocol.ProxyPollResponse, error)
- func (c *Client) ProxyRuleAdd(ctx context.Context, opts RuleAddOpts) (*protocol.RuleEntry, error)
- func (c *Client) ProxyRuleDelete(ctx context.Context, ruleID string) error
- func (c *Client) ProxyRuleList(ctx context.Context, typeFilter string, limit int) (*protocol.RuleListResponse, error)
- func (c *Client) ProxyRuleUpdate(ctx context.Context, ruleID string, opts RuleUpdateOpts) (*protocol.RuleEntry, error)
- func (c *Client) ReplayGet(ctx context.Context, replayID string) (*protocol.ReplayGetResponse, error)
- func (c *Client) ReplaySend(ctx context.Context, opts ReplaySendOpts) (*protocol.ReplaySendResponse, error)
- func (c *Client) RequestSend(ctx context.Context, opts RequestSendOpts) (*protocol.ReplaySendResponse, error)
- type CrawlCreateOpts
- type CrawlPollOpts
- type OastPollOpts
- type ProxyPollOpts
- type ReplaySendOpts
- type RequestSendOpts
- type RuleAddOpts
- type RuleUpdateOpts
Constants ¶
const ( DefaultMCPURL = "http://127.0.0.1:9119/mcp" ClientTimeout = 25 * time.Minute // exceeds 20m long-poll max )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the MCP client for CLI usage.
func New ¶
New creates a new MCP client and connects to the server. It automatically calls the workflow tool with "cli" task if available.
func (*Client) CallTool ¶
func (c *Client) CallTool(ctx context.Context, name string, args map[string]interface{}) (*mcp.CallToolResult, error)
CallTool calls an MCP tool and returns the raw result.
func (*Client) CallToolJSON ¶
func (c *Client) CallToolJSON(ctx context.Context, name string, args map[string]interface{}, dest interface{}) error
CallToolJSON calls an MCP tool and unmarshals the JSON result into dest.
func (*Client) CallToolText ¶
func (c *Client) CallToolText(ctx context.Context, name string, args map[string]interface{}) (string, error)
CallToolText calls an MCP tool and returns the text result.
func (*Client) CrawlCreate ¶
func (c *Client) CrawlCreate(ctx context.Context, opts CrawlCreateOpts) (*protocol.CrawlCreateResponse, error)
CrawlCreate calls crawl_create and returns the session.
func (*Client) CrawlPoll ¶
func (c *Client) CrawlPoll(ctx context.Context, sessionID string, opts CrawlPollOpts) (*protocol.CrawlPollResponse, error)
CrawlPoll calls crawl_poll and returns summary, flows, forms, or errors.
func (*Client) CrawlSeed ¶
func (c *Client) CrawlSeed(ctx context.Context, sessionID string, seedURLs, seedFlows string) (*protocol.CrawlSeedResponse, error)
CrawlSeed calls crawl_seed to add seeds to a session.
func (*Client) CrawlSessions ¶
func (c *Client) CrawlSessions(ctx context.Context, limit int) (*protocol.CrawlSessionsResponse, error)
CrawlSessions calls crawl_sessions and returns all sessions.
func (*Client) CrawlStatus ¶
func (c *Client) CrawlStatus(ctx context.Context, sessionID string) (*protocol.CrawlStatusResponse, error)
CrawlStatus calls crawl_status and returns session status.
func (*Client) OastCreate ¶
func (c *Client) OastCreate(ctx context.Context, label string) (*protocol.OastCreateResponse, error)
OastCreate calls oast_create and returns the session.
func (*Client) OastDelete ¶
OastDelete calls oast_delete.
func (*Client) OastGet ¶
func (c *Client) OastGet(ctx context.Context, oastID, eventID string) (*protocol.OastGetResponse, error)
OastGet calls oast_get and returns full event data.
func (*Client) OastPoll ¶
func (c *Client) OastPoll(ctx context.Context, oastID string, opts OastPollOpts) (*protocol.OastPollResponse, error)
OastPoll calls oast_poll and returns summary or list of events.
func (*Client) ProxyPoll ¶
func (c *Client) ProxyPoll(ctx context.Context, opts ProxyPollOpts) (*protocol.ProxyPollResponse, error)
ProxyPoll calls proxy_poll and returns summary or list of flows.
func (*Client) ProxyRuleAdd ¶
ProxyRuleAdd calls proxy_rule_add and returns the created rule.
func (*Client) ProxyRuleDelete ¶
ProxyRuleDelete calls proxy_rule_delete.
func (*Client) ProxyRuleList ¶
func (c *Client) ProxyRuleList(ctx context.Context, typeFilter string, limit int) (*protocol.RuleListResponse, error)
ProxyRuleList calls proxy_rule_list and returns rules.
func (*Client) ProxyRuleUpdate ¶
func (c *Client) ProxyRuleUpdate(ctx context.Context, ruleID string, opts RuleUpdateOpts) (*protocol.RuleEntry, error)
ProxyRuleUpdate calls proxy_rule_update and returns the updated rule.
func (*Client) ReplayGet ¶
func (c *Client) ReplayGet(ctx context.Context, replayID string) (*protocol.ReplayGetResponse, error)
ReplayGet calls replay_get and returns full response data.
func (*Client) ReplaySend ¶
func (c *Client) ReplaySend(ctx context.Context, opts ReplaySendOpts) (*protocol.ReplaySendResponse, error)
ReplaySend calls replay_send and returns the result.
func (*Client) RequestSend ¶
func (c *Client) RequestSend(ctx context.Context, opts RequestSendOpts) (*protocol.ReplaySendResponse, error)
RequestSend calls request_send and returns the result.
type CrawlCreateOpts ¶
type CrawlCreateOpts struct {
Label string
SeedURLs string
SeedFlows string
Domains string
Headers map[string]string
MaxDepth int
MaxRequests int
Delay string
Parallelism int
SubmitForms bool
IgnoreRobots bool
}
CrawlCreateOpts are options for CrawlCreate.
type CrawlPollOpts ¶
type CrawlPollOpts struct {
OutputMode string // "summary", "flows", "forms", "errors"
Host string
Path string
Method string
Status string
Contains string
ContainsBody string
ExcludeHost string
ExcludePath string
Since string // flows mode
Limit int
Offset int
}
CrawlPollOpts are options for CrawlPoll.
type OastPollOpts ¶
type OastPollOpts struct {
OutputMode string // "summary" or "events"
Since string
EventType string
Wait string
Limit int
}
OastPollOpts are options for OastPoll.
type ProxyPollOpts ¶
type ProxyPollOpts struct {
OutputMode string // "summary" or "flows"
Source string // "proxy", "replay", or empty for both
Host string
Path string
Method string
Status string
Contains string
ContainsBody string
Since string // list mode
ExcludeHost string
ExcludePath string
Limit int // list mode
Offset int // list mode
}
ProxyPollOpts are options for ProxyPoll.
type ReplaySendOpts ¶
type ReplaySendOpts struct {
FlowID string
Method string
Body string
Target string
AddHeaders []string
RemoveHeaders []string
Path string
Query string
SetQuery []string
RemoveQuery []string
SetJSON map[string]interface{}
RemoveJSON []string
FollowRedirects bool
Force bool
}
ReplaySendOpts are options for ReplaySend.
type RequestSendOpts ¶
type RequestSendOpts struct {
URL string
Method string
Headers map[string]string
Body string
FollowRedirects bool
}
RequestSendOpts are options for RequestSend.
type RuleAddOpts ¶
RuleAddOpts are options for ProxyRuleAdd.