Skip to main content
Glama
index.ts1.56 kB
/** * Configuration management for Yuque MCP Server * 语雀MCP服务器配置管理 */ export interface Config { token: string; apiBaseURL: string; timeout: number; retries: number; } /** * Default configuration */ const DEFAULT_CONFIG: Config = { token: '', apiBaseURL: 'https://www.yuque.com/api/v2', timeout: 30000, retries: 3, }; /** * Get configuration from environment variables */ export function getConfig(): Config { const token = process.env.YUQUE_TOKEN || process.env.YUQUE_API_TOKEN; if (!token) { throw new Error( 'YUQUE_TOKEN environment variable is required. ' + 'Set it using: export YUQUE_TOKEN="your_token_here"' ); } return { ...DEFAULT_CONFIG, token, apiBaseURL: process.env.YUQUE_API_BASE_URL || DEFAULT_CONFIG.apiBaseURL, timeout: parseInt(process.env.YUQUE_TIMEOUT || '30000'), retries: parseInt(process.env.YUQUE_RETRIES || '3'), }; } /** * Validate configuration */ export function validate(): { isValid: boolean; error?: string } { try { const config = getConfig(); if (!config.token) { return { isValid: false, error: 'YUQUE_TOKEN is required' }; } if (config.token.length < 10) { return { isValid: false, error: 'YUQUE_TOKEN appears to be invalid (too short)' }; } return { isValid: true }; } catch (error) { return { isValid: false, error: error instanceof Error ? error.message : 'Unknown error' }; } } /** * Export configuration object */ export const config = { get: getConfig, validate, };

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/tanis2010/yuque-mcp-server'

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