Skip to main content
Glama

SEO AI Assistant

competitorRoutes.js4.34 kB
import express from 'express'; const router = express.Router(); /** * @swagger * /api/competitors/analyze: * get: * summary: Analyze competitors for a given keyword or domain * tags: [Competitors] * parameters: * - in: query * name: keyword * schema: * type: string * description: Keyword to analyze competitors for * - in: query * name: domain * schema: * type: string * description: Domain to analyze competitors for * - in: query * name: limit * schema: * type: integer * description: Maximum number of competitors to return * responses: * 200: * description: Successful operation * content: * application/json: * schema: * type: object * properties: * success: * type: boolean * data: * type: object * 400: * description: Bad request * 500: * description: Server error */ router.get('/analyze', (req, res) => { // This is a placeholder for the competitor analysis functionality const { keyword, domain, limit } = req.query; if (!keyword && !domain) { return res.status(400).json({ error: 'Either keyword or domain is required' }); } const parsedLimit = limit ? parseInt(limit) : 10; // Mock response for now res.status(200).json({ success: true, data: { keyword: keyword || null, domain: domain || null, competitors: [ { domain: 'competitor1.com', title: 'Competitor 1 Website', position: 1, metrics: { domainAuthority: 85, pageAuthority: 76, backlinks: 15000, organicTraffic: 250000 }, content: { wordCount: 2500, headings: 12, images: 8, videos: 1 } }, { domain: 'competitor2.com', title: 'Competitor 2 Website', position: 2, metrics: { domainAuthority: 78, pageAuthority: 72, backlinks: 12000, organicTraffic: 180000 }, content: { wordCount: 1800, headings: 9, images: 6, videos: 0 } } ], count: 2, limit: parsedLimit } }); }); /** * @swagger * /api/competitors/backlinks: * get: * summary: Get backlink data for a competitor domain * tags: [Competitors] * parameters: * - in: query * name: domain * schema: * type: string * required: true * description: Domain to get backlink data for * - in: query * name: limit * schema: * type: integer * description: Maximum number of backlinks to return * responses: * 200: * description: Successful operation * 400: * description: Bad request * 500: * description: Server error */ router.get('/backlinks', (req, res) => { // This is a placeholder for the backlink analysis functionality const { domain, limit } = req.query; if (!domain) { return res.status(400).json({ error: 'Domain is required' }); } const parsedLimit = limit ? parseInt(limit) : 10; // Mock response for now res.status(200).json({ success: true, data: { domain, backlinks: [ { sourceDomain: 'example.com', sourceUrl: 'https://example.com/page1', targetUrl: `https://${domain}/target-page`, anchorText: 'Example anchor text', domainAuthority: 75, pageAuthority: 65, isDoFollow: true }, { sourceDomain: 'another-example.com', sourceUrl: 'https://another-example.com/page2', targetUrl: `https://${domain}/another-target`, anchorText: 'Another anchor text', domainAuthority: 68, pageAuthority: 60, isDoFollow: false } ], count: 2, limit: parsedLimit, totalBacklinks: 15000 } }); }); export default router;

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/ayushsinghvi92/app-seo-ai'

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