Skip to main content
Glama

Polybar Notification MCP

by khughitt
polybar-mcp1.35 kB
#!/usr/bin/env node import { resolve } from 'path'; import { homedir } from 'os'; import { spawn } from 'child_process'; import { fileURLToPath } from 'url'; import { dirname, join } from 'path'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); function expandPath(inputPath) { if (inputPath.startsWith('~/')) { return resolve(homedir(), inputPath.slice(2)); } if (inputPath.includes('$HOME/')) { return inputPath.replace('$HOME', homedir()); } return inputPath; } // Get the actual script path const scriptPath = join(__dirname, '..', 'dist', 'index.js'); // Expand any paths in arguments const expandedArgs = process.argv.slice(2).map(arg => { if (arg.includes('/') && (arg.startsWith('~/') || arg.includes('$HOME/'))) { return expandPath(arg); } return arg; }); // Spawn the actual MCP server const child = spawn('node', [scriptPath, ...expandedArgs], { stdio: 'inherit', env: { ...process.env, // Expand any environment variables that might contain paths ...Object.fromEntries( Object.entries(process.env).map(([key, value]) => [ key, value && (value.startsWith('~/') || value.includes('$HOME/')) ? expandPath(value) : value ]) ) } }); child.on('exit', (code) => { process.exit(code || 0); });

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/khughitt/polybar-dunst-mcp'

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