Session

get_opticstudio_version reads the OpticStudio window attached to this process. main serves MCP on stdio until the host disconnects. read runs one tool body on the shared connection and closes that connection when OpticStudio cannot answer.

The module-level server object is the MCP server that the tool modules decorate.

Stdio MCP server.

SERVER_NAME: str = 'zaymcp'

Name announced to an MCP host.

main() → None

Serve MCP over stdio until the host closes the connection.

read(ctx, load)

Run one read against the shared session.

The session is dropped when OpticStudio cannot answer, so the next call can reconnect.

Parameters:
  • ctx – Tool context for this request.

  • load – Called with the open session.

Returns:

The value returned by load.

Raises:

mcp.server.mcpserver.exceptions.ToolError – OpticStudio cannot answer.