Module middleware

Module middleware 

Source
Expand description

Middleware components for the microsandbox server.

This module handles:

  • Request/response middleware
  • Authentication and authorization
  • Request tracing and logging
  • Error handling

The module provides:

  • Middleware components for common operations
  • Authentication middleware for API security
  • Logging and tracing middleware

Functions§

auth_middleware
Authentication middleware for verifying API keys and namespace access
logging_middleware
Log incoming requests
mcp_smart_auth_middleware
Smart authentication middleware for MCP requests that handles protocol vs tool methods differently Protocol methods (initialize, tools/list, prompts/list, prompts/get) don’t require namespace validation Tool methods (tools/call) require namespace validation
proxy_middleware
Proxy middleware for forwarding requests to a target service
proxy_uri
Convert a URI to a proxied URI targeting a sandbox
validate_token_and_namespace
Validate the token and check namespace access