Documentation
¶
Index ¶
- Variables
- func BuildHTTPRequest(ctx context.Context, operation OperationDescriptor, input ToolInput, ...) (*http.Request, error)
- func BuildToolInputSchema(operation OperationDescriptor) map[string]any
- func CreateServer(ctx context.Context, cfg Config) (*mcp.Server, error)
- func CreateServerWithExtensions(ctx context.Context, cfg Config, extensions []ExtensionTool) (*mcp.Server, error)
- func DecodeExtensionInput(req *mcp.CallToolRequest, destination any) error
- func EmbeddedConfigForFile(configPath string) (string, error)
- func ExtensionError(message string) *mcp.CallToolResult
- func ExtensionJSONResponse(message string, result map[string]any) *mcp.CallToolResult
- func FilterCandidates(operation OperationDescriptor) []string
- func MatchesPattern(pattern, candidate string) bool
- func RunKeychainCommand(args []string, stdin *os.File, output io.Writer) error
- func RunStdio(ctx context.Context, cfg Config) error
- func RunStdioWithExtensions(ctx context.Context, cfg Config, extensions []ExtensionTool) error
- func ShouldExposeOperation(operation OperationDescriptor, filter ToolFilterConfig) bool
- type APIProfile
- type APIProfileRemoval
- type APIProfileStatus
- type APIResponse
- type ActionConfirmation
- type ActionConfirmer
- type AuthConfig
- type Config
- type ConfigInput
- type ConfigureToolsInput
- type CredentialPrompter
- type ExtensionBatchItem
- type ExtensionBatchRequest
- type ExtensionBatchResult
- type ExtensionRuntime
- func (r *ExtensionRuntime) ExecuteBatch(ctx context.Context, request ExtensionBatchRequest) ([]ExtensionBatchResult, error)
- func (r *ExtensionRuntime) ExecuteRead(ctx context.Context, profileID, operationName string, input ToolInput) (APIResponse, error)
- func (r *ExtensionRuntime) ResolveProfile(profileID string) (APIProfile, error)
- type ExtensionTool
- type HTTPDoer
- type KeychainConfig
- type KeychainStore
- type LookupEnv
- type OperationDescriptor
- type PaginationInfo
- type ParameterDescriptor
- type ProfileRegistry
- type ProfilesConfig
- type RequestBodyDescriptor
- type ResolvedAuthConfig
- type ResolvedProfilesConfig
- type ResolvedToolPolicyConfig
- type ToolEndpointStatus
- type ToolFeature
- type ToolFeatureCatalog
- type ToolFeatureStatus
- type ToolFilterConfig
- type ToolInput
- type ToolPolicyConfig
- type TruncationInfo
- type UserToolPolicy
Constants ¶
This section is empty.
Variables ¶
View Source
var ( DefaultVersion = "dev" EmbeddedConfigBase64 string )
View Source
var ( ErrKeychainItemNotFound = errors.New("keychain item not found") ErrKeychainUnsupported = errors.New("macOS Keychain is unavailable") )
View Source
var ErrActionConfirmationCanceled = errors.New("action confirmation was canceled")
View Source
var ErrCredentialSetupCanceled = errors.New("credential setup was canceled")
Functions ¶
func BuildHTTPRequest ¶
func BuildToolInputSchema ¶
func BuildToolInputSchema(operation OperationDescriptor) map[string]any
func DecodeExtensionInput ¶
func DecodeExtensionInput(req *mcp.CallToolRequest, destination any) error
func EmbeddedConfigForFile ¶
func ExtensionError ¶
func ExtensionError(message string) *mcp.CallToolResult
func ExtensionJSONResponse ¶
func ExtensionJSONResponse(message string, result map[string]any) *mcp.CallToolResult
func FilterCandidates ¶
func FilterCandidates(operation OperationDescriptor) []string
func MatchesPattern ¶
func RunKeychainCommand ¶
func RunStdioWithExtensions ¶
func RunStdioWithExtensions(ctx context.Context, cfg Config, extensions []ExtensionTool) error
func ShouldExposeOperation ¶
func ShouldExposeOperation(operation OperationDescriptor, filter ToolFilterConfig) bool
Types ¶
type APIProfile ¶
type APIProfileRemoval ¶
type APIProfileRemoval struct {
Profile APIProfile `json:"profile"`
CredentialDeleted bool `json:"credentialDeleted"`
ToolConfigurationDeleted bool `json:"toolConfigurationDeleted"`
Warnings []string `json:"warnings"`
}
type APIProfileStatus ¶
type APIProfileStatus struct {
ID string `json:"id"`
Name string `json:"name"`
CredentialAvailable bool `json:"credentialAvailable"`
CredentialStoredInKeychain bool `json:"credentialStoredInKeychain"`
ToolConfigPath string `json:"toolConfigPath"`
EnabledEndpointCount int `json:"enabledEndpointCount"`
}
type APIResponse ¶
type APIResponse struct {
Profile *APIProfile `json:"profile,omitempty"`
OK bool `json:"ok"`
Status int `json:"status"`
StatusText string `json:"statusText"`
Headers map[string]string `json:"headers"`
Body any `json:"body"`
Truncated bool `json:"truncated"`
Truncation *TruncationInfo `json:"truncation,omitempty"`
Pagination *PaginationInfo `json:"pagination,omitempty"`
}
func ExecuteOperation ¶
func ExecuteOperation(ctx context.Context, operation OperationDescriptor, input ToolInput, cfg Config, client HTTPDoer) (APIResponse, error)
type ActionConfirmation ¶
type ActionConfirmation struct {
ApplicationName string
Profile *APIProfile
Action string
Destination string
Details any
}
type ActionConfirmer ¶
type ActionConfirmer interface {
Confirm(context.Context, ActionConfirmation) error
}
type AuthConfig ¶
type AuthConfig struct {
Type string `json:"type,omitempty"`
Token string `json:"token,omitempty"`
TokenEnv string `json:"tokenEnv,omitempty"`
Username string `json:"username,omitempty"`
UsernameEnv string `json:"usernameEnv,omitempty"`
Password string `json:"password,omitempty"`
PasswordEnv string `json:"passwordEnv,omitempty"`
In string `json:"in,omitempty"`
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
ValueEnv string `json:"valueEnv,omitempty"`
Keychain *KeychainConfig `json:"keychain,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
type Config ¶
type Config struct {
Name string
Version string
Spec string
AllowRemoteSpec bool
AllowExternalRefs bool
ServerURL string
Auth ResolvedAuthConfig
Headers map[string]string
Tools ToolFilterConfig
ToolPolicy *ResolvedToolPolicyConfig
Profiles *ResolvedProfilesConfig
MaxResponseChars int
}
func LoadConfigFromArgs ¶
func LoadEmbeddedConfig ¶
func NormalizeConfig ¶
func NormalizeConfig(input ConfigInput, baseDir string, lookup LookupEnv) (Config, error)
type ConfigInput ¶
type ConfigInput struct {
Name string `json:"name,omitempty"`
Version string `json:"version,omitempty"`
Spec string `json:"spec"`
AllowRemoteSpec bool `json:"allowRemoteSpec,omitempty"`
AllowExternalRefs bool `json:"allowExternalRefs,omitempty"`
ServerURL string `json:"serverUrl,omitempty"`
Auth *AuthConfig `json:"auth,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
Tools ToolFilterConfig `json:"tools,omitempty"`
ToolPolicy *ToolPolicyConfig `json:"toolPolicy,omitempty"`
Profiles *ProfilesConfig `json:"profiles,omitempty"`
MaxResponseChars int `json:"maxResponseChars,omitempty"`
}
type ConfigureToolsInput ¶
type CredentialPrompter ¶
type ExtensionBatchItem ¶
type ExtensionBatchRequest ¶
type ExtensionBatchRequest struct {
Profile string `json:"profile,omitempty"`
Action string `json:"action"`
Details any `json:"details,omitempty"`
Items []ExtensionBatchItem `json:"items"`
StopOnError bool `json:"stopOnError"`
// AfterApprovalCheck revalidates workflow-owned preconditions after the
// native approval dialog and immediately before credential resolution.
// It must be read-only. This narrows, but cannot make atomic, the interval
// between an upstream state check and the first write.
AfterApprovalCheck func(context.Context) error `json:"-"`
}
type ExtensionBatchResult ¶
type ExtensionBatchResult struct {
ID string `json:"id"`
Operation string `json:"operation"`
Response *APIResponse `json:"response,omitempty"`
Error string `json:"error,omitempty"`
}
type ExtensionRuntime ¶
type ExtensionRuntime struct {
// contains filtered or unexported fields
}
func (*ExtensionRuntime) ExecuteBatch ¶
func (r *ExtensionRuntime) ExecuteBatch(ctx context.Context, request ExtensionBatchRequest) ([]ExtensionBatchResult, error)
func (*ExtensionRuntime) ExecuteRead ¶
func (r *ExtensionRuntime) ExecuteRead(ctx context.Context, profileID, operationName string, input ToolInput) (APIResponse, error)
func (*ExtensionRuntime) ResolveProfile ¶
func (r *ExtensionRuntime) ResolveProfile(profileID string) (APIProfile, error)
type ExtensionTool ¶
type ExtensionTool struct {
Tool *mcp.Tool
Handler func(context.Context, *ExtensionRuntime, *mcp.CallToolRequest) (*mcp.CallToolResult, error)
}
type KeychainConfig ¶
type KeychainStore ¶
type KeychainStore interface {
Get(KeychainConfig) ([]byte, error)
Set(KeychainConfig, []byte) error
Delete(KeychainConfig) error
}
type OperationDescriptor ¶
type OperationDescriptor struct {
ToolName string
Method string
Path string
ServerURL string
OperationID string
Title string
Description string
Tags []string
Parameters []ParameterDescriptor
RequestBody *RequestBodyDescriptor
}
func CollectOperations ¶
func CollectOperations(doc *openapi3.T, cfg Config) []OperationDescriptor
func LoadOperations ¶
func LoadOperations(ctx context.Context, cfg Config) ([]OperationDescriptor, error)
type PaginationInfo ¶
type ParameterDescriptor ¶
type ProfileRegistry ¶
type ProfileRegistry struct {
Version int `json:"version"`
Profiles []APIProfile `json:"profiles"`
}
type ProfilesConfig ¶
type RequestBodyDescriptor ¶
type ResolvedAuthConfig ¶
type ResolvedProfilesConfig ¶
type ToolEndpointStatus ¶
type ToolFeature ¶
type ToolFeatureCatalog ¶
type ToolFeatureCatalog struct {
Version int `json:"version"`
Features []ToolFeature `json:"features"`
}
type ToolFeatureStatus ¶
type ToolFilterConfig ¶
type ToolInput ¶
type ToolInput struct {
Profile string `json:"profile,omitempty"`
Path map[string]any `json:"path,omitempty"`
Query map[string]any `json:"query,omitempty"`
Headers map[string]any `json:"headers,omitempty"`
Cookies map[string]any `json:"cookies,omitempty"`
ContentType string `json:"contentType,omitempty"`
Body any `json:"body,omitempty"`
}
type ToolPolicyConfig ¶
type TruncationInfo ¶
Source Files
¶
- action_confirmation.go
- action_confirmation_unsupported.go
- config.go
- credential_manager.go
- credential_prompt.go
- credential_prompt_unsupported.go
- diagnostics.go
- extensions.go
- filter.go
- http.go
- input_validation.go
- keychain.go
- keychain_command.go
- keychain_unsupported.go
- openapi.go
- profile_tools.go
- profiles.go
- server.go
- tool_policy.go
- tool_policy_server.go
Click to show internal directories.
Click to hide internal directories.