Skip to main content
Glama

Smart Code Search MCP Server

setup-media.jsโ€ข8.55 kB
/** * Setup Media Directory Structure * Creates necessary directories and placeholder files for media storage */ const fs = require('fs').promises; const path = require('path'); const MEDIA_DIRS = [ 'media', 'media/screenshots', 'media/recordings', 'media/browser', 'media/thumbnails', 'media/exports', 'data', 'logs' ]; const PLACEHOLDER_FILES = { 'public/placeholder.png': createPlaceholderImage(), '.env.example': createEnvExample(), 'README.md': createReadme() }; async function setupMediaDirectories() { console.log('๐Ÿš€ Setting up media directory structure...\n'); // Create directories for (const dir of MEDIA_DIRS) { const dirPath = path.join(__dirname, dir); try { await fs.mkdir(dirPath, { recursive: true }); console.log(`โœ… Created directory: ${dir}`); // Add .gitkeep to preserve empty directories const gitkeepPath = path.join(dirPath, '.gitkeep'); await fs.writeFile(gitkeepPath, ''); } catch (error) { if (error.code === 'EEXIST') { console.log(`โญ๏ธ Directory exists: ${dir}`); } else { console.error(`โŒ Failed to create ${dir}:`, error.message); } } } // Create placeholder files console.log('\n๐Ÿ“„ Creating configuration files...\n'); for (const [filePath, content] of Object.entries(PLACEHOLDER_FILES)) { const fullPath = path.join(__dirname, filePath); try { // Check if file exists await fs.access(fullPath); console.log(`โญ๏ธ File exists: ${filePath}`); } catch { // File doesn't exist, create it await fs.writeFile(fullPath, content); console.log(`โœ… Created file: ${filePath}`); } } // Create gitignore for media files const gitignorePath = path.join(__dirname, 'media', '.gitignore'); const gitignoreContent = ` # Ignore all media files except .gitkeep * !.gitignore !.gitkeep !*/ `.trim(); await fs.writeFile(gitignorePath, gitignoreContent); console.log('\nโœ… Created media/.gitignore'); console.log('\n๐ŸŽ‰ Media directory setup complete!'); console.log('\n๐Ÿ“‹ Next steps:'); console.log('1. Copy .env.example to .env and configure'); console.log('2. Install VS Code extension: cd vscode-extension && npm install'); console.log('3. Run the server: npm start'); console.log('4. Open browser: http://localhost:3000'); } function createPlaceholderImage() { // Create a simple SVG placeholder image return `<svg width="400" height="300" xmlns="http://www.w3.org/2000/svg"> <rect width="400" height="300" fill="#f3f4f6"/> <text x="50%" y="50%" text-anchor="middle" dy=".3em" fill="#9ca3af" font-family="sans-serif" font-size="20"> No Preview Available </text> </svg>`; } function createEnvExample() { return `# Voice Assistant Configuration # Server Ports PORT=3000 WS_PORT=3001 # Project Settings PROJECT_ROOT=${process.cwd()} PROJECT_NAME=MyProject # ElevenLabs API (optional) ELEVENLABS_API_KEY=your_api_key_here ELEVENLABS_VOICE_ID=rachel # OpenAI API (optional, for enhanced voice processing) OPENAI_API_KEY=your_api_key_here # Media Storage MAX_STORAGE_GB=5 CLEANUP_DAYS=30 THUMBNAIL_WIDTH=320 THUMBNAIL_HEIGHT=240 # Session Settings SESSION_TIMEOUT_MINUTES=30 AUTO_SAVE_INTERVAL_SECONDS=60 # Security CORS_ORIGIN=http://localhost:3000 API_KEY=optional_api_key_for_security # Features ENABLE_BROWSER_MCP=true ENABLE_VOICE_RECOGNITION=true ENABLE_AUTO_TRANSCRIPTION=false # VS Code Extension VSCODE_AUTO_CONNECT=true VSCODE_SERVER_URL=ws://localhost:3001 `; } function createReadme() { return `# Voice Code Assistant with Media History A comprehensive voice-enabled AI pair programmer with media documentation capabilities. ## Features - ๐ŸŽ™๏ธ **Voice Control**: Natural voice commands for code analysis - ๐Ÿ“ธ **Screenshot Capture**: Desktop and browser screenshots - ๐ŸŽฌ **Screen Recording**: Record coding sessions - ๐ŸŒ **Browser Integration**: Capture web content via Playwright - ๐Ÿ’พ **Media History**: SQLite-backed storage with search - ๐Ÿ” **Smart Code Search**: Powered by SCS-MCP - ๐ŸŽฏ **VS Code Integration**: Real-time editor context - ๐Ÿ“Š **Analytics Dashboard**: Usage insights and metrics ## Quick Start 1. **Install dependencies**: \`\`\`bash npm install \`\`\` 2. **Setup environment**: \`\`\`bash cp .env.example .env # Edit .env with your configuration \`\`\` 3. **Initialize database and directories**: \`\`\`bash npm run setup \`\`\` 4. **Install VS Code extension** (optional): \`\`\`bash cd vscode-extension npm install npm run compile # Install in VS Code via F5 (debug mode) \`\`\` 5. **Start the server**: \`\`\`bash npm start \`\`\` 6. **Open the UI**: Navigate to http://localhost:3000 ## Voice Commands - "Take a screenshot" - Capture current screen - "Start recording" - Begin screen recording - "Review this code" - Analyze current selection - "Find similar code" - Search for patterns - "Explain this function" - Get code explanation - "Show media history" - View captured media ## Architecture \`\`\` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Web UI โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ Voice Server โ”‚โ”€โ”€โ”€โ”€โ–ถโ”‚ SCS-MCP โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ”‚ โ–ผ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ SQLite DB โ”‚ โ”‚ Code Search โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚ โ–ผ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Media Storageโ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ \`\`\` ## API Endpoints ### REST API - \`GET /health\` - Server health check - \`POST /api/voice\` - Process voice command - \`POST /api/screenshot\` - Capture screenshot - \`POST /api/recording/start\` - Start recording - \`POST /api/recording/stop\` - Stop recording - \`GET /api/media\` - Get media history - \`POST /api/export\` - Export media ### WebSocket Events - \`voice\` - Voice command input - \`context\` - Editor context update - \`screenshot\` - Screenshot request - \`recording\` - Recording control - \`media_history\` - Media updates ## Configuration ### Environment Variables See \`.env.example\` for all available options. ### VS Code Settings Add to your VS Code settings.json: \`\`\`json { "voiceAssistant.autoConnect": true, "voiceAssistant.serverUrl": "ws://localhost:3001" } \`\`\` ## Media Storage Media files are stored in: - \`media/screenshots/\` - Screenshot images - \`media/recordings/\` - Video recordings - \`media/browser/\` - Browser captures - \`media/thumbnails/\` - Generated thumbnails Database: \`data/media-history.db\` ## Development ### Run in development mode: \`\`\`bash npm run dev \`\`\` ### Test MCP connection: \`\`\`bash npm test \`\`\` ### Clean up old media: \`\`\`bash node cleanup.js \`\`\` ## Troubleshooting ### Voice recognition not working - Check browser permissions for microphone - Ensure HTTPS or localhost connection - Try Chrome/Edge for best compatibility ### Screenshots not capturing - Check desktop permissions - Verify screenshot tool installation - Try browser-based capture as fallback ### MCP connection issues - Verify SCS-MCP is properly installed - Check PROJECT_ROOT in .env - Review server logs for errors ## License MIT ## Contributing Pull requests welcome! Please read CONTRIBUTING.md first. ## Support - Issues: [GitHub Issues](https://github.com/your-repo/issues) - Docs: [Documentation](https://your-docs-site.com) `; } // Run setup if executed directly if (require.main === module) { setupMediaDirectories().catch(error => { console.error('โŒ Setup failed:', error); process.exit(1); }); } module.exports = { setupMediaDirectories };

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/stevenjjobson/scs-mcp'

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