ExMcp.Test.Support.Transports.Http (ex_mcp v0.10.0)

View Source

HTTP transport test helper with SecurityGuard integration.

Provides test HTTP endpoints that integrate with SecurityGuard middleware for testing security policies across HTTP transport.

Summary

Functions

Returns a specification to start this module under a supervisor.

Sends a request through the HTTP test endpoint with security validation.

Starts a test HTTP endpoint with SecurityGuard middleware.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

request(endpoint, command, headers)

Sends a request through the HTTP test endpoint with security validation.

Parameters

  • endpoint - Endpoint returned from start_test_endpoint/1
  • command - JSON-RPC command to send
  • headers - HTTP headers including authorization

Returns

  • {:ok, response, received_command} - Success with response and command after security processing
  • {:error, reason} - Security violation or other error

start_test_endpoint(opts \\ [])

Starts a test HTTP endpoint with SecurityGuard middleware.

Options

  • :security_guard - SecurityGuard module to use for validation
  • :port - Port to bind to (defaults to random available port)

Returns

{:ok, endpoint} where endpoint can be used with request/3