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¶
MCP-specific server configuration. |
|
MCP-specific server runtime information. |
|
MCP transport mechanism types. |
Module Contents¶
- class haive.mcp.servers.models.MCPServerConfig¶
Bases:
haive.dataflow.server_management.models.BaseServerConfigMCP-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.
- validate_transport_config()¶
Validate transport-specific configuration.
- Return type:
- class haive.mcp.servers.models.MCPServerInfo¶
Bases:
haive.dataflow.server_management.models.BaseServerInfoMCP-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"]} ... )
- record_message()¶
Record a message exchange.
- Return type:
None