@pipeworx/mcp-google_search_console 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +59 -0
- package/package.json +20 -0
- package/server.json +18 -0
- package/src/index.ts +149 -0
- package/tsconfig.json +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Pipeworx
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# mcp-google_search_console
|
|
2
|
+
|
|
3
|
+
Google Search Console MCP Pack
|
|
4
|
+
|
|
5
|
+
Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 250+ live data sources.
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `gsc_list_sites` | List the sites (properties) in the connected Search Console account, with the permission level for each. Call this first to get the exact siteUrl other tools need (e.g. "https://example.com/" or "sc-domain:example.com"). |
|
|
12
|
+
| `gsc_search_analytics` | Query Search Console search-performance data: clicks, impressions, CTR, and average position, grouped by dimensions. Use for "top queries/pages last month", organic CTR, ranking trends. siteUrl must be exactly as returned by gsc_list_sites. |
|
|
13
|
+
| `gsc_list_sitemaps` | List the sitemaps submitted for a property, including last download time, warnings/errors, and indexed counts. Use to audit sitemap health. |
|
|
14
|
+
| `gsc_inspect_url` | Inspect a specific URL\'s index status in Google: coverage state, last crawl, canonical, mobile usability, and rich-results status. Use to debug why a page is or isn\'t indexed. |
|
|
15
|
+
|
|
16
|
+
## Quick Start
|
|
17
|
+
|
|
18
|
+
Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"google_search_console": {
|
|
24
|
+
"url": "https://gateway.pipeworx.io/google_search_console/mcp"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or connect to the full Pipeworx gateway for access to all 250+ data sources:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"pipeworx": {
|
|
36
|
+
"url": "https://gateway.pipeworx.io/mcp"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Using with ask_pipeworx
|
|
43
|
+
|
|
44
|
+
Instead of calling tools directly, you can ask questions in plain English:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
ask_pipeworx({ question: "your question about Google_search_console data" })
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The gateway picks the right tool and fills the arguments automatically.
|
|
51
|
+
|
|
52
|
+
## More
|
|
53
|
+
|
|
54
|
+
- [All tools and guides](https://github.com/pipeworx-io/examples)
|
|
55
|
+
- [pipeworx.io](https://pipeworx.io)
|
|
56
|
+
|
|
57
|
+
## License
|
|
58
|
+
|
|
59
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pipeworx/mcp-google_search_console",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Google Search Console MCP Pack",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.ts",
|
|
7
|
+
"types": "src/index.ts",
|
|
8
|
+
"keywords": ["mcp", "mcp-server", "model-context-protocol", "pipeworx", "google_search_console"],
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/pipeworx-io/mcp-google_search_console"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"typecheck": "tsc --noEmit"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"typescript": "^5.7.0"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/server.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
|
|
3
|
+
"name": "io.github.pipeworx-io/google_search_console",
|
|
4
|
+
"title": "Google_search_console",
|
|
5
|
+
"description": "Google Search Console MCP Pack",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"websiteUrl": "https://pipeworx.io/packs/google_search_console",
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/pipeworx-io/mcp-google_search_console",
|
|
10
|
+
"source": "github"
|
|
11
|
+
},
|
|
12
|
+
"remotes": [
|
|
13
|
+
{
|
|
14
|
+
"type": "streamable-http",
|
|
15
|
+
"url": "https://gateway.pipeworx.io/google_search_console/mcp"
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
interface McpToolDefinition {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
inputSchema: {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, unknown>;
|
|
7
|
+
required?: string[];
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface McpToolExport {
|
|
12
|
+
tools: McpToolDefinition[];
|
|
13
|
+
callTool: (name: string, args: Record<string, unknown>) => Promise<unknown>;
|
|
14
|
+
meter?: { credits: number };
|
|
15
|
+
cost?: Record<string, unknown>;
|
|
16
|
+
provider?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Google Search Console MCP Pack
|
|
21
|
+
*
|
|
22
|
+
* SEO and search performance for sites the user owns in Search Console:
|
|
23
|
+
* clicks, impressions, CTR, position, sitemaps, and URL inspection.
|
|
24
|
+
* Requires OAuth connection — gateway injects credentials via
|
|
25
|
+
* _context.google_search_console (scope: webmasters.readonly).
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
interface GscContext {
|
|
30
|
+
google_search_console?: { accessToken: string };
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const API = 'https://www.googleapis.com/webmasters/v3';
|
|
34
|
+
const INSPECT_API = 'https://searchconsole.googleapis.com/v1';
|
|
35
|
+
|
|
36
|
+
async function gscFetch(ctx: GscContext, url: string, options: RequestInit = {}) {
|
|
37
|
+
if (!ctx.google_search_console) {
|
|
38
|
+
return { error: 'connection_required', message: 'Connect your Google Search Console account at https://pipeworx.io/account' };
|
|
39
|
+
}
|
|
40
|
+
const res = await fetch(url, {
|
|
41
|
+
...options,
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Bearer ${ctx.google_search_console.accessToken}`,
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
...(options.headers ?? {}),
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
if (!res.ok) {
|
|
49
|
+
const text = await res.text();
|
|
50
|
+
throw new Error(`Google Search Console API error (${res.status}): ${text.slice(0, 300)}`);
|
|
51
|
+
}
|
|
52
|
+
return res.json();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const tools: McpToolExport['tools'] = [
|
|
56
|
+
{
|
|
57
|
+
name: 'gsc_list_sites',
|
|
58
|
+
description: 'List the sites (properties) in the connected Search Console account, with the permission level for each. Call this first to get the exact siteUrl other tools need (e.g. "https://example.com/" or "sc-domain:example.com").',
|
|
59
|
+
inputSchema: { type: 'object' as const, properties: {}, required: [] },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'gsc_search_analytics',
|
|
63
|
+
description: 'Query Search Console search-performance data: clicks, impressions, CTR, and average position, grouped by dimensions. Use for "top queries/pages last month", organic CTR, ranking trends. siteUrl must be exactly as returned by gsc_list_sites.',
|
|
64
|
+
inputSchema: {
|
|
65
|
+
type: 'object' as const,
|
|
66
|
+
properties: {
|
|
67
|
+
siteUrl: { type: 'string', description: 'The property URL exactly as listed by gsc_list_sites (e.g. "https://example.com/" or "sc-domain:example.com")' },
|
|
68
|
+
startDate: { type: 'string', description: 'Start date, YYYY-MM-DD (inclusive). Search Console data lags ~2-3 days.' },
|
|
69
|
+
endDate: { type: 'string', description: 'End date, YYYY-MM-DD (inclusive)' },
|
|
70
|
+
dimensions: { type: 'array', items: { type: 'string', enum: ['query', 'page', 'country', 'device', 'date', 'searchAppearance'] }, description: 'Group results by these dimensions (e.g. ["query"] for top queries, ["page"] for top pages, ["date"] for a time series). Default: none (totals).' },
|
|
71
|
+
rowLimit: { type: 'number', description: 'Max rows (default 25, max 25000)' },
|
|
72
|
+
searchType: { type: 'string', enum: ['web', 'image', 'video', 'news', 'discover', 'googleNews'], description: 'Search type / data state (default web)' },
|
|
73
|
+
dimensionFilterGroups: { type: 'array', description: 'Optional Search Console dimensionFilterGroups objects to filter rows (e.g. filter query contains "shoes"). Advanced; pass-through to the API.', items: { type: 'object' } },
|
|
74
|
+
},
|
|
75
|
+
required: ['siteUrl', 'startDate', 'endDate'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: 'gsc_list_sitemaps',
|
|
80
|
+
description: 'List the sitemaps submitted for a property, including last download time, warnings/errors, and indexed counts. Use to audit sitemap health.',
|
|
81
|
+
inputSchema: {
|
|
82
|
+
type: 'object' as const,
|
|
83
|
+
properties: {
|
|
84
|
+
siteUrl: { type: 'string', description: 'The property URL exactly as listed by gsc_list_sites' },
|
|
85
|
+
},
|
|
86
|
+
required: ['siteUrl'],
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: 'gsc_inspect_url',
|
|
91
|
+
description: 'Inspect a specific URL\'s index status in Google: coverage state, last crawl, canonical, mobile usability, and rich-results status. Use to debug why a page is or isn\'t indexed.',
|
|
92
|
+
inputSchema: {
|
|
93
|
+
type: 'object' as const,
|
|
94
|
+
properties: {
|
|
95
|
+
siteUrl: { type: 'string', description: 'The property the URL belongs to, exactly as listed by gsc_list_sites' },
|
|
96
|
+
inspectionUrl: { type: 'string', description: 'The fully-qualified URL to inspect (must belong to siteUrl), e.g. "https://example.com/page"' },
|
|
97
|
+
languageCode: { type: 'string', description: 'BCP-47 language for the result (default "en-US")' },
|
|
98
|
+
},
|
|
99
|
+
required: ['siteUrl', 'inspectionUrl'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
async function callTool(name: string, args: Record<string, unknown>): Promise<unknown> {
|
|
105
|
+
const context = (args._context ?? {}) as GscContext;
|
|
106
|
+
delete args._context;
|
|
107
|
+
|
|
108
|
+
switch (name) {
|
|
109
|
+
case 'gsc_list_sites':
|
|
110
|
+
return gscFetch(context, `${API}/sites`);
|
|
111
|
+
|
|
112
|
+
case 'gsc_search_analytics': {
|
|
113
|
+
const { siteUrl, startDate, endDate, dimensions, rowLimit, searchType, dimensionFilterGroups } = args as {
|
|
114
|
+
siteUrl: string; startDate: string; endDate: string; dimensions?: string[];
|
|
115
|
+
rowLimit?: number; searchType?: string; dimensionFilterGroups?: unknown[];
|
|
116
|
+
};
|
|
117
|
+
const body: Record<string, unknown> = {
|
|
118
|
+
startDate,
|
|
119
|
+
endDate,
|
|
120
|
+
rowLimit: Math.min(25000, Math.max(1, rowLimit ?? 25)),
|
|
121
|
+
};
|
|
122
|
+
if (dimensions?.length) body.dimensions = dimensions;
|
|
123
|
+
if (searchType) body.type = searchType;
|
|
124
|
+
if (dimensionFilterGroups?.length) body.dimensionFilterGroups = dimensionFilterGroups;
|
|
125
|
+
return gscFetch(context, `${API}/sites/${encodeURIComponent(siteUrl)}/searchAnalytics/query`, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
body: JSON.stringify(body),
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
case 'gsc_list_sitemaps': {
|
|
132
|
+
const siteUrl = args.siteUrl as string;
|
|
133
|
+
return gscFetch(context, `${API}/sites/${encodeURIComponent(siteUrl)}/sitemaps`);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
case 'gsc_inspect_url': {
|
|
137
|
+
const { siteUrl, inspectionUrl, languageCode } = args as { siteUrl: string; inspectionUrl: string; languageCode?: string };
|
|
138
|
+
return gscFetch(context, `${INSPECT_API}/urlInspection/index:inspect`, {
|
|
139
|
+
method: 'POST',
|
|
140
|
+
body: JSON.stringify({ siteUrl, inspectionUrl, languageCode: languageCode ?? 'en-US' }),
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
default:
|
|
145
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export default { tools, callTool, meter: { credits: 10 }, provider: 'google_search_console' } satisfies McpToolExport;
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"esModuleInterop": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"outDir": "dist",
|
|
10
|
+
"rootDir": "src",
|
|
11
|
+
"declaration": true
|
|
12
|
+
},
|
|
13
|
+
"include": ["src"]
|
|
14
|
+
}
|