Skip to main content
Glama

Plainly Videos MCP Server

axiosConfig.ts1.2 kB
import axios, { AxiosInstance } from "axios"; import { PACKAGE_NAME, PACKAGE_VERSION } from "./contants"; import { PlainlyApiAuthenticationError, PlainlyApiError } from "./sdk/errors"; export function createApiClient(config: { baseUrl: string; apiKey: string; }): AxiosInstance { const baseUrl = config.baseUrl; const apiKey = config.apiKey; const instance = axios.create({ baseURL: baseUrl, auth: { username: apiKey, password: "", }, headers: { "User-Agent": `${PACKAGE_NAME}/${PACKAGE_VERSION}`, }, timeout: 10000, }); // Global error handler instance.interceptors.response.use( (response) => response, (error) => { if (error.response) { const { status, data } = error.response; // Authentication errors if (status === 401 || status === 403) { return Promise.reject(new PlainlyApiAuthenticationError(status)); } // Other API errors if (status >= 400 && status < 600) { return Promise.reject(new PlainlyApiError(status, data?.message)); } } // Network or other errors return Promise.reject(error); } ); return instance; }

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/plainly-videos/mcp-server'

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