Skip to main content
Glama

MCP GitHub Project Manager

publish.jsโ€ข2.65 kB
#!/usr/bin/env node import fs from 'fs'; import { execSync } from 'child_process'; import readline from 'readline'; const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); const prompt = (question) => new Promise((resolve) => { rl.question(question, resolve); }); async function runPublish() { try { // Check for uncommitted changes try { execSync('git diff-index --quiet HEAD --'); } catch (error) { process.stderr.write('โŒ You have uncommitted changes. Please commit or stash them before publishing.'); process.exit(1); } // Run tests console.log('๐Ÿงช Running tests...'); execSync('npm test', { stdio: 'inherit' }); // Read current package version const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); const currentVersion = packageJson.version; console.log(`๐Ÿ“ฆ Current version: ${currentVersion}`); // Ask for new version const versionTypes = ['patch', 'minor', 'major']; const versionType = await prompt(`Select version type (patch/minor/major): `); if (!versionTypes.includes(versionType)) { process.stderr.write('โŒ Invalid version type. Must be patch, minor, or major'); process.exit(1); } // Update version console.log(`๐Ÿ”– Updating to a new ${versionType} version...`); execSync(`npm version ${versionType} --no-git-tag-version`, { stdio: 'inherit' }); // Read new version const updatedPackageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8')); const newVersion = updatedPackageJson.version; // Build package console.log('๐Ÿ”จ Building package...'); execSync('npm run build', { stdio: 'inherit' }); // Confirm publishing const confirm = await prompt(`Are you sure you want to publish version ${newVersion}? (y/n): `); if (confirm.toLowerCase() !== 'y') { console.log('๐Ÿ›‘ Publishing cancelled.'); process.exit(0); } // Publish to npm console.log('๐Ÿš€ Publishing to npm...'); execSync('npm publish', { stdio: 'inherit' }); // Create Git tag and push console.log('๐Ÿ“Œ Creating git tag and pushing...'); execSync(`git add package.json`); execSync(`git commit -m "release: version ${newVersion}"`); execSync(`git tag v${newVersion}`); execSync('git push'); execSync('git push --tags'); console.log(`โœ… Successfully published version ${newVersion}!`); } catch (error) { process.stderr.write('โŒ Error during publishing:', error.message); process.exit(1); } finally { rl.close(); } } runPublish();

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/HarshKumarSharma/MCP'

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