Google Search Console MCP Server
A Model Context Protocol (MCP) server for Google Search Console, deployed on Cloudflare Workers. This server provides comprehensive access to Search Console data including property management, search analytics, URL inspection, and sitemap management.
Features
- 22 MCP Tools covering all major Search Console operations
- OAuth 2.0 Authentication with Google for secure access
- Streamable HTTP Transport for efficient data streaming
- Cloudflare Workers deployment for global edge performance
- Type-Safe TypeScript implementation with full type coverage
- Property Management: List, add, delete, and inspect Search Console properties
- Search Analytics: Query performance data with flexible dimensions and filters
- URL Inspection: Check indexing status, crawl info, and rich results for URLs
- Sitemap Management: List, submit, and delete sitemaps
Available Tools
Property Management Tools
list_properties
List all Google Search Console properties you have access to.
Use this tool when:
- User asks about available Search Console properties
- User wants to see all sites they have access to
- Coding agent needs to discover what properties exist
- User asks "what sites are in my Search Console?"
Parameters:
Returns a table with site URLs and permission levels.
get_property_details
Get detailed information about a specific Search Console property.
Use this tool when:
- User asks about a specific property
- User wants to know permission level for a site
- Coding agent needs property metadata
Parameters:
- siteUrl (required): The site URL exactly as it appears in Search Console (e.g., "https://example.com/" or "sc-domain:example.com")
Example:
{
"siteUrl": "https://example.com/"
}
add_property
Add a new site to Google Search Console. Note: You will still need to verify ownership in the Search Console UI.
Use this tool when:
- User wants to add a new site to Search Console
- User asks to register a property
Parameters:
- siteUrl (required): The site URL to add (e.g., "https://example.com/" or "sc-domain:example.com")
Example:
{
"siteUrl": "https://example.com/"
}
delete_property
Remove a site from your Google Search Console. This does not affect your actual website.
Use this tool when:
- User wants to remove a property from Search Console
- User asks to unregister a site
Parameters:
- siteUrl (required): The site URL to remove
Search Analytics Tools
get_search_analytics
Query Google Search Console analytics data. Get clicks, impressions, CTR, and position grouped by dimensions like query, page, device, or country.
Use this tool when:
- User asks about search performance data
- User wants to analyze clicks, impressions, CTR, or position
- User needs data grouped by query, page, device, country, or date
- User asks "how is my site performing in search?"
Parameters:
- siteUrl (required): The site URL
- startDate (optional): Start date in YYYY-MM-DD format (defaults to 28 days ago)
- endDate (optional): End date in YYYY-MM-DD format (defaults to today)
- dimensions (optional): Array of dimensions to group by - ["query", "page", "device", "country", "date", "searchAppearance"] (default: ["query"], max 4 dimensions)
- searchType (optional): Filter by search type - "web", "image", "video", "news", "discover", "googleNews" (default: "web")
- dataState (optional): Data freshness - "all" includes fresh data, "final" only finalized (default: "final")
- aggregationType (optional): How to aggregate - "auto", "byProperty", "byPage" (default: "auto")
- dimensionFilterGroups (optional): Filter groups for advanced filtering
- rowLimit (optional): Maximum rows to return (1-25,000, default: 1000)
- startRow (optional): Zero-based index of first row (default: 0)
Example:
{
"siteUrl": "https://example.com/",
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"dimensions": ["query", "page"],
"rowLimit": 100
}
get_performance_summary
Get a high-level performance summary with total clicks, impressions, average CTR, and average position.
Use this tool when:
- User wants a quick overview of performance
- User asks "how is my site doing overall?"
- User needs summary metrics without detailed breakdown
Parameters:
- siteUrl (required): The site URL
- days (optional): Number of days to look back (1-90, default: 28)
- searchType (optional): Filter by search type
compare_periods
Compare search performance metrics between two different date ranges.
Use this tool when:
- User wants to compare performance between time periods
- User asks "how did this month compare to last month?"
- User needs period-over-period analysis
Parameters:
- siteUrl (required): The site URL
- period1Start (required): Start date of first period (YYYY-MM-DD)
- period1End (required): End date of first period (YYYY-MM-DD)
- period2Start (required): Start date of second period (YYYY-MM-DD)
- period2End (required): End date of second period (YYYY-MM-DD)
- searchType (optional): Filter by search type
get_top_queries
Get the top search queries for a site, sorted by clicks or impressions.
Use this tool when:
- User asks about top performing search queries
- User wants to see what queries drive traffic
- User asks "what are my top search terms?"
Parameters:
- siteUrl (required): The site URL
- days (optional): Number of days to look back (1-90, default: 28)
- limit (optional): Number of queries to return (1-100, default: 25)
- sortBy (optional): Sort by "clicks" or "impressions" (default: "clicks")
get_top_pages
Get the top performing pages for a site.
Use this tool when:
- User asks about top performing pages
- User wants to see which pages get the most search traffic
Parameters:
- siteUrl (required): The site URL
- days (optional): Number of days to look back (1-90, default: 28)
- limit (optional): Number of pages to return (1-100, default: 25)
get_queries_for_page
Get search queries that are driving traffic to a specific page URL.
Use this tool when:
- User asks what queries drive traffic to a specific page
- User wants to see search terms for a particular URL
- User asks "what searches lead to this page?"
Parameters:
- siteUrl (required): The site URL
- pageUrl (required): The specific page URL to analyze
- days (optional): Number of days to look back (1-90, default: 28)
- limit (optional): Number of queries to return (1-100, default: 25)
get_fresh_data
Get fresh (non-finalized) search analytics data. This includes data that may still change as Google processes it.
Use this tool when:
- User wants recent data that may not be finalized
- User needs up-to-the-minute performance data
- User asks about today's or yesterday's data
Parameters:
- siteUrl (required): The site URL
- days (optional): Number of days to look back (1-7, default: 3)
- dimensions (optional): Array of dimensions to group by
URL Inspection Tools
inspect_url
Inspect a URL to get its indexing status, crawl information, mobile usability, and rich results status.
Use this tool when:
- User asks if a URL is indexed
- User wants to check crawl status
- User needs rich results information
- User asks "is this page indexed?"
Parameters:
- siteUrl (required): The site URL
- inspectionUrl (required): The full URL to inspect (must be within the specified site)
- languageCode (optional): Two-letter language code for localized results (default: "en")
Example:
{
"siteUrl": "https://example.com/",
"inspectionUrl": "https://example.com/page"
}
batch_inspect_urls
Inspect multiple URLs in batch. Returns a summary of indexing status for each URL. Limited to 10 URLs per batch.
Use this tool when:
- User wants to check multiple URLs at once
- User asks to inspect several pages
- User needs batch indexing status
Parameters:
- siteUrl (required): The site URL
- urls (required): Array of URLs to inspect (1-10 URLs)
check_indexing_status
Quick check if a URL is indexed in Google Search.
Use this tool when:
- User needs a quick yes/no answer about indexing
- User asks "is this URL indexed?"
Parameters:
- siteUrl (required): The site URL
- url (required): The URL to check
check_indexing_issues
Analyze multiple URLs for indexing issues and categorize problems (robots blocked, canonical issues, fetch errors, etc.).
Use this tool when:
- User wants to find indexing problems across multiple URLs
- User needs categorized issue reports
- User asks "what indexing issues do I have?"
Parameters:
- siteUrl (required): The site URL
- urls (required): Array of URLs to analyze (1-10 URLs)
test_mobile_friendly
Run a Mobile-Friendly Test on a URL to check if it's optimized for mobile devices.
Use this tool when:
- User asks if a page is mobile-friendly
- User wants to test mobile optimization
- User asks "is this page mobile-friendly?"
Parameters:
- url (required): The URL to test for mobile-friendliness
Sitemap Management Tools
list_sitemaps
List all sitemaps submitted for a Search Console property.
Use this tool when:
- User asks about submitted sitemaps
- User wants to see all sitemaps for a property
Parameters:
- siteUrl (required): The site URL
get_sitemap
Get detailed information about a specific sitemap, including URL counts and errors.
Use this tool when:
- User asks about a specific sitemap
- User wants sitemap details and status
Parameters:
- siteUrl (required): The site URL
- feedpath (required): Full URL of the sitemap (e.g., "https://example.com/sitemap.xml")
submit_sitemap
Submit a new sitemap to Google Search Console. Google will periodically fetch and process this sitemap.
Use this tool when:
- User wants to submit a new sitemap
- User asks to add a sitemap to Search Console
Parameters:
- siteUrl (required): The site URL
- feedpath (required): Full URL of the sitemap to submit
delete_sitemap
Remove a sitemap from Google Search Console. This does not delete the sitemap file from your server.
Use this tool when:
- User wants to remove a sitemap from Search Console
- User asks to unsubmit a sitemap
Parameters:
- siteUrl (required): The site URL
- feedpath (required): Full URL of the sitemap to delete
refresh_sitemap
Request Google to re-fetch a sitemap. Useful after making updates to your sitemap.
Use this tool when:
- User wants Google to re-crawl a sitemap
- User has updated a sitemap and wants it refreshed
Parameters:
- siteUrl (required): The site URL
- feedpath (required): Full URL of the sitemap
list_sitemaps_from_index
List child sitemaps from a sitemap index. Use this when you have a sitemap index file that references multiple sitemaps.
Use this tool when:
- User has a sitemap index and wants to see child sitemaps
- User asks about sitemaps in an index
Parameters:
- siteUrl (required): The site URL
- sitemapIndex (required): Full URL of the sitemap index
OAuth Configuration
How It Works
The server uses OAuth 2.0 with Google for authentication. When an MCP client connects, users are redirected to Google to authorize access to their Search Console data.
Setting Up Google OAuth
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Search Console API
- Create OAuth 2.0 credentials (Web application)
- Add authorized redirect URI:
https://gsc.arya.sh/callback (or your domain)
- Set the client ID and secret as Cloudflare secrets
Required Scopes
The server requests the following Google OAuth scope:
https://www.googleapis.com/auth/webmasters - Full access to Search Console data
MCP Client Configuration
Cloudflare AI Playground
Connect directly from the Cloudflare AI Playground:
- Go to https://playground.ai.cloudflare.com/
- Enter your MCP server URL:
https://gsc.arya.sh/mcp
- Authenticate with Google OAuth when prompted
- Start using the tools!
Claude Desktop
Use the mcp-remote proxy to connect:
{
"mcpServers": {
"google-search-console": {
"command": "npx",
"args": [
"mcp-remote",
"https://gsc.arya.sh/mcp"
]
}
}
}
Restart Claude Desktop after updating the configuration.
Other MCP Clients
The server supports the standard MCP HTTP transport. Connect to:
- Endpoint:
https://gsc.arya.sh/mcp
- Transport: Streamable HTTP
- Authentication: OAuth 2.0 (handled automatically)
Architecture
Components
- Cloudflare Worker (src/index.ts): Main entry point, handles HTTP requests and OAuth flow
- Durable Object (src/gsc.app.ts): GscMCP class that manages MCP server instance and tool registration
- Google API Client (src/utils/google-client.ts): Wrapper for @googleapis/searchconsole
- OAuth Helpers (src/utils/google-oauth.ts): Token exchange and refresh logic
- Tools (src/tools/): MCP tool implementations organized by category
- Formatters (src/tools/formatters.ts): Markdown formatting for API responses
Data Flow
- MCP client sends request to
/mcp endpoint
- OAuth provider authenticates the request
- Request routed to GscMCP Durable Object
- Tool handler executes and calls Google Search Console API
- Response formatted as Markdown
- Returned to MCP client
Authentication Flow
- User initiates OAuth via
/authorize endpoint
- User redirected to Google OAuth consent screen
- Google redirects back to
/callback with authorization code
- Server exchanges code for access and refresh tokens
- Tokens stored in Durable Object Props
- OAuth flow completed, user redirected back to MCP client
Token Management
- Access tokens stored in Durable Object Props
- Refresh tokens used to obtain new access tokens when expired
- Automatic token refresh handled by OAuth provider
- Tokens scoped to individual Durable Object instances (per user)
API Rate Limits
Google Search Console API has the following quotas:
- Search Analytics: 1,200 queries per minute per user
- URL Inspection: 600 inspections per minute, 2,000 per day
The server respects these limits and includes rate limit handling in error responses.
References