npmplus-mcp-server
Version:
Production-ready MCP server for intelligent JavaScript package management. Works with Claude, Windsurf, Cursor, VS Code, and any MCP-compatible AI editor.
52 lines (48 loc) • 1.3 kB
JavaScript
// Health check endpoint for Netlify
exports.handler = async (event, context) => {
const headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'Content-Type, Authorization',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
'Content-Type': 'application/json'
};
if (event.httpMethod === 'OPTIONS') {
return { statusCode: 200, headers };
}
if (event.httpMethod !== 'GET') {
return {
statusCode: 405,
headers,
body: JSON.stringify({ error: 'Method not allowed' })
};
}
try {
return {
statusCode: 200,
headers,
body: JSON.stringify({
status: 'healthy',
service: 'npmplus-mcp',
timestamp: new Date().toISOString(),
version: '1.0.0',
endpoints: {
mcp: '/.netlify/functions/npmplus-mcp',
health: '/.netlify/functions/npmplus-health',
analytics: '/.netlify/functions/npmplus-analytics'
}
})
};
} catch (error) {
console.error('Health check error:', error);
return {
statusCode: 500,
headers,
body: JSON.stringify({
status: 'error',
service: 'npmplus-mcp',
timestamp: new Date().toISOString(),
error: error.message
})
};
}
};