Install mcp-server-gsc
masterInstall the Google Search Console MCP server via npm to use it with MCP-compatible clients.
npm install mcp-server-gscrepository·master·Indexed 42 days ago
https://github.com/ahonn/mcp-server-gscA Model Context Protocol (MCP) server providing AI assistants with access to Google Search Console performance data. Version 0.3.0 features include a 25K row limit, regex filters, URL index inspection, sitemap management, and automatic 'Quick Wins' detection to identify SEO optimization opportunities.
Install the Google Search Console MCP server via npm to use it with MCP-compatible clients.
npm install mcp-server-gscTo use this server, you must set up a Google Cloud Project and a Service Account with access to your Search Console properties.
name@project.iam.gserviceaccount.com) as a Property Administrator.The enhanced_search_analytics tool allows for more complex queries than the standard search_analytics tool. It supports:
page, query, country, or device.Note that country and device filters use an equals operator, while page and query filters can use a user-provided filterOperator (e.g., for regex).
Add the following configuration to your Claude Desktop configuration file to enable the gsc MCP server. Ensure the GOOGLE_APPLICATION_CREDENTIALS environment variable points to the absolute path of your downloaded JSON credentials file.
{
"mcpServers": {
"gsc": {
"command": "npx",
"args": ["-y", "mcp-server-gsc"],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/credentials.json"
}
}
}
}The EnhancedSearchAnalyticsSchema allows you to automatically detect 'Quick Wins'—SEO opportunities where small changes could yield significant traffic.
To use this, set enableQuickWins: true. You can optionally customize the detection thresholds using quickWinsThresholds.
minImpressions: Minimum impressions threshold (default: 50).maxCtr: Maximum CTR percentage (default: 2.0).positionRangeMin: Minimum position (default: 4).positionRangeMax: Maximum position (default: 10).estimatedClickValue: Estimated value per click for ROI (default: 1.0).conversionRate: Estimated conversion rate for ROI (default: 0.03).{
"siteUrl": "http://www.example.com/",
"startDate": "2023-01-01",
"endDate": "2023-01-31",
"enableQuickWins": true,
"quickWinsThresholds": {
"minImpressions": 100,
"maxCtr": 1.5,
"positionRangeMin": 3,
"positionRangeMax": 8
}
}The detect_quick_wins tool automates the process of finding SEO 'low-hanging fruit'. It performs a comprehensive analysis by fetching up to 25,000 rows of search data and then applying thresholds to identify queries or pages that are performing well but have room for improvement.
It uses the following thresholds for detection:
minImpressions: Minimum impressions required.maxCtr: Maximum Click-Through Rate (CTR) to target.positionRangeMin: Minimum search position.positionRangeMax: Maximum search position.The tool returns a JSON object containing the list of quickWins, the totalOpportunities count, and the applied thresholds.
The server is designed to run as a Node.js executable using stdio transport. To run the server, you must provide a path to your Google Service Account credentials via the GOOGLE_APPLICATION_CREDENTIALS environment variable. The server will then start and listen for requests over standard input/output.
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-file.json"
node path/to/mcp-server-gsc/dist/index.jsBelow are advanced usage patterns for the search_analytics tool, including regex filtering and Quick Wins detection.
// Advanced Filtering with Regex
{
"siteUrl": "https://example.com",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": "page,query",
"queryFilter": "regex:(AI|machine learning|ML)",
"filterOperator": "includingRegex",
"deviceFilter": "MOBILE",
"rowLimit": 10000
}
// Quick Wins Detection
{
"siteUrl": "https://example.com",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": "query,page",
"detectQuickWins": true,
"quickWinsConfig": {
"positionRange": [4, 15],
"minImpressions": 500,
"minCtr": 2
}
}The search_analytics tool retrieves performance data from Google Search Console. It supports advanced filtering, regex, and automatic 'Quick Wins' detection.
siteUrl: Site URL (e.g., http://www.example.com/ or sc-domain:example.com)startDate: Start date (YYYY-MM-DD)endDate: End date (YYYY-MM-DD)dimensions: Comma-separated list: query, page, country, device, searchAppearance, datetype: Search type: web, image, video, news, discover, googleNewsaggregationType: auto, byNewsShowcasePanel, byProperty, byPagerowLimit: Max rows (default: 1000, max: 25000)dataState: all or final (default: final)pageFilter: URL filter (use regex: prefix for regex)queryFilter: Query filter (use regex: prefix for regex)countryFilter: ISO 3166-1 alpha-3 code (e.g., USA, CHN)deviceFilter: DESKTOP, MOBILE, TABLETsearchAppearanceFilter: e.g., AMP_BLUE_LINK, AMP_TOP_STORIESfilterOperator: equals, contains, notEquals, notContains, includingRegex, excludingRegexEnable detectQuickWins: true to automatically identify optimization opportunities. You can configure this via quickWinsConfig:
positionRange: Position range to consider (default: [4, 20])minImpressions: Minimum impressions threshold (default: 100)minCtr: Minimum CTR percentage (default: 1){
"siteUrl": "https://example.com",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": "query,page",
"rowLimit": 5000
}GOOGLE_APPLICATION_CREDENTIALS environment variable to be set. This variable must contain the absolute file path to a valid Google Service Account JSON key file. If this variable is missing, the server will exit with an error: GOOGLE_APPLICATION_CREDENTIALS environment variable is required.The createServer function is the primary entrypoint for initializing a Google Search Console MCP server. It requires a credentials string (typically a service account key or authentication token) to initialize the SearchConsoleService. The returned Server instance provides access to various Google Search Console tools via the Model Context Protocol.
import { createServer } from './src/server.js';
const credentials = 'YOUR_GOOGLE_SEARCH_CONSOLE_CREDENTIALS';
const server = createServer(credentials);
// The server instance can now be used with an MCP transport (e.g., Stdio)import { createServer } from './src/server.js';
const credentials = 'YOUR_GOOGLE_SEARCH_CONSOLE_CREDENTIALS';
const server = createServer(credentials);The service provides methods to manage sitemaps for a site. Like searchAnalytics, these methods automatically attempt to normalize the siteUrl to a sc-domain: format if a permission error occurs.
listSitemaps(requestBody): Lists sitemaps for a site.getSitemap(requestBody): Retrieves a specific sitemap.submitSitemap(requestBody): Submits a new sitemap.All methods accept request bodies conforming to the webmasters_v3 API types.
// List sitemaps
const sitemaps = await service.listSitemaps({ siteUrl: 'https://example.com/' });
// Submit a sitemap
await service.submitSitemap({
siteUrl: 'https://example.com/',
feedpath: '/sitemap.xml'
});