Prerequisites
- Golf Gateway deployed
- Access token for authentication (M2M or user token)
- Python 3.10+ with
mcpandhttpxpackages
What to test
A comprehensive canary test covers three areas:Test 1: Health check
The gateway exposes a/health endpoint that verifies internal components.
Endpoint: GET /health
Python implementation
Test 2: MCP connectivity
This test verifies you can establish an authenticated MCP session through the gateway.Authentication
Step 1: Discover DCR endpoint
Find the registration endpoint from OAuth metadata:Step 2: Dynamic Client Registration (one-time per execution of the canary script)
Register your canary test client per RFC 7591:Step 3: Token provider with refresh
Create a token provider that handles acquisition of the M2M token from your IDP.Connecting with the Python MCP SDK
Use the official MCP Python SDK to establish a connection. Key concepts:- MCP URL format:
{gateway_url}/{server_name}/mcp - Token injection: Pass token via
Authorizationheader tostreamable_http_client - Transport: Use
streamable_http_clientfor HTTP-based MCP - Initialization: Call
session.initialize()to establish the session
Python implementation
Validating the upstream server
A successfulinitialize confirms the gateway can reach the upstream, but doesn’t verify the upstream is fully functional. For deeper validation, call a tool that returns a known output:
Test 3: Security firewall
This test verifies that Golf Gateway’s threat detection is active and blocking prompt injection attacks. When a prompt injection is detected, the gateway blocks the request—either returning an HTTP 403 or an MCP error depending on when in the request lifecycle the threat is detected.Test payloads
Use known prompt injection patterns that should trigger the firewall:Python implementation
Use the MCP SDK to call a tool with a malicious payload and verify the firewall blocks it:Related guides
- Set Up Server RBAC - Group-based access
- Configure PII Scrubbing - Data protection