Skip to main content
GumstackHost wraps your FastMCP server with Gumstack’s infrastructure features: token validation, access control, and logging.

Usage

from mcp.server.fastmcp import FastMCP
from mcp.gumstack import GumstackHost

mcp = FastMCP("my-server")

@mcp.tool()
def my_tool() -> str:
    return "Hello"

# Wrap with GumstackHost
host = GumstackHost(mcp)
host.run()

Constructor

GumstackHost(server: FastMCP | Server)
server
FastMCP | Server
required
Your MCP server instance.
Automatically adds:
  • Token validation — Verifies incoming request tokens
  • RBAC interceptor — Checks per-tool permissions
  • Logging interceptor — Records all tool calls

Methods

register_auth

Register an OAuth provider for user authentication.
host.register_auth(provider: AuthProvider) -> None
from mcp.gumstack import AuthProvider

class MyProvider(AuthProvider):
    name = "my-provider"
    # ... implement methods

host = GumstackHost(mcp)
host.register_auth(MyProvider())
Multiple providers can be registered for servers that connect to multiple services.

run

Start the server.
host.run(
    host: str = "0.0.0.0",
    port: int = 8000,
    log_level: str = "info"
) -> None

Environment variables

GumstackHost requires these environment variables (set automatically in production):
VariableDescription
GUMSTACK_SERVER_IDYour server’s unique ID
GUMSTACK_MCP_URLServer’s public URL
GUMLOOP_BACKEND_URLGumloop API URL

What it does

When a request arrives:
  1. Token validation — Verifies the bearer token with Gumloop
  2. Context injection — Sets GumstackContext with user/org info
  3. RBAC check — Confirms user’s group can access the requested tool
  4. Tool execution — Runs your tool code
  5. Logging — Records inputs, outputs, latency, and errors