A Model Context Protocol (MCP) server for managing Google Search Console properties, sitemaps, and search analytics.
npm install -g mcp-search-consoleOr use directly via npx:
npx mcp-search-console- A Google Cloud project with the Search Console API enabled
- A service account with appropriate permissions for Search Console
- A credentials.json file for the service account
Specify the path to your Google service account credentials. This can be done in two ways:
Set the GOOGLE_APPLICATION_CREDENTIALS variable:
export GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.jsonCreate a .env file with:
GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
The MCP provides the following Search Console functions:
search_console_api_list_sites– List all sites with access
search_console_api_list_sitemaps– List all sitemaps for a propertysearch_console_api_get_sitemap– Details of a specific sitemap
search_console_api_searchanalytics_query– Retrieve search analytics data- Also supports hourly data (from April 2025) via the
HOURdimension andHOURLY_ALLdataState
- Also supports hourly data (from April 2025) via the
To query hourly data, use the following parameters in your request:
{
"tool": "search_console_api_searchanalytics_query",
"parameters": {
"siteUrl": "https://example.com",
"requestBody": {
"startDate": "2025-04-07",
"endDate": "2025-04-07",
"dataState": "HOURLY_ALL",
"dimensions": ["HOUR"]
}
}
}This returns results with timestamps per hour:
{
"rows": [
{
"keys": ["2025-04-07T00:00:00-07:00"],
"clicks": 17610,
"impressions": 1571473,
"ctr": 0.011206046810858348,
"position": 10.073871456906991
},
{
"keys": ["2025-04-07T01:00:00-07:00"],
"clicks": 18250,
"impressions": 1602341,
"ctr": 0.011389563095440307,
"position": 9.897654321098765
}
// ... more hours
]
}You can also combine the HOUR dimension with other dimensions such as COUNTRY, DEVICE, etc.:
{
"tool": "search_console_api_searchanalytics_query",
"parameters": {
"siteUrl": "https://example.com",
"requestBody": {
"startDate": "2025-04-07",
"endDate": "2025-04-07",
"dataState": "HOURLY_ALL",
"dimensions": ["HOUR", "COUNTRY"]
}
}
}search_console_api_list_crawl_errors– List crawl errorssearch_console_api_get_crawl_error– Details of a specific crawl errorsearch_console_api_mark_crawl_error_fixed– Mark as fixed
search_console_api_mobile_friendly_test– Run a mobile-friendly test on a URL
This MCP works with Claude or other MCP Clients. Create a claude-mcp-config.json with, for example:
{
"mcpServers": {
"google-search-console": {
"command": "npx",
"args": ["mcp-search-console"],
"cwd": "/tmp",
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/credentials.json"
}
}
}
}Replace /path/to/your/credentials.json with the actual path to your Google service account credentials file.
- The
cwdparameter is important - it ensures the MCP runs in a clean directory - No
.envfile is needed when using this configuration with Claude - The
NO_COLORenvironment variable prevents color codes in the output, which can cause JSON parsing errors in Claude - Upload the
claude-mcp-config.jsonfile to Claude when starting a new conversation
ISC