/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { CloudinarySMDCore } from "../core.js";
import { createRegisterPrompt } from "./prompts.js";
import { createRegisterResource, createRegisterResourceTemplate, } from "./resources.js";
import { createRegisterTool, registerDynamicTools, } from "./tools.js";
import { tool$metadataFieldsCreateMetadataField } from "./tools/metadataFieldsCreateMetadataField.js";
import { tool$metadataFieldsDeleteMetadataField } from "./tools/metadataFieldsDeleteMetadataField.js";
import { tool$metadataFieldsDeleteMetadataFieldDatasource } from "./tools/metadataFieldsDeleteMetadataFieldDatasource.js";
import { tool$metadataFieldsGetMetadataField } from "./tools/metadataFieldsGetMetadataField.js";
import { tool$metadataFieldsListMetadataFields } from "./tools/metadataFieldsListMetadataFields.js";
import { tool$metadataFieldsUpdateMetadataField } from "./tools/metadataFieldsUpdateMetadataField.js";
import { tool$metadataFieldsUpdateMetadataFieldDatasource } from "./tools/metadataFieldsUpdateMetadataFieldDatasource.js";
import { tool$metadataRulesCreateMetadataRule } from "./tools/metadataRulesCreateMetadataRule.js";
import { tool$metadataRulesDeleteMetadataRule } from "./tools/metadataRulesDeleteMetadataRule.js";
import { tool$metadataRulesListMetadataRules } from "./tools/metadataRulesListMetadataRules.js";
import { tool$metadataRulesUpdateMetadataRule } from "./tools/metadataRulesUpdateMetadataRule.js";
export function createMCPServer(deps) {
    const server = new McpServer({
        name: "CloudinarySMD",
        version: "0.5.0",
    });
    const getClient = deps.getSDK || (() => new CloudinarySMDCore({
        security: deps.security,
        cloud_name: deps.cloud_name,
        serverURL: deps.serverURL,
        serverIdx: deps.serverIdx,
        region: deps.region,
        host: deps.host,
        debugLogger: deps.logger.level === "debug"
            ? {
                log: (...args) => console.log(...args),
                group: (...args) => console.group(...args),
                groupEnd: (...args) => console.groupEnd(...args),
            }
            : undefined,
    }));
    const scopes = new Set(deps.scopes);
    const allowedTools = deps.allowedTools && new Set(deps.allowedTools);
    const [tool, tools, toolMap] = createRegisterTool(deps.logger, server, getClient, scopes, allowedTools, deps.dynamic, deps.annotationFilter);
    const resource = createRegisterResource(deps.logger, server, getClient, scopes);
    const resourceTemplate = createRegisterResourceTemplate(deps.logger, server, getClient, scopes);
    const prompt = createRegisterPrompt(deps.logger, server, getClient, scopes);
    const register = { tool, resource, resourceTemplate, prompt };
    void register; // suppress unused warnings
    tool(tool$metadataFieldsCreateMetadataField);
    tool(tool$metadataFieldsListMetadataFields);
    tool(tool$metadataFieldsGetMetadataField);
    tool(tool$metadataFieldsUpdateMetadataField);
    tool(tool$metadataFieldsDeleteMetadataField);
    tool(tool$metadataFieldsUpdateMetadataFieldDatasource);
    tool(tool$metadataFieldsDeleteMetadataFieldDatasource);
    tool(tool$metadataRulesCreateMetadataRule);
    tool(tool$metadataRulesListMetadataRules);
    tool(tool$metadataRulesUpdateMetadataRule);
    tool(tool$metadataRulesDeleteMetadataRule);
    if (deps.dynamic) {
        registerDynamicTools(deps.logger, server, getClient, toolMap, scopes);
    }
    return { server, tools };
}
//# sourceMappingURL=server.js.map