Skip to main content
Glama
amranu

DigitalOcean MCP Server

by amranu
endpoints.ts1.72 kB
import { readFileSync } from 'fs'; import { join, dirname } from 'path'; import { fileURLToPath } from 'url'; import type { DOEndpoint } from './types.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); let cachedEndpoints: DOEndpoint[] | null = null; export function loadEndpoints(): DOEndpoint[] { if (cachedEndpoints) { return cachedEndpoints; } try { const endpointsPath = join(__dirname, '..', 'digitalocean_endpoints.json'); const data = readFileSync(endpointsPath, 'utf-8'); cachedEndpoints = JSON.parse(data) as DOEndpoint[]; return cachedEndpoints; } catch (error) { console.error('Failed to load endpoints:', error); return []; } } export function findEndpoint(operationId: string): DOEndpoint | undefined { const endpoints = loadEndpoints(); return endpoints.find(ep => ep.operationId === operationId); } export function searchEndpoints(query: string): DOEndpoint[] { const endpoints = loadEndpoints(); const lowercaseQuery = query.toLowerCase(); return endpoints.filter(ep => ep.operationId.toLowerCase().includes(lowercaseQuery) || ep.summary.toLowerCase().includes(lowercaseQuery) || ep.description.toLowerCase().includes(lowercaseQuery) || ep.tags.some(tag => tag.toLowerCase().includes(lowercaseQuery)) ); } export function getEndpointsByTag(tag: string): DOEndpoint[] { const endpoints = loadEndpoints(); return endpoints.filter(ep => ep.tags.includes(tag)); } export function getAllTags(): string[] { const endpoints = loadEndpoints(); const tags = new Set<string>(); endpoints.forEach(ep => ep.tags.forEach(tag => tags.add(tag))); return Array.from(tags).sort(); }

Implementation Reference

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/amranu/digitalocean-mcp'

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