INNER CODE UNIT · Python

main

alpacahq/alpaca-mcp-server · src/alpaca_mcp_server/cli.py:47

def main(transport: Transport, host: str, port: int, env_file: Optional[Path]) -> None:
    """Alpaca MCP Server — Trading API integration for Model Context Protocol."""
    if env_file is not None:
        from dotenv import load_dotenv

        load_dotenv(env_file, override=False)

    if not os.environ.get("ALPACA_API_KEY") or not os.environ.get("ALPACA_SECRET_KEY"):
        click.echo(
            "Error: ALPACA_API_KEY and ALPACA_SECRET_KEY must be set.\n"
            "Set them in your MCP client config's env block or pass --env-file.",
            err=True,
        )
        sys.exit(1)

    from .server import build_server

    server = build_server()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…