How to Use the MCP Server in Python

How to Use the MCP Server in Python

Overview

The MCP server exposes conversion tools via FastMCP. Install FastMCP separately if needed:

pip install aspose-page-foss

McpInput

McpInput accepts a file path or base64-encoded bytes:

from aspose.page.mcp.models import McpInput

# From file path
inp = McpInput(path="input.ps")

# From base64
import base64
with open("input.ps", "rb") as f:
    b64 = base64.b64encode(f.read()).decode()
inp = McpInput(base64_data=b64)

McpConversionOptions

McpConversionOptions controls the output format and DPI for the conversion:

from aspose.page.mcp.models import McpConversionOptions

opts = McpConversionOptions(format="png", dpi=150)

McpOutput

McpOutput returns base64 bytes or writes to a file path.

See Also

 English