Skip to main content
Glama

api_add

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

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

  • server.js:119-147 (registration)
    Registration of the 'api_add' tool, including input schema validation using Zod and a thin handler that calls apis.addApi
    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 }; } } );
  • apis.js:46-68 (handler)
    Core implementation of API addition: initializes data, validates alias and URL, stores config in memory map, persists to JSON file, returns success message
    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.` }; }

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