libmuscle.mcp.server module

class libmuscle.mcp.server.Server(instance_id: Reference, post_office: PostOffice)[source]

Bases: object

A server that accepts MCP connections.

This is a base class for MCP Servers. An MCP Server accepts connections over some lower-level communication protocol, and processes message requests by sending the requested message.

Create a Server.

Parameters
  • instance_id – Id of the instance we’re a server for.

  • post_office – A PostOffice to obtain data from.

close() None[source]

Closes this server.

Stops the server listening, waits for existing clients to disconnect, then frees any other resources.

get_location() str[source]

Returns the location this server listens on.

Returns

A string containing the location.

exception libmuscle.mcp.server.ServerNotSupported[source]

Bases: RuntimeError