Skip to main content
Glama

Hacker News Companion MCP

by georgeck
index.js1.53 kB
#!/usr/bin/env node import { getPostId } from './lib/utils.js'; import { downloadPostComments } from './lib/fetch-comments.js'; import { formatForClaude } from './lib/format-prompt.js'; // Get input from command line arguments const input = process.argv[2]; async function main() { try { if (!input) { console.error('Please provide a Hacker News post ID or URL'); process.exit(1); } const postId = getPostId(input); if (!postId) { console.error('Invalid input. Please provide a valid Hacker News post ID or URL'); process.exit(1); } console.log(`Processing Hacker News post ID: ${postId}`); // Download and process comments const { post, postComments } = await downloadPostComments(postId); console.log(`Downloaded post "${post.title}" with ${postComments.length} comments`); // Format data for Claude const formattedData = formatForClaude(post, postComments); // Output the formatted data console.log('Formatted data for Claude:'); console.log(JSON.stringify(formattedData, null, 2)); console.log('\nTo use this data with Claude, pass the systemPrompt and userPrompt values to Claude.'); } catch (error) { console.error('Error:', error instanceof Error ? error.message : 'Unknown error'); process.exit(1); } } main().catch((error) => { console.error(error); process.exit(1); }); //# sourceMappingURL=index.js.map

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/georgeck/hn-companion-mcp'

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