Skip to main content
Glama
fetchSERP

FetchSERP MCP Server

Official
by fetchSERP

get_webpage_seo_analysis

Analyze the SEO performance of any webpage to identify optimization opportunities and improve search engine visibility. Input the URL to receive actionable insights.

Instructions

Get SEO analysis for a given url

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYesThe url to analyze

Implementation Reference

  • The handler function for the 'get_webpage_seo_analysis' tool. It calls the shared makeRequest method to perform a GET request to the FetchSERP API endpoint '/api/v1/web_page_seo_analysis' with the tool arguments.
    case 'get_webpage_seo_analysis':
      return await this.makeRequest('/api/v1/web_page_seo_analysis', 'GET', args, null, token);
  • index.js:522-535 (registration)
    Registration of the 'get_webpage_seo_analysis' tool in the listTools response, including its name, description, and input schema.
    {
      name: 'get_webpage_seo_analysis',
      description: 'Get SEO analysis for a given url',
      inputSchema: {
        type: 'object',
        properties: {
          url: {
            type: 'string',
            description: 'The url to analyze',
          },
        },
        required: ['url'],
      },
    },
  • Input schema definition for the 'get_webpage_seo_analysis' tool, specifying the required 'url' parameter.
    inputSchema: {
      type: 'object',
      properties: {
        url: {
          type: 'string',
          description: 'The url to analyze',
        },
      },
      required: ['url'],
    },
  • Shared helper method 'makeRequest' used by all tools, including 'get_webpage_seo_analysis', to make authenticated HTTP requests to the FetchSERP API.
    async makeRequest(endpoint, method = 'GET', params = {}, body = null, token = null) {
      const fetchserpToken = token || process.env.FETCHSERP_API_TOKEN;
      
      if (!fetchserpToken) {
        throw new McpError(
          ErrorCode.InvalidRequest,
          'FETCHSERP_API_TOKEN is required'
        );
      }
    
      const url = new URL(`${API_BASE_URL}${endpoint}`);
      
      // Add query parameters for GET requests
      if (method === 'GET' && Object.keys(params).length > 0) {
        Object.entries(params).forEach(([key, value]) => {
          if (value !== undefined && value !== null) {
            if (Array.isArray(value)) {
              value.forEach(v => url.searchParams.append(`${key}[]`, v));
            } else {
              url.searchParams.append(key, value.toString());
            }
          }
        });
      }
    
      const fetchOptions = {
        method,
        headers: {
          'Authorization': `Bearer ${fetchserpToken}`,
          'Content-Type': 'application/json',
        },
      };
    
      if (body && method !== 'GET') {
        fetchOptions.body = JSON.stringify(body);
      }
    
      const response = await fetch(url.toString(), fetchOptions);
      
      if (!response.ok) {
        const errorText = await response.text();
        throw new McpError(
          ErrorCode.InternalError,
          `API request failed: ${response.status} ${response.statusText} - ${errorText}`
        );
      }
    
      return await response.json();
    }

Latest Blog Posts

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/fetchSERP/fetchserp-mcp-server-node'

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