Skip to main content
Glama
config.ts1.7 kB
import * as fs from 'fs'; export interface WikiConfig { /** * Corresponds to the $wgSitename setting in MediaWiki. */ sitename: string; /** * Corresponds to the $wgServer setting in MediaWiki. */ server: string; /** * Corresponds to the $wgArticlePath setting in MediaWiki. */ articlepath: string; /** * Corresponds to the $wgScriptPath setting in MediaWiki. */ scriptpath: string; /** * OAuth consumer token requested from Extension:OAuth. */ token?: string | null; /** * Username requested from Special:BotPasswords. */ username?: string | null; /** * Password requested from Special:BotPasswords. */ password?: string | null; /** * If the wiki always requires auth to access. * $wgGroupPermissions['*']['read'] = false; in MediaWiki */ private?: boolean; } export type PublicWikiConfig = Omit<WikiConfig, 'token' | 'username' | 'password'>; export interface Config { wikis: { [key: string]: WikiConfig }; defaultWiki: string; } export const defaultConfig: Config = { defaultWiki: 'en.wikipedia.org', wikis: { 'en.wikipedia.org': { sitename: 'Wikipedia', server: 'https://en.wikipedia.org', articlepath: '/wiki', scriptpath: '/w', token: null, private: false }, 'localhost:8080': { sitename: 'Local MediaWiki Docker', server: 'http://localhost:8080', articlepath: '/wiki', scriptpath: '/w', token: null, private: false } } }; const configPath = process.env.CONFIG || 'config.json'; export function loadConfigFromFile(): Config { if ( !fs.existsSync( configPath ) ) { return defaultConfig; } const rawData = fs.readFileSync( configPath, 'utf-8' ); return JSON.parse( rawData ) as Config; }

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/ProfessionalWiki/MediaWiki-MCP-Server'

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