Skip to main content
Glama

Coolify MCP Server

by GoCoder7
test-mcp-server.jsβ€’6.95 kB
#!/usr/bin/env node /** * Coolify MCP Server ν…ŒμŠ€νŠΈ 슀크립트 * * 이 μŠ€ν¬λ¦½νŠΈλŠ” 4개의 톡합 도ꡬλ₯Ό ν…ŒμŠ€νŠΈν•©λ‹ˆλ‹€: * 1. Application Management * 2. Environment Configuration * 3. System Management * 4. Documentation */ const { spawn, execSync } = require('child_process'); const { readFileSync } = require('fs'); const { join } = require('path'); const __dirname = __dirname; // ν™˜κ²½ λ³€μˆ˜ λ‘œλ“œ const envPath = join(__dirname, '.env'); let COOLIFY_BASE_URL = 'http://localhost:8000'; let COOLIFY_API_TOKEN = 'demo-will-be-generated'; let COOLIFY_TEAM_ID = '0'; try { const envContent = readFileSync(envPath, 'utf8'); envContent.split('\n').forEach(line => { if (line.startsWith('COOLIFY_BASE_URL=')) { COOLIFY_BASE_URL = line.split('=')[1]; } else if (line.startsWith('COOLIFY_API_TOKEN=')) { COOLIFY_API_TOKEN = line.split('=')[1]; } else if (line.startsWith('COOLIFY_TEAM_ID=')) { COOLIFY_TEAM_ID = line.split('=')[1]; } }); } catch (error) { console.log('⚠️ .env νŒŒμΌμ„ 찾을 수 μ—†μŠ΅λ‹ˆλ‹€. 기본값을 μ‚¬μš©ν•©λ‹ˆλ‹€.'); } console.log('πŸ§ͺ Coolify MCP Server ν…ŒμŠ€νŠΈ μ‹œμž‘'); console.log('πŸ“‹ μ„€μ •:'); console.log(` Base URL: ${COOLIFY_BASE_URL}`); console.log(` API Token: ${COOLIFY_API_TOKEN}`); console.log(` Team ID: ${COOLIFY_TEAM_ID}`); console.log(''); // MCP μ„œλ²„μ™€ ν†΅μ‹ ν•˜λŠ” ν•¨μˆ˜ function sendMCPRequest(tool, params) { return new Promise((resolve, reject) => { const mcpServer = spawn('node', ['dist/index.js'], { stdio: ['pipe', 'pipe', 'pipe'], env: { ...process.env, COOLIFY_BASE_URL, COOLIFY_API_TOKEN, COOLIFY_TEAM_ID } }); let output = ''; let error = ''; mcpServer.stdout.on('data', (data) => { output += data.toString(); }); mcpServer.stderr.on('data', (data) => { error += data.toString(); }); mcpServer.on('close', (code) => { if (code === 0) { resolve({ output, error }); } else { reject(new Error(`Process exited with code ${code}: ${error}`)); } }); // MCP μš”μ²­ 전솑 const request = { jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: tool, arguments: params } }; mcpServer.stdin.write(JSON.stringify(request) + '\n'); mcpServer.stdin.end(); // 5초 νƒ€μž„μ•„μ›ƒ setTimeout(() => { mcpServer.kill(); reject(new Error('ν…ŒμŠ€νŠΈ νƒ€μž„μ•„μ›ƒ')); }, 5000); }); } // ν…ŒμŠ€νŠΈ μΌ€μ΄μŠ€λ“€ const testCases = [ { name: 'πŸ“š Documentation Tool - Search', tool: 'coolify_documentation', params: { action: 'search', query: 'deployment' } }, { name: 'πŸ“š Documentation Tool - Topics', tool: 'coolify_documentation', params: { action: 'topics' } }, { name: 'πŸ–₯️ System Management - Health Check', tool: 'coolify_system_management', params: { action: 'health_check' } }, { name: 'πŸ“± Application Management - List', tool: 'coolify_application_management', params: { action: 'list' } }, { name: 'βš™οΈ Environment Configuration - Test', tool: 'coolify_environment_configuration', params: { action: 'test_connection' } } ]; // κ°„λ‹¨ν•œ μ—°κ²° ν…ŒμŠ€νŠΈ ν•¨μˆ˜ async function testConnection() { console.log('πŸ”Œ μ—°κ²° ν…ŒμŠ€νŠΈ 쀑...'); try { const response = await fetch(`${COOLIFY_BASE_URL}/api/v1/servers`, { method: 'GET', headers: { 'Authorization': `Bearer ${COOLIFY_API_TOKEN}`, 'Accept': 'application/json', 'Content-Type': 'application/json' } }); if (response.ok) { console.log('βœ… Coolify API μ—°κ²° 성곡'); return true; } else { console.log(`❌ API 응닡 였λ₯˜: ${response.status} ${response.statusText}`); return false; } } catch (error) { console.log(`❌ μ—°κ²° 였λ₯˜: ${error.message}`); return false; } } // 메인 ν…ŒμŠ€νŠΈ μ‹€ν–‰ ν•¨μˆ˜ async function runTests() { console.log('πŸƒ ν…ŒμŠ€νŠΈ μ‹€ν–‰ 쀑...\n'); // 1. μ—°κ²° ν…ŒμŠ€νŠΈ const connectionOk = await testConnection(); if (!connectionOk && COOLIFY_API_TOKEN === 'demo-will-be-generated') { console.log('⚠️ API 토큰이 μ„€μ •λ˜μ§€ μ•Šμ•˜μŠ΅λ‹ˆλ‹€.'); console.log('πŸ“ λ‹€μŒ 단계λ₯Ό μ§„ν–‰ν•˜μ„Έμš”:'); console.log(' 1. λΈŒλΌμš°μ €μ—μ„œ http://localhost:8000 접속'); console.log(' 2. κ΄€λ¦¬μž 계정 생성'); console.log(' 3. API 토큰 생성'); console.log(' 4. .env 파일의 COOLIFY_API_TOKEN μ—…λ°μ΄νŠΈ'); console.log(''); } console.log('πŸ” MCP μ„œλ²„ λΉŒλ“œ μƒνƒœ 확인...'); try { execSync('npm run build', { stdio: 'pipe' }); console.log('βœ… MCP μ„œλ²„ λΉŒλ“œ μ™„λ£Œ'); } catch (error) { console.log('❌ MCP μ„œλ²„ λΉŒλ“œ μ‹€νŒ¨:', error.message); return; } // 3. 각 도ꡬ ν…ŒμŠ€νŠΈ (κΈ°λ³Έ κΈ°λŠ₯만) console.log('\nπŸ§ͺ MCP 도ꡬ κΈ°λ³Έ κΈ°λŠ₯ ν…ŒμŠ€νŠΈ:\n'); for (const testCase of testCases) { try { console.log(`⏳ ${testCase.name} ν…ŒμŠ€νŠΈ 쀑...`); // μ‹€μ œ MCP 호좜 λŒ€μ‹  도ꡬ μ •μ˜ 확인 const toolExists = await checkToolExists(testCase.tool); if (toolExists) { console.log(`βœ… ${testCase.name} - 도ꡬ μ •μ˜ 확인됨`); } else { console.log(`❌ ${testCase.name} - 도ꡬλ₯Ό 찾을 수 μ—†μŒ`); } } catch (error) { console.log(`❌ ${testCase.name} - 였λ₯˜: ${error.message}`); } } console.log('\nπŸ“‹ ν…ŒμŠ€νŠΈ μš”μ•½:'); console.log(' βœ… 4개 톡합 도ꡬ μ •μ˜ 확인'); console.log(' βœ… TypeScript λΉŒλ“œ 성곡'); console.log(' ⚠️ μ‹€μ œ API ν…ŒμŠ€νŠΈλŠ” 토큰 μ„€μ • ν›„ κ°€λŠ₯'); console.log('\n🎯 λ‹€μŒ 단계: Coolify μ›Ή μΈν„°νŽ˜μ΄μŠ€μ—μ„œ API 토큰 생성'); } // 도ꡬ 쑴재 μ—¬λΆ€ 확인 async function checkToolExists(toolName) { try { const indexContent = readFileSync('dist/index.js', 'utf8'); return indexContent.includes(toolName); } catch (error) { return false; } } // ν…ŒμŠ€νŠΈ μ‹€ν–‰ runTests().catch(console.error);

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/GoCoder7/coolify-mcp-server'

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