Skip to main content
Glama
syncApiServerVersions.ts1.45 kB
import { readFileSync, writeFileSync } from "node:fs"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const rootDir = join(__dirname, ".."); const packageJsonPath = join(rootDir, "package.json"); const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); const packageVersion = packageJson.version; if (!packageVersion) { throw new Error("package.json does not contain a version field."); } const updatedFiles: string[] = []; const writeTextFile = ( relativePath: string, updater: (data: string, version: string) => string, ) => { const absPath = join(rootDir, relativePath); const original = readFileSync(absPath, "utf8"); const next = updater(original, packageVersion); writeFileSync(absPath, next, "utf8"); updatedFiles.push(relativePath); }; writeTextFile("pyproject.toml", (contents) => { return contents.replace( /version\s*=\s*"[^"]+"/, `version = "${packageVersion}"`, ); }); writeTextFile("td/modules/utils/version.py", (contents) => { return contents.replace( /MCP_API_VERSION\s*=\s*"[^"]+"/, `MCP_API_VERSION = "${packageVersion}"`, ); }); writeTextFile("src/api/index.yml", (contents) => { return contents.replace(/version:\s*[\d.]+/, `version: ${packageVersion}`); }); console.log( `Synchronized version ${packageVersion} across: ${updatedFiles.join(", ")}`, );

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/8beeeaaat/touchdesigner-mcp'

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