Documentation
¶
Index ¶
- Constants
- func BuildOAuthConfig(cmd *cobra.Command, connConfig *config.ConnectionConfig) (*oauth.Config, error)
- func ConformFailedError() error
- func SetGlobalConnection(conn *config.ConnectionConfig)
- func VerifyFailedError() error
- type BaseCommand
- func (c *BaseCommand) CloseClient() error
- func (c *BaseCommand) CreateClient(cmd *cobra.Command) error
- func (c *BaseCommand) GetOutputFormat() OutputFormat
- func (c *BaseCommand) GetService() mcp.Service
- func (c *BaseCommand) HandleError(err error, operation string) error
- func (c *BaseCommand) PostRunE(cmd *cobra.Command, args []string) error
- func (c *BaseCommand) PreRunE(cmd *cobra.Command, args []string) error
- func (c *BaseCommand) SetOutputFormat(cmd *cobra.Command) error
- func (c *BaseCommand) ValidateConnection() error
- func (c *BaseCommand) WithContext() (context.Context, context.CancelFunc)
- func (c *BaseCommand) WithTimeout(timeout time.Duration) *BaseCommand
- type CapabilitiesCommand
- type ConformCommand
- type OutputFormat
- type PromptCommand
- type ResourceCommand
- type ServerCommand
- type ToolCommand
- type VerifyCommand
Constants ¶
const ( FormatText = "text" FormatJSON = "json" )
Output format constants
const ( ConnectionCreating = "🔄 Creating MCP service...\n" ConnectionStarting = "🚀 Starting process: %s %s\n" ConnectionConnecting = "🌐 Connecting to URL: %s\n" ConnectionTimeout = "⏳ Establishing connection (timeout: %s)...\n" ConnectionSuccess = "✅ Connected successfully\n" ConnectionFailed = "❌ Connection failed\n" )
Connection message constants
Variables ¶
This section is empty.
Functions ¶
func BuildOAuthConfig ¶ added in v0.8.3
func BuildOAuthConfig(cmd *cobra.Command, connConfig *config.ConnectionConfig) (*oauth.Config, error)
BuildOAuthConfig translates --oauth-* flags into an *oauth.Config. Returns (nil, nil) when no OAuth flag was supplied. The function is shared by the CLI parseConnectionConfig path and the TUI launcher in main.go which processes the same persistent flags before handing the connection config to the screen manager.
func ConformFailedError ¶ added in v0.8.3
func ConformFailedError() error
ConformFailedError returns the sentinel for tests to assert via errors.Is without importing the unexported variable.
func SetGlobalConnection ¶
func SetGlobalConnection(conn *config.ConnectionConfig)
SetGlobalConnection sets the global connection config
func VerifyFailedError ¶ added in v0.8.3
func VerifyFailedError() error
VerifyFailedError returns the sentinel for tests that need to assert the non-zero exit path without importing the unexported variable.
Types ¶
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
BaseCommand provides common functionality for all CLI commands
func (*BaseCommand) CloseClient ¶
func (c *BaseCommand) CloseClient() error
CloseClient properly closes the MCP client
func (*BaseCommand) CreateClient ¶
func (c *BaseCommand) CreateClient(cmd *cobra.Command) error
CreateClient creates and initializes an MCP client
func (*BaseCommand) GetOutputFormat ¶
func (c *BaseCommand) GetOutputFormat() OutputFormat
GetOutputFormat returns the current output format
func (*BaseCommand) GetService ¶
func (c *BaseCommand) GetService() mcp.Service
GetService returns the MCP service
func (*BaseCommand) HandleError ¶
func (c *BaseCommand) HandleError(err error, operation string) error
HandleError provides consistent error handling across commands
func (*BaseCommand) PostRunE ¶
func (c *BaseCommand) PostRunE(cmd *cobra.Command, args []string) error
PostRunE is a common post-run function that cleans up the client
func (*BaseCommand) PreRunE ¶
func (c *BaseCommand) PreRunE(cmd *cobra.Command, args []string) error
PreRunE is a common pre-run function that sets up the client
func (*BaseCommand) SetOutputFormat ¶
func (c *BaseCommand) SetOutputFormat(cmd *cobra.Command) error
SetOutputFormat sets the output format for the command
func (*BaseCommand) ValidateConnection ¶
func (c *BaseCommand) ValidateConnection() error
ValidateConnection checks if the client is connected
func (*BaseCommand) WithContext ¶
func (c *BaseCommand) WithContext() (context.Context, context.CancelFunc)
WithContext creates a context with timeout for the command
func (*BaseCommand) WithTimeout ¶
func (c *BaseCommand) WithTimeout(timeout time.Duration) *BaseCommand
WithTimeout sets the command timeout
type CapabilitiesCommand ¶ added in v0.8.3
type CapabilitiesCommand struct {
BaseCommand
}
CapabilitiesCommand surfaces the negotiated MCP capabilities for the connected server plus the client capabilities mcp-tui sent during initialize. Output is JSON (the only format) so the command is scripting-friendly: pipe to jq, diff against a fixture, etc. There is no text variant — the rendered view lives in the TUI Capabilities tab (Ctrl+D).
func NewCapabilitiesCommand ¶ added in v0.8.3
func NewCapabilitiesCommand() *CapabilitiesCommand
NewCapabilitiesCommand creates a new capabilities command.
func (*CapabilitiesCommand) CreateCommand ¶ added in v0.8.3
func (c *CapabilitiesCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command. Connection flags are inherited from the persistent flags on the root command (see main.go).
func (*CapabilitiesCommand) RunE ¶ added in v0.8.3
func (c *CapabilitiesCommand) RunE(cmd *cobra.Command, args []string) error
RunE executes the capabilities command. Failure to retrieve the snapshot is treated as a hard error — if we got past PreRunE (which establishes the connection), the snapshot must be populated. Any nil here is a programming error in the service.
type ConformCommand ¶ added in v0.8.3
type ConformCommand struct {
BaseCommand
}
ConformCommand exposes the end-to-end conformance suite as a CLI subcommand. It runs every protocol scenario plus all verify probes, prints a per-scenario PASS/FAIL summary, and (with --report-junit) writes a JUnit XML report.
Usage:
mcp-tui conform <url> # run all scenarios + HTTP probes mcp-tui conform --cmd npx --args ... # run all scenarios against stdio mcp-tui conform --scenario tools.list <url> # run one scenario mcp-tui conform --report-junit out.xml <url> mcp-tui conform --sampling-stub "ok" --cmd npx --args "@mcp/server-everything,stdio"
func NewConformCommand ¶ added in v0.8.3
func NewConformCommand() *ConformCommand
NewConformCommand creates a new conform command.
func (*ConformCommand) CreateCommand ¶ added in v0.8.3
func (c *ConformCommand) CreateCommand() *cobra.Command
CreateCommand registers the cobra command. The conform command does NOT inherit BaseCommand.PreRunE — the runner drives its own connection so the CLI's persistent-session machinery would just spawn a duplicate.
func (*ConformCommand) RunE ¶ added in v0.8.3
func (c *ConformCommand) RunE(cmd *cobra.Command, args []string) error
RunE drives the conformance run end-to-end. The flow:
- Resolve target from positional/--url/--cmd flags.
- Build a conform.Runner with target options.
- Run scenarios (one or all).
- Print text summary.
- Optionally write JUnit XML.
- Return errConformFailed when any scenario failed (cobra exits 1).
type OutputFormat ¶
type OutputFormat string
OutputFormat represents supported output formats
const ( OutputFormatText OutputFormat = "text" OutputFormatJSON OutputFormat = "json" )
type PromptCommand ¶
type PromptCommand struct {
*BaseCommand
}
PromptCommand handles prompt-related CLI operations
func NewPromptCommand ¶
func NewPromptCommand() *PromptCommand
NewPromptCommand creates a new prompt command
func (*PromptCommand) CreateCommand ¶
func (pc *PromptCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command for prompts
type ResourceCommand ¶
type ResourceCommand struct {
*BaseCommand
}
ResourceCommand handles resource-related CLI operations
func NewResourceCommand ¶
func NewResourceCommand() *ResourceCommand
NewResourceCommand creates a new resource command
func (*ResourceCommand) CreateCommand ¶
func (rc *ResourceCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command for resources
type ServerCommand ¶
type ServerCommand struct {
BaseCommand
}
ServerCommand handles server information operations
func NewServerCommand ¶
func NewServerCommand() *ServerCommand
NewServerCommand creates a new server command
func (*ServerCommand) CreateCommand ¶
func (c *ServerCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command
type ToolCommand ¶
type ToolCommand struct {
*BaseCommand
}
ToolCommand handles tool-related CLI operations
func (*ToolCommand) CreateCommand ¶
func (tc *ToolCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command for tools
type VerifyCommand ¶ added in v0.8.3
type VerifyCommand struct {
BaseCommand
}
VerifyCommand exposes the behavior probes from internal/cli/verify as a CLI subcommand. Unlike the other CLI commands it does NOT establish a persistent MCP session in PreRunE — each probe drives its own short-lived connection so users can run a single probe against a URL without the SDK handshake overhead.
Usage:
mcp-tui verify <url> # run all HTTP probes mcp-tui verify --cmd npx --args ... # run all probes (incl. stdio) mcp-tui verify --probe cross-origin <url> mcp-tui verify --json <url> # machine-readable output
func NewVerifyCommand ¶ added in v0.8.3
func NewVerifyCommand() *VerifyCommand
NewVerifyCommand creates a new verify command.
func (*VerifyCommand) CreateCommand ¶ added in v0.8.3
func (c *VerifyCommand) CreateCommand() *cobra.Command
CreateCommand creates the cobra command. The verify command does NOT inherit BaseCommand.PreRunE — probes drive their own connections so we don't pay for a persistent SDK session every invocation.
func (*VerifyCommand) RunE ¶ added in v0.8.3
func (c *VerifyCommand) RunE(cmd *cobra.Command, args []string) error
RunE dispatches to the verify package. The flow:
- Resolve the target from --url / positional arg / --cmd flags.
- Filter the probe list by --probe (if set).
- Execute probes; collect ProbeResult slice.
- Format as JSON or human text.
- Exit 0 iff all passed (cobra returns nil → main exits 0; we set exit 1 by writing to os.Stderr and returning a sentinel error).
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conform implements the end-to-end MCP conformance suite.
|
Package conform implements the end-to-end MCP conformance suite. |
|
Package verify implements behavior probes for MCP servers introduced in SDK v1.4.0–v1.6.0.
|
Package verify implements behavior probes for MCP servers introduced in SDK v1.4.0–v1.6.0. |