haive.mcp.servers.models

MCP Server-specific models extending base server management framework.

This module provides MCP-specific server configuration and runtime information models that extend the base server management framework from haive-dataflow.

Key Components:
  • MCPTransport: Enum for MCP transport types (stdio, http, etc.)

  • MCPServerConfig: MCP-specific server configuration

  • MCPServerInfo: MCP runtime information with transport details

Classes

MCPServerConfig

MCP-specific server configuration.

MCPServerInfo

MCP-specific server runtime information.

MCPTransport

MCP transport mechanism types.

Module Contents

class haive.mcp.servers.models.MCPServerConfig

Bases: haive.dataflow.server_management.models.BaseServerConfig

MCP-specific server configuration.

Extends BaseServerConfig with MCP-specific fields like transport type, required environment variables, and protocol version.

transport

MCP transport mechanism (stdio, http, etc.)

requires_env

List of required environment variable names

protocol_version

MCP protocol version (default: “1.0”)

capabilities

List of server capabilities/features

endpoints

Optional endpoints for HTTP/WebSocket transports

Example

>>> config = MCPServerConfig(
...     name="github",
...     command=["npx", "-y", "@modelcontextprotocol/server-github"],
...     description="GitHub repository access",
...     transport=MCPTransport.STDIO,
...     requires_env=["GITHUB_TOKEN"]
... )
classmethod validate_env_vars(v)

Validate environment variable names.

Parameters:

v (List[str])

Return type:

List[str]

validate_transport_config()

Validate transport-specific configuration.

Return type:

MCPServerConfig

class haive.mcp.servers.models.MCPServerInfo

Bases: haive.dataflow.server_management.models.BaseServerInfo

MCP-specific server runtime information.

Extends BaseServerInfo with MCP-specific runtime details like transport info, connection status, and protocol negotiation results.

transport

Active transport type

transport_info

Transport-specific connection details

protocol_version

Negotiated protocol version

capabilities_active

Currently active capabilities

last_message_time

Timestamp of last message exchange

message_count

Total messages exchanged

Example

>>> info = MCPServerInfo(
...     pid=12345,
...     status=ServerStatus.RUNNING,
...     transport=MCPTransport.STDIO,
...     transport_info={"pipes": ["stdin", "stdout", "stderr"]}
... )
get_transport_status()

Get human-readable transport status.

Return type:

str

record_message()

Record a message exchange.

Return type:

None

class haive.mcp.servers.models.MCPTransport

Bases: str, enum.Enum

MCP transport mechanism types.

Defines the communication transport used by MCP servers.

Initialize self. See help(type(self)) for accurate signature.