Skip to main content
Glama

Brasil API MCP

api.ts1.34 kB
import axios from "axios"; const BASE_URL = "https://brasilapi.com.br/api"; /** * Helper function to make GET requests to the Brasil API * @param endpoint API endpoint path * @param params Query parameters * @returns API response data */ export async function getBrasilApiData(endpoint: string, params: Record<string, any> = {}) { try { const url = `${BASE_URL}${endpoint}`; console.error(`Making request to: ${url}`); const response = await axios.get(url, { params }); return { data: response.data, success: true }; } catch (error: any) { console.error(`Error in API request: ${error.message}`); // Handle API errors in a structured format if (error.response) { return { success: false, statusCode: error.response.status, message: error.response.data?.message || error.message, error: error.response.data }; } return { success: false, message: error.message, error }; } } /** * Helper function to format error responses for tools * @param message Error message to display * @returns Formatted error response for MCP */ export function formatErrorResponse(message: string) { return { content: [{ type: "text" as const, text: message }], isError: true }; }

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/guilhermelirio/brasil-api-mcp'

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