#!/usr/bin/env node
import { chromium } from 'playwright';
import fs from 'fs';
import path from 'path';
const screenshotsDir = './screenshots';
if (!fs.existsSync(screenshotsDir)) {
fs.mkdirSync(screenshotsDir, { recursive: true });
}
async function deployToSmitery() {
console.log('š Starting Smithery.ai deployment...');
const browser = await chromium.launch({
headless: false,
slowMo: 1000,
args: ['--no-sandbox', '--disable-setuid-sandbox']
});
const context = await browser.newContext();
const page = await context.newPage();
try {
// Navigate to Smithery.ai deployment page
console.log('š Navigating to Smithery.ai deployment page...');
await page.goto('https://smithery.ai/new', {
waitUntil: 'networkidle',
timeout: 60000
});
await page.waitForTimeout(5000);
await page.screenshot({ path: path.join(screenshotsDir, 'deployment_page_initial.png') });
// Click "Continue with GitHub" button
console.log('š Clicking "Continue with GitHub"...');
await page.click('button:has-text("Continue with GitHub")');
// Wait for GitHub OAuth (this will open GitHub login)
console.log('ā³ Waiting for GitHub authentication...');
await page.waitForTimeout(30000); // Wait 30 seconds for manual auth
// Take screenshot after auth
await page.screenshot({ path: path.join(screenshotsDir, 'after_auth.png') });
// Deploy function
async function deployRepo(repoName, attempt = 1) {
console.log(`š Deploying ${repoName} (attempt ${attempt})...`);
try {
// Navigate to fresh deployment page
await page.goto('https://smithery.ai/new', {
waitUntil: 'networkidle',
timeout: 30000
});
await page.waitForTimeout(3000);
// Wait for the page to load completely
await page.waitForSelector('input', { timeout: 10000 });
// Find and fill the repository input
const repoInput = await page.locator('input[type="text"]').first();
await repoInput.fill(`samihalawa/${repoName}`);
console.log(`š Entered repository: samihalawa/${repoName}`);
await page.waitForTimeout(2000);
// Look for deploy button - try multiple approaches
let deployButton = null;
// Try different selectors for deploy button
const deploySelectors = [
'button:has-text("Deploy")',
'button:has-text("Deploy Server")',
'button[type="submit"]',
'button:has-text("Create")',
'input[type="submit"]'
];
for (const selector of deploySelectors) {
try {
deployButton = await page.waitForSelector(selector, { timeout: 3000 });
if (deployButton) {
console.log(`ā
Found deploy button: ${selector}`);
break;
}
} catch (error) {
// Continue trying other selectors
}
}
if (!deployButton) {
// Try pressing Enter key as alternative
console.log('š Trying Enter key as alternative...');
await page.keyboard.press('Enter');
} else {
await deployButton.click();
console.log('ā
Deploy button clicked');
}
// Wait for deployment to process
await page.waitForTimeout(10000);
// Take screenshot of result
await page.screenshot({ path: path.join(screenshotsDir, `${repoName}_deployment_result.png`) });
return true;
} catch (error) {
console.log(`ā Error deploying ${repoName}:`, error.message);
await page.screenshot({ path: path.join(screenshotsDir, `${repoName}_error.png`) });
return false;
}
}
// Deploy both repositories
const wuolahResult = await deployRepo('wuolah-mcp');
await page.waitForTimeout(3000);
const huggingfaceResult = await deployRepo('huggingface-mcp');
await page.waitForTimeout(3000);
// Verify deployments
console.log('š Verifying deployments...');
const verificationResults = [];
const repos = [
{ name: 'wuolah-mcp', url: 'https://smithery.ai/server/@samihalawa/wuolah-mcp' },
{ name: 'huggingface-mcp', url: 'https://smithery.ai/server/@samihalawa/huggingface-mcp' }
];
for (const repo of repos) {
console.log(`š Checking ${repo.name}...`);
try {
const response = await page.goto(repo.url, { timeout: 30000 });
await page.waitForTimeout(3000);
const isSuccess = response.status() === 200;
await page.screenshot({ path: path.join(screenshotsDir, `${repo.name}_verification.png`) });
verificationResults.push({
name: repo.name,
url: repo.url,
status: isSuccess ? 'SUCCESS' : 'FAILED',
statusCode: response.status()
});
console.log(`${isSuccess ? 'ā
' : 'ā'} ${repo.name}: ${response.status()}`);
} catch (error) {
console.log(`ā Error verifying ${repo.name}:`, error.message);
verificationResults.push({
name: repo.name,
url: repo.url,
status: 'ERROR',
error: error.message
});
}
}
// Generate final report
const report = {
timestamp: new Date().toISOString(),
deployments: verificationResults,
summary: {
wuolah_deployed: wuolahResult,
huggingface_deployed: huggingfaceResult,
total_verified: verificationResults.filter(r => r.status === 'SUCCESS').length,
total_failed: verificationResults.filter(r => r.status !== 'SUCCESS').length
}
};
fs.writeFileSync('./smithery_deployment_final_report.json', JSON.stringify(report, null, 2));
console.log('\\nš DEPLOYMENT COMPLETE!');
console.log('======================');
console.log(`wuolah-mcp: ${wuolahResult ? 'DEPLOYED' : 'FAILED'}`);
console.log(`huggingface-mcp: ${huggingfaceResult ? 'DEPLOYED' : 'FAILED'}`);
console.log('\\nVerification Results:');
verificationResults.forEach(result => {
console.log(`- ${result.name}: ${result.status} (${result.statusCode || 'N/A'})`);
console.log(` URL: ${result.url}`);
});
console.log('\\nš Full report saved to: smithery_deployment_final_report.json');
} catch (error) {
console.error('š„ Deployment failed:', error);
await page.screenshot({ path: path.join(screenshotsDir, 'deployment_error.png') });
} finally {
console.log('\\nā³ Keeping browser open for 30 seconds for manual verification...');
await page.waitForTimeout(30000);
await browser.close();
}
}
deployToSmitery().catch(console.error);