Documentation
¶
Index ¶
- Variables
- func AddPermissionsToContext(ctx context.Context, options *types.TheHiveMcpDefaultOptions) (context.Context, error)
- func AddTheHiveClientToContext(ctx context.Context) (context.Context, error)
- func AddTheHiveClientToContextWithCreds(ctx context.Context, creds *TheHiveCredentials) (context.Context, error)
- func AuthMiddleware(creds *TheHiveCredentials, permissionsConfigPath string) server.ToolHandlerMiddleware
- func CreateTheHiveClient(creds *TheHiveCredentials) (*thehive.APIClient, error)
- func CreateTheHiveConfig(creds *TheHiveCredentials) (*thehive.Configuration, error)
- func ExtractBearerToken(authHeader string) string
- func GetHTTPAuthContextFunc(options *types.TheHiveMcpDefaultOptions) func(ctx context.Context, r *http.Request) context.Context
- func GetInprocessServer(creds *TheHiveCredentials, permissionsConfigPath string) *server.MCPServer
- func GetMCPServer() *server.MCPServer
- func GetMCPServerAndRegisterTools() *server.MCPServer
- func LoadPermissions(configPath string) (*permissions.Config, error)
- func RegisterToolsToMCPServer(mcpServer *server.MCPServer)
- func SafeGetEnv(key, defaultValue string) string
- func StartHTTPServer(s *server.MCPServer, options *types.TheHiveMcpDefaultOptions) error
- func StartStdioServer(s *server.MCPServer, options *types.TheHiveMcpDefaultOptions) error
- type TheHiveCredentials
Constants ¶
This section is empty.
Variables ¶
var ( ErrMissingHiveURL = errors.New("THEHIVE_URL environment variable is required") ErrInvalidHiveURL = errors.New("invalid TheHive URL format") ErrMissingAuthentication = errors.New("either API key or username/password must be provided") ErrInvalidAPIKey = errors.New("API key cannot be empty or 'dummy'") ErrMissingCredentials = errors.New("both username and password are required for basic auth") )
Common errors
Functions ¶
func AddPermissionsToContext ¶
func AddPermissionsToContext(ctx context.Context, options *types.TheHiveMcpDefaultOptions) (context.Context, error)
AddPermissionsToContext loads permissions and adds them to the context
func AddTheHiveClientToContext ¶
AddTheHiveClientToContext adds a TheHive client to the context using environment variables
func AddTheHiveClientToContextWithCreds ¶
func AddTheHiveClientToContextWithCreds(ctx context.Context, creds *TheHiveCredentials) (context.Context, error)
AddTheHiveClientToContextWithCreds adds a TheHive client to the context using provided credentials
func AuthMiddleware ¶
func AuthMiddleware(creds *TheHiveCredentials, permissionsConfigPath string) server.ToolHandlerMiddleware
func CreateTheHiveClient ¶
func CreateTheHiveClient(creds *TheHiveCredentials) (*thehive.APIClient, error)
CreateTheHiveClient creates a TheHive client from credentials
func CreateTheHiveConfig ¶
func CreateTheHiveConfig(creds *TheHiveCredentials) (*thehive.Configuration, error)
CreateTheHiveConfig creates a TheHive configuration from credentials
func ExtractBearerToken ¶
ExtractBearerToken extracts a bearer token from an Authorization header
func GetHTTPAuthContextFunc ¶
func GetInprocessServer ¶
func GetInprocessServer(creds *TheHiveCredentials, permissionsConfigPath string) *server.MCPServer
func GetMCPServer ¶
func LoadPermissions ¶
func LoadPermissions(configPath string) (*permissions.Config, error)
LoadPermissions loads permissions configuration from file or uses default Special values: "admin" for full permissions, "read_only" for default read-only permissions Empty string defaults to read-only, otherwise loads from the specified file path
func SafeGetEnv ¶
SafeGetEnv gets an environment variable with optional default value
func StartHTTPServer ¶
func StartHTTPServer(s *server.MCPServer, options *types.TheHiveMcpDefaultOptions) error
StartHTTPServer starts the HTTP server with production-ready configuration
func StartStdioServer ¶
func StartStdioServer(s *server.MCPServer, options *types.TheHiveMcpDefaultOptions) error
StartStdioServer starts the STDIO server with production-ready configuration and error handling
Types ¶
type TheHiveCredentials ¶
type TheHiveCredentials struct {
URL string
APIKey string
Username string
Password string
Organisation string
}
TheHiveCredentials holds authentication information for TheHive
func LoadTheHiveCredentialsFromEnv ¶
func LoadTheHiveCredentialsFromEnv() (*TheHiveCredentials, error)
LoadTheHiveCredentialsFromEnv loads TheHive credentials from environment variables
func (*TheHiveCredentials) Validate ¶
func (c *TheHiveCredentials) Validate() error
Validate validates the credentials