haive.mcp.servers.http_server

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

Functions

calculate(operation, a, b)

Perform a calculation.

echo(message)

Echo back a message.

get_server_time()

Get the current server time.

get_system_info()

Get system information.

handle_sse(request)

Handle SSE connections for MCP protocol.

health()

Health check endpoint.

help_prompt()

Get help using this MCP server.

info()

Server information endpoint.

list_tools()

List all available tools.

root()

Root endpoint.

run_server([host, port])

Run the HTTP MCP server.

server_info_resource()

Get server information as a resource.

server_status_resource()

Get server status.

Module Contents

async haive.mcp.servers.http_server.calculate(operation, a, b)

Perform a calculation.

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

  • a (float) – First number

  • b (float) – Second number

Returns:

Result of the calculation

Return type:

float

async haive.mcp.servers.http_server.echo(message)

Echo back a message.

Parameters:

message (str)

Return type:

str

async haive.mcp.servers.http_server.get_server_time()

Get the current server time.

Return type:

str

async haive.mcp.servers.http_server.get_system_info()

Get system information.

Return type:

dict[str, Any]

async haive.mcp.servers.http_server.handle_sse(request)

Handle SSE connections for MCP protocol.

Parameters:

request (fastapi.Request)

async haive.mcp.servers.http_server.health()

Health check endpoint.

async haive.mcp.servers.http_server.help_prompt()

Get help using this MCP server.

Return type:

list[dict[str, str]]

async haive.mcp.servers.http_server.info()

Server information endpoint.

async haive.mcp.servers.http_server.list_tools()

List all available tools.

Return type:

list[str]

async haive.mcp.servers.http_server.root()

Root endpoint.

haive.mcp.servers.http_server.run_server(host='0.0.0.0', port=8000)

Run the HTTP MCP server.

Parameters:
async haive.mcp.servers.http_server.server_info_resource()

Get server information as a resource.

Return type:

str

async haive.mcp.servers.http_server.server_status_resource()

Get server status.

Return type:

str