mcp.servers.http_server

HTTP-based MCP server for haive using FastAPI and SSE transport.

Attributes

Functions

calculate(→ float)

Perform a calculation.

echo(→ str)

Echo back a message.

get_server_time(→ str)

Get the current server time.

get_system_info(→ dict[str, Any])

Get system information.

handle_sse(request)

Handle SSE connections for MCP protocol.

health()

Health check endpoint.

help_prompt(→ list[dict[str, str]])

Get help using this MCP server.

info()

Server information endpoint.

list_tools(→ list[str])

List all available tools.

root()

Root endpoint.

run_server([host, port])

Run the HTTP MCP server.

server_info_resource(→ str)

Get server information as a resource.

server_status_resource(→ str)

Get server status.

Module Contents

async mcp.servers.http_server.calculate(operation: str, a: float, b: float) float

Perform a calculation.

Parameters:
  • operation – One of ‘add’, ‘subtract’, ‘multiply’, ‘divide’

  • a – First number

  • b – Second number

Returns:

Result of the calculation

async mcp.servers.http_server.echo(message: str) str

Echo back a message.

async mcp.servers.http_server.get_server_time() str

Get the current server time.

async mcp.servers.http_server.get_system_info() dict[str, Any]

Get system information.

async mcp.servers.http_server.handle_sse(request: fastapi.Request)

Handle SSE connections for MCP protocol.

async mcp.servers.http_server.health()

Health check endpoint.

async mcp.servers.http_server.help_prompt() list[dict[str, str]]

Get help using this MCP server.

async mcp.servers.http_server.info()

Server information endpoint.

async mcp.servers.http_server.list_tools() list[str]

List all available tools.

async mcp.servers.http_server.root()

Root endpoint.

mcp.servers.http_server.run_server(host: str = '0.0.0.0', port: int = 8000)

Run the HTTP MCP server.

async mcp.servers.http_server.server_info_resource() str

Get server information as a resource.

async mcp.servers.http_server.server_status_resource() str

Get server status.

mcp.servers.http_server.app
mcp.servers.http_server.logger
mcp.servers.http_server.mcp
mcp.servers.http_server.sse_transport = None