Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

api_add

Add or update APIs in the monitoring catalog for health checks and authentication configuration within the SFTP Orchestrator server.

Instructions

Ajoute ou met à jour une API dans le catalogue de monitoring.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias unique pour l'API.
urlYesURL de base de l'API, incluant le port si nécessaire.
health_check_endpointNoEndpoint spécifique pour le test de santé (ex: /health).
health_check_methodNoMéthode HTTP pour le test de santé.GET
auth_methodNoMéthode d'authentification.none
api_keyNoClé API si nécessaire.
auth_header_nameNoNom du header pour la clé API.Authorization
auth_schemeNoSchéma d'authentification (ex: Bearer). Mettre à '' si non applicable.Bearer
htpasswd_userNoNom d'utilisateur pour l'authentification Basic (htpasswd).
htpasswd_passNoMot de passe pour l'authentification Basic (htpasswd).
notesNoNotes additionnelles.

Implementation Reference

  • apis.js:46-68 (handler)
    Core handler logic for adding or updating an API entry in the JSON store with validation.
    async function addApi(alias, apiConfig) {
        await ensureInitialized();
        
        // Validation
        if (!alias || typeof alias !== 'string') {
            throw new Error("L'alias doit être une chaîne non vide.");
        }
        
        if (!apiConfig.url) {
            throw new Error("L'URL de l'API est obligatoire.");
        }
        
        // Valider l'URL
        try {
            new URL(apiConfig.url);
        } catch (e) {
            throw new Error(`URL invalide: ${apiConfig.url}`);
        }
        
        apis[alias] = apiConfig;
        await saveApis();
        return { success: true, message: `API '${alias}' ajoutée/mise à jour avec succès.` };
    }
  • Input schema definition for the api_add tool using Zod validation.
    title: "Ajouter une API au catalogue",
    description: "Ajoute ou met à jour une API dans le catalogue de monitoring.",
    inputSchema: z.object({
        alias: z.string().describe("Alias unique pour l'API."),
        url: z.string().url().describe("URL de base de l'API, incluant le port si nécessaire."),
        health_check_endpoint: z.string().optional().describe("Endpoint spécifique pour le test de santé (ex: /health)."),
        health_check_method: z.enum(['GET', 'POST']).optional().default('GET').describe("Méthode HTTP pour le test de santé."),
        auth_method: z.enum(['api_key', 'htpasswd', 'both', 'none']).optional().default('none').describe("Méthode d'authentification."),
        api_key: z.string().optional().describe("Clé API si nécessaire."),
        auth_header_name: z.string().optional().default('Authorization').describe("Nom du header pour la clé API."),
        auth_scheme: z.string().optional().default('Bearer').describe("Schéma d'authentification (ex: Bearer). Mettre à '' si non applicable."),
        htpasswd_user: z.string().optional().describe("Nom d'utilisateur pour l'authentification Basic (htpasswd)."),
        htpasswd_pass: z.string().optional().describe("Mot de passe pour l'authentification Basic (htpasswd)."),
        notes: z.string().optional().describe("Notes additionnelles.")
    })
  • server.js:119-147 (registration)
    MCP tool registration for 'api_add' with schema and wrapper handler.
    server.registerTool(
        "api_add",
        {
            title: "Ajouter une API au catalogue",
            description: "Ajoute ou met à jour une API dans le catalogue de monitoring.",
            inputSchema: z.object({
                alias: z.string().describe("Alias unique pour l'API."),
                url: z.string().url().describe("URL de base de l'API, incluant le port si nécessaire."),
                health_check_endpoint: z.string().optional().describe("Endpoint spécifique pour le test de santé (ex: /health)."),
                health_check_method: z.enum(['GET', 'POST']).optional().default('GET').describe("Méthode HTTP pour le test de santé."),
                auth_method: z.enum(['api_key', 'htpasswd', 'both', 'none']).optional().default('none').describe("Méthode d'authentification."),
                api_key: z.string().optional().describe("Clé API si nécessaire."),
                auth_header_name: z.string().optional().default('Authorization').describe("Nom du header pour la clé API."),
                auth_scheme: z.string().optional().default('Bearer').describe("Schéma d'authentification (ex: Bearer). Mettre à '' si non applicable."),
                htpasswd_user: z.string().optional().describe("Nom d'utilisateur pour l'authentification Basic (htpasswd)."),
                htpasswd_pass: z.string().optional().describe("Mot de passe pour l'authentification Basic (htpasswd)."),
                notes: z.string().optional().describe("Notes additionnelles.")
            })
        },
        async (params) => {
            try {
                const { alias, ...apiConfig } = params;
                const result = await apis.addApi(alias, apiConfig);
                return { content: [{ type: "text", text: result.message }] };
            } catch (e) {
                return { content: [{ type: "text", text: `ERREUR: ${e.message}` }], isError: true };
            }
        }
    );
  • Wrapper handler for the api_add tool that delegates to apis.addApi and formats MCP response.
    async (params) => {
        try {
            const { alias, ...apiConfig } = params;
            const result = await apis.addApi(alias, apiConfig);
            return { content: [{ type: "text", text: result.message }] };
        } catch (e) {
            return { content: [{ type: "text", text: `ERREUR: ${e.message}` }], isError: true };
        }
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/fkom13/mcp-sftp-orchestrator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server