Skip to main content
Glama

Minimalist Knowledge Base MCP

by cmwen
config.ts1.59 kB
import getAppdataPath from 'appdata-path' import { mkdirSync } from 'fs' import { join } from 'path' /** * Configuration manager for the Personal Knowledge Base * Handles path resolution and directory creation for a specific knowledge base */ export class Config { private readonly kbRootPath: string public readonly dbPath: string public readonly articlesPath: string public readonly transport: 'stdio' | 'http' = 'stdio' public readonly httpPort: number = 3000 /** * Creates a new Config instance for the specified knowledge base * @param kbName The name of the knowledge base */ constructor(kbName: string, cliHttpPort?: number) { if (!kbName) { throw new Error('Knowledge base name is required') } // Set transport based on environment variable if (process.env.MCP_TRANSPORT === 'http') { this.transport = 'http' this.httpPort = cliHttpPort || parseInt(process.env.MCP_PORT || '3000', 10) } else if (cliHttpPort) { this.httpPort = cliHttpPort } // Resolve the root path for this knowledge base this.kbRootPath = join(getAppdataPath('min-kb-mcp'), kbName) // Derive other paths this.dbPath = join(this.kbRootPath, `${kbName}.sqlite`) this.articlesPath = join(this.kbRootPath, 'articles') // Ensure directories exist this.ensureDirectories() } /** * Creates all necessary directories for the knowledge base * @private */ private ensureDirectories(): void { mkdirSync(this.kbRootPath, { recursive: true }) mkdirSync(this.articlesPath, { recursive: 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/cmwen/min-kb-mcp'

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