Skip to main content
Glama

MCP RSS

by ronnycoding
check-recent-articles.js•3.06 kB
#!/usr/bin/env node /** * Quick script to check recent articles in the database * Shows articles from the last 7 days */ require('dotenv').config(); const { DataSource } = require('typeorm'); const AppDataSource = new DataSource({ type: 'postgres', host: process.env.DB_HOST || 'localhost', port: parseInt(process.env.DB_PORT || '5433'), username: process.env.DB_USER || process.env.DB_USERNAME || 'mcp_user', password: process.env.DB_PASSWORD || '123456', database: process.env.DB_NAME || process.env.DB_DATABASE || 'mcp_rss', synchronize: false, logging: false, entities: ['dist/entities/**/*.js'] }); async function checkRecentArticles() { try { await AppDataSource.initialize(); console.log('āœ“ Connected to database\n'); // Calculate date 7 days ago const oneWeekAgo = new Date(); oneWeekAgo.setDate(oneWeekAgo.getDate() - 7); const query = ` SELECT a.id, a.title, a."pubDate", a.status, f.title as "feedTitle", f.category FROM article a LEFT JOIN feed f ON a."feedId" = f.id WHERE a."pubDate" >= $1 ORDER BY a."pubDate" DESC LIMIT 30 `; const articles = await AppDataSource.query(query, [oneWeekAgo.toISOString()]); console.log(`šŸ“° Recent Articles (Last 7 Days)\n`); console.log(`Found ${articles.length} articles published since ${oneWeekAgo.toISOString().split('T')[0]}\n`); console.log('═'.repeat(80) + '\n'); if (articles.length === 0) { console.log('No articles found from the last 7 days.'); console.log('This might mean:'); console.log(' 1. The RSS feeds haven\'t been fetched recently'); console.log(' 2. No new articles were published in the feeds'); console.log(' 3. The cron job might not be running\n'); } else { articles.forEach((article, index) => { const pubDate = new Date(article.pubDate); const daysAgo = Math.floor((Date.now() - pubDate.getTime()) / (1000 * 60 * 60 * 24)); console.log(`${index + 1}. ${article.title}`); console.log(` Source: ${article.feedTitle} | Category: ${article.category}`); console.log(` Published: ${pubDate.toISOString().split('T')[0]} (${daysAgo} days ago)`); console.log(` Status: ${article.status} | ID: ${article.id}`); console.log(''); }); } // Get status breakdown const statusQuery = ` SELECT status, COUNT(*) as count FROM article WHERE "pubDate" >= $1 GROUP BY status ORDER BY count DESC `; const statusBreakdown = await AppDataSource.query(statusQuery, [oneWeekAgo.toISOString()]); console.log('═'.repeat(80)); console.log('\nšŸ“Š Status Breakdown (Last 7 Days):\n'); statusBreakdown.forEach(stat => { console.log(` ${stat.status}: ${stat.count} articles`); }); await AppDataSource.destroy(); } catch (error) { console.error('āŒ Error:', error.message); process.exit(1); } } checkRecentArticles();

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/ronnycoding/my_mcp_rss'

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