/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 7cd4394c80e8
 */
import { buildCommand } from "@stricli/core";
import { numberParser } from "@stricli/core";
import * as z from "zod";
import { ServerRegion } from "../../../lib/config.js";
import { mcpAppsFlag } from "../../apps/cli-flag.js";
import { consoleLoggerLevels } from "../../console-logger.js";
import { mcpScopes } from "../../scopes.js";
export const serveCommand = buildCommand({
    loader: async () => {
        const { main } = await import("./impl.js");
        return main;
    },
    parameters: {
        flags: {
            port: {
                kind: "parsed",
                brief: "The port to listen on for Streamable HTTP connections",
                default: "2718",
                parse: (val) => z.coerce.number().int().gte(0).lt(65536).parse(val),
            },
            "disable-static-auth": {
                kind: "boolean",
                brief: "Disable static authentication, allowing credentials to be passed via request headers only",
                default: false,
            },
            tool: {
                kind: "parsed",
                brief: "Specify tools to mount on the server",
                optional: true,
                variadic: true,
                parse: (value) => {
                    return z.string().parse(value);
                },
            },
            mode: {
                kind: "enum",
                brief: "Server mode (dynamic: expose list_tools, describe_tool_input, and execute_tool instead of individual tools)",
                values: ["dynamic"],
                optional: true,
            },
            "tool-annotations": {
                kind: "parsed",
                brief: "Filter tools by annotations (comma-separated: readOnly, destructive, idempotent, openWorld). Listed = required true, unlisted = required false.",
                optional: true,
                parse: (value) => value.split(",").map(s => s.trim()),
            },
            scope: {
                kind: "enum",
                brief: "Mount tools/resources that match given scope (repeatable flag)",
                values: mcpScopes,
                variadic: true,
                optional: true,
            },
            "api-key": {
                kind: "parsed",
                brief: "Sets the api_key auth field for the API",
                optional: true,
                parse: (value) => {
                    return z.string().parse(value);
                },
            },
            "api-secret": {
                kind: "parsed",
                brief: "Sets the api_secret auth field for the API",
                optional: true,
                parse: (value) => {
                    return z.string().parse(value);
                },
            },
            oauth2: {
                kind: "parsed",
                brief: "Sets the oauth2 auth field for the API",
                optional: true,
                parse: (value) => {
                    return z.string().parse(value);
                },
            },
            "cloud-name": {
                kind: "parsed",
                brief: "Allows setting the cloud_name parameter for all supported operations",
                optional: true,
                parse: (value) => {
                    return z.string().parse(value);
                },
            },
            "server-url": {
                kind: "parsed",
                brief: "Overrides the default server URL used by the SDK",
                optional: true,
                parse: (value) => new URL(value).toString(),
            },
            "server-index": {
                kind: "parsed",
                brief: "Selects a predefined server used by the SDK",
                optional: true,
                parse: numberParser,
            },
            region: {
                kind: "enum",
                brief: "Sets the region variable for url substitution",
                optional: true,
                values: Object.values(ServerRegion),
            },
            "api-host": {
                kind: "parsed",
                brief: "Sets the host variable for url substitution",
                optional: true,
                parse: (value) => value,
            },
            "mcp-apps": mcpAppsFlag,
            "log-level": {
                kind: "enum",
                brief: "The log level to use for the server",
                default: "info",
                values: consoleLoggerLevels,
            },
            env: {
                kind: "parsed",
                brief: "Environment variables made available to the server",
                optional: true,
                variadic: true,
                parse: (val) => {
                    const sepIdx = val.indexOf("=");
                    if (sepIdx === -1) {
                        throw new Error("Invalid environment variable format");
                    }
                    const key = val.slice(0, sepIdx);
                    const value = val.slice(sepIdx + 1);
                    return [
                        z.string().nonempty({
                            message: "Environment variable key must be a non-empty string",
                        }).parse(key),
                        z.string().nonempty({
                            message: "Environment variable value must be a non-empty string",
                        }).parse(value),
                    ];
                },
            },
        },
    },
    docs: {
        brief: "Run the MCP server with Streamable HTTP transport",
    },
});
//# sourceMappingURL=command.js.map