seo-gravity-mcp 1.0.0 ā 1.0.2
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/README.md +177 -9
- package/dist/index.js +140 -10
- package/dist/test.js +118 -27
- package/dist/tools/geo.js +36 -0
- package/dist/tools/orchestration.d.ts +29 -0
- package/dist/tools/orchestration.js +302 -0
- package/dist/types/findings.d.ts +224 -0
- package/dist/types/findings.js +1 -0
- package/dist/types/seo.d.ts +15 -0
- package/dist/types/seo.js +1 -1
- package/dist/utils/crawlGraph.d.ts +19 -0
- package/dist/utils/crawlGraph.js +231 -0
- package/dist/utils/findingEngine.d.ts +42 -0
- package/dist/utils/findingEngine.js +271 -0
- package/dist/utils/nlp.js +42 -7
- package/dist/utils/projectScanner.d.ts +4 -0
- package/dist/utils/projectScanner.js +353 -0
- package/dist/utils/snapshotEngine.d.ts +9 -0
- package/dist/utils/snapshotEngine.js +285 -0
- package/package.json +2 -5
package/README.md
CHANGED
|
@@ -1,20 +1,188 @@
|
|
|
1
|
-
# š SEO Gravity MCP
|
|
1
|
+
# š SEO Gravity MCP (v1.0.2)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<div align="center">
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/seo-gravity-mcp)
|
|
6
|
+
[](https://www.npmjs.com/package/seo-gravity-mcp)
|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
**The Universal SEO Intelligence, Source-Code Correlation & Remediation Engine for AI Coding Agents.**
|
|
14
|
+
|
|
15
|
+
[ā” Instant Start](#-instant-start) ⢠[š¤ Client Setup](#-ai-ide--mcp-client-setup) ⢠[š§ 5-Stage Autonomous Loop](#-the-5-stage-autonomous-remediation-loop) ⢠[š Tool Catalog (35 Tools)](#-complete-tool-catalog-35-tools) ⢠[š License](#-license)
|
|
16
|
+
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## š What is SEO Gravity?
|
|
22
|
+
|
|
23
|
+
**SEO Gravity** gives AI coding agents (Antigravity, Cursor, Claude Code, Windsurf, Cline, Roo Code, etc.) the autonomous ability to **understand, audit, fix, and continuously verify the SEO of the websites they build.**
|
|
24
|
+
|
|
25
|
+
Instead of acting as a passive "SEO metrics dump", SEO Gravity connects **rendered web signals** directly to your **source code components** (Next.js App Router, Astro, Vite/React, Remix, SvelteKit), ranks issues by impact-to-effort priority, generates code fix blueprints, and verifies that commits introduce **zero regressions**.
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā
|
|
29
|
+
ā 1. DISCOVER ā āāā¶ ā 2. OBSERVE ā āāā¶ ā 3. DIAGNOSE ā āāā¶ ā 4. FIX ā āāā¶ ā 5. VERIFY ā
|
|
30
|
+
ā Framework ā ā Live/Dev SSR ā ā Root Causes ā ā AI Modifies ā ā Re-crawl & ā
|
|
31
|
+
ā Routes ā ā SERP & Comp. ā ā Prioritized ā ā Source Code ā ā Regression ā
|
|
32
|
+
ā Source Map ā ā Crawl Graph ā ā Action Plan ā ā Components ā ā Diff Check ā
|
|
33
|
+
āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāā
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## š” Key Architectural Pillars
|
|
39
|
+
|
|
40
|
+
1. **Source-to-URL Correlation**: Directly maps audited URLs (`/blog/my-post`) to source files (`app/blog/[slug]/page.tsx`), identifying missing metadata exports or canonical tags.
|
|
41
|
+
2. **Canonical Finding Model**: Every audit issue produces a normalized finding with `id`, `severity`, `confidence` ($0.0-1.0$), `evidenceType` (*Observed*, *Derived*, *Heuristic*, *Predictive*), `effort`, `priorityScore`, and verification steps.
|
|
42
|
+
3. **Crawl Graph & Site Architecture**: Computes BFS click depths, orphan pages, hub pages, circular link loops, and internal link equity (PageRank heuristic).
|
|
43
|
+
4. **Multidimensional Health Scoring**: Breaks scores into 7 discrete dimensions (Technical, Content, Discoverability, Authority, Entity, Performance, AI Readiness) with confidence levels.
|
|
44
|
+
5. **SEO Regression & Snapshot System**: Creates snapshots (`seo.gravity/v1`) before commits/PRs and validates that changes introduced 0 regressions.
|
|
45
|
+
6. **Zero Paid API Requirement**: 100% functional out-of-the-box using local AST parsing, cheerio, JSDOM, Google Autocomplete, and standard web extraction.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## ā” Instant Start
|
|
50
|
+
|
|
51
|
+
Run instantly with `npx`:
|
|
6
52
|
|
|
7
53
|
```bash
|
|
8
|
-
|
|
9
|
-
npm run build
|
|
54
|
+
npx -y seo-gravity-mcp
|
|
10
55
|
```
|
|
11
56
|
|
|
12
|
-
|
|
57
|
+
Or install globally:
|
|
13
58
|
|
|
14
59
|
```bash
|
|
15
|
-
|
|
60
|
+
npm install -g seo-gravity-mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## š¤ AI IDE & MCP Client Setup
|
|
66
|
+
|
|
67
|
+
### 1. š£ Claude Desktop
|
|
68
|
+
Add to `claude_desktop_config.json`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"seo-gravity": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "seo-gravity-mcp"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. ā” Cursor
|
|
82
|
+
Add to `.cursor/mcp.json`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"seo-gravity": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["-y", "seo-gravity-mcp"]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 3. š Antigravity / Windsurf / VS Code Cline
|
|
96
|
+
Add to `mcp_config.json`:
|
|
97
|
+
|
|
98
|
+
```json
|
|
99
|
+
{
|
|
100
|
+
"mcpServers": {
|
|
101
|
+
"seo-gravity": {
|
|
102
|
+
"command": "npx",
|
|
103
|
+
"args": ["-y", "seo-gravity-mcp"]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
16
107
|
```
|
|
17
108
|
|
|
18
|
-
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## š Complete Tool Catalog (35 Tools)
|
|
112
|
+
|
|
113
|
+
### Layer 0: Agent Orchestration & Remediation (Flagship)
|
|
114
|
+
| Tool Name | Operational Class | Description |
|
|
115
|
+
| :--- | :--- | :--- |
|
|
116
|
+
| `seo_project_audit` | **Planning / Audit** | Scans workspace framework, discovers routes, correlates source files, builds crawl graph, and computes multidimensional SEO health. |
|
|
117
|
+
| `seo_diagnose` | **Planning / Diagnose** | Deep root-cause inspection linking an observed issue/URL back to specific source code files with ready-to-use fix blueprints. |
|
|
118
|
+
| `seo_prioritize` | **Planning / Strategy** | Ranks findings into Quick Wins, Critical Blockers, and Architectural Improvements using `(Impact Ć Confidence Ć Reach) / Effort`. |
|
|
119
|
+
| `seo_fix_plan` | **Planning / Execution** | Generates an end-to-end code modification and verification plan for AI coding agents. |
|
|
120
|
+
| `seo_snapshot_create` | **Verification** | Creates and saves a project SEO baseline snapshot adhering to canonical schema `seo.gravity/v1`. |
|
|
121
|
+
| `seo_snapshot_compare` | **Verification** | Diffs two snapshots to compute resolved findings, new regressions, and multidimensional score deltas. |
|
|
122
|
+
| `seo_regression_check` | **Verification / CI** | Automated pass/fail regression check with alert messages for CI/CD gates and PR bots. |
|
|
123
|
+
|
|
124
|
+
### Layer 1: SERP & Competitor Intelligence
|
|
125
|
+
| Tool Name | Description |
|
|
126
|
+
| :--- | :--- |
|
|
127
|
+
| `seo_serp_analyze` | Live Google SERP scraper returning rankings, snippets, People Also Ask (PAA), and SERP features. |
|
|
128
|
+
| `seo_competitor_content_gap` | Compares target page against top 3-5 competitors for missing TF-IDF entities, subtopics, and word count deltas. |
|
|
129
|
+
| `seo_competitor_profile` | Deep extraction of competitor heading tree (H1-H4), schema types, reading grade, and link ratios. |
|
|
130
|
+
| `seo_competitor_diff` | 25-factor side-by-side scorecard comparing your page vs #1 competitor. |
|
|
131
|
+
| `seo_forum_discussions_pulse` | Scrapes Reddit & Quora threads ranking for a query to extract user pain points and consensus. |
|
|
132
|
+
|
|
133
|
+
### Layer 2: Generative Engine Optimization (GEO & AEO)
|
|
134
|
+
| Tool Name | Description |
|
|
135
|
+
| :--- | :--- |
|
|
136
|
+
| `seo_geo_ai_readiness_audit` | Audits content for AI Overviews & Perplexity citation readiness with structured retrieval signals and evidence tiers. |
|
|
137
|
+
| `seo_llms_txt_generate` | Generates standard `/llms.txt` and `/llms-full.txt` markdown context files for AI search bots. |
|
|
138
|
+
| `seo_ai_bots_robots_audit` | Audits robots.txt permissions specifically for AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Google-Extended). |
|
|
139
|
+
|
|
140
|
+
### Layer 3: Information Gain & E-E-A-T
|
|
141
|
+
| Tool Name | Description |
|
|
142
|
+
| :--- | :--- |
|
|
143
|
+
| `seo_information_gain_score` | Quantifies content novelty vs top 10 SERPs to prevent generic AI fluff penalties. |
|
|
144
|
+
| `seo_eeat_audit` | Audits Google E-E-A-T trust signals (Person schema, author bylines, sameAs Wikidata/LinkedIn, publish/modified dates). |
|
|
145
|
+
|
|
146
|
+
### Layer 4: On-Page & Content Strategy
|
|
147
|
+
| Tool Name | Description |
|
|
148
|
+
| :--- | :--- |
|
|
149
|
+
| `seo_onpage_audit` | Deep on-page audit of pixel width, meta CTR, heading hierarchy, image alt, and slug optimization. |
|
|
150
|
+
| `seo_content_brief_generate` | Generates data-backed Content Outline & Brief with target word count, H1/H2/H3 structure, and FAQs. |
|
|
151
|
+
| `seo_readability_score` | Computes Flesch Reading Ease, Flesch-Kincaid Grade Level, and Gunning Fog index. |
|
|
152
|
+
|
|
153
|
+
### Layer 5: Technical SEO & JavaScript Hydration
|
|
154
|
+
| Tool Name | Description |
|
|
155
|
+
| :--- | :--- |
|
|
156
|
+
| `seo_technical_audit` | Inspects HTTP status codes, redirect chains, canonical consistency, meta robots (`noindex` leaks), and SSL. |
|
|
157
|
+
| `seo_js_rendering_diff` | Compares raw server HTML vs hydrated client DOM (JavaScript SEO) to detect client-only content or broken tags. |
|
|
158
|
+
| `seo_robots_txt_validate` | Validates bot crawlability against specific paths and User-Agents. |
|
|
159
|
+
| `seo_sitemap_inspect` | Validates XML sitemaps, sitemap indexes, lastmod timestamps, and URL limit constraints. |
|
|
160
|
+
| `seo_internal_links_analyze` | Analyzes internal link equity distribution, anchor texts, generic anchors, and nofollow flags. |
|
|
161
|
+
|
|
162
|
+
### Layer 6: Keyword Research & Intent
|
|
163
|
+
| Tool Name | Description |
|
|
164
|
+
| :--- | :--- |
|
|
165
|
+
| `seo_keyword_suggestions` | Generates keyword suggestions using Google Autocomplete and Alphabet Soup expansion. |
|
|
166
|
+
| `seo_questions_find` | Finds question queries asked by users across Google (Who, What, Where, When, Why, How, Can). |
|
|
167
|
+
| `seo_keyword_cluster` | Clusters keyword lists into Topic Pillars and Supporting Articles using semantic similarity. |
|
|
168
|
+
| `seo_search_intent_classify` | Classifies keywords into Informational, Navigational, Commercial, or Transactional intent. |
|
|
169
|
+
|
|
170
|
+
### Layer 7: Schema & Entity Graph
|
|
171
|
+
| Tool Name | Description |
|
|
172
|
+
| :--- | :--- |
|
|
173
|
+
| `seo_entity_salience_map` | Extracts named entities, computes salience scores, and generates SPO relationship triples. |
|
|
174
|
+
| `seo_schema_generate` | Generates validated Schema.org JSON-LD scripts (Article, FAQPage, Product, LocalBusiness, Organization). |
|
|
175
|
+
| `seo_schema_validate` | Validates structured data against Schema.org and Google Rich Result criteria. |
|
|
176
|
+
|
|
177
|
+
### Layer 8: Performance & Maintenance
|
|
178
|
+
| Tool Name | Description |
|
|
179
|
+
| :--- | :--- |
|
|
180
|
+
| `seo_pagespeed_audit` | Checks Core Web Vitals (LCP, FCP, CLS, TTFB) with performance optimization fixes. |
|
|
181
|
+
| `seo_indexnow_submit` | Submits newly created or updated URLs directly to Bing & Yandex via the IndexNow API protocol. |
|
|
182
|
+
| `seo_content_decay_audit` | Scans content for freshness decay (stale year references, outdated stats, broken external links). |
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## š License
|
|
19
187
|
|
|
20
|
-
|
|
188
|
+
MIT License. Free for open-source and commercial use.
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,103 @@ import { auditTechnical, diffJsRendering, validateRobotsTxt, inspectSitemap, ana
|
|
|
11
11
|
import { getKeywordSuggestions, findQuestions, clusterKeywords, classifySearchIntent } from './tools/keywords.js';
|
|
12
12
|
import { mapEntitySalience, generateSchemaMarkup, validateSchema } from './tools/schema.js';
|
|
13
13
|
import { auditPageSpeed, submitIndexNow, auditContentDecay } from './tools/performance.js';
|
|
14
|
-
|
|
14
|
+
import { auditProject, diagnoseSeo, prioritizeFindings, generateFixPlan, createSnapshotTool, compareSnapshotsTool, checkRegression } from './tools/orchestration.js';
|
|
15
|
+
// Define the 35 MCP Tools
|
|
15
16
|
const TOOLS = [
|
|
16
|
-
//
|
|
17
|
+
// ==========================================
|
|
18
|
+
// Layer 0. Agent Orchestration & Remediation
|
|
19
|
+
// ==========================================
|
|
20
|
+
{
|
|
21
|
+
name: 'seo_project_audit',
|
|
22
|
+
description: 'Flagship project audit: scans codebase for framework (Next.js, Astro, Vite, Remix), maps discovered routes to source files, builds crawl graph, and computes multidimensional SEO scores (Technical, Content, AI Readiness, Discoverability, Entity).',
|
|
23
|
+
inputSchema: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
project_path: { type: 'string', description: 'Absolute or relative path to project workspace root' },
|
|
27
|
+
base_url: { type: 'string', description: 'Optional live or dev server URL (e.g. "http://localhost:3000")' },
|
|
28
|
+
crawl_depth: { type: 'number', description: 'Crawl depth for internal link graph analysis (default 2)' }
|
|
29
|
+
},
|
|
30
|
+
required: ['project_path']
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: 'seo_diagnose',
|
|
35
|
+
description: 'Deep root-cause diagnostic: correlates an observed SEO issue or URL back to specific source code files, components, and line numbers with actionable code fix blueprints.',
|
|
36
|
+
inputSchema: {
|
|
37
|
+
type: 'object',
|
|
38
|
+
properties: {
|
|
39
|
+
project_path: { type: 'string', description: 'Path to project workspace root' },
|
|
40
|
+
target_url_or_file: { type: 'string', description: 'URL, route path (e.g. "/blog/[slug]"), or file path to diagnose' },
|
|
41
|
+
focus_issue_id: { type: 'string', description: 'Optional specific finding ID (e.g. "SEO-CANONICAL-001")' }
|
|
42
|
+
},
|
|
43
|
+
required: ['project_path', 'target_url_or_file']
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'seo_prioritize',
|
|
48
|
+
description: 'Ranks and groups project SEO findings into actionable sprints (Quick Wins, Critical Blockers, Architectural Improvements) using the (Impact Ć Confidence Ć Reach) / Effort formula.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
project_path: { type: 'string', description: 'Project path or raw findings array' },
|
|
53
|
+
max_count: { type: 'number', description: 'Max items per sprint category (default 20)' }
|
|
54
|
+
},
|
|
55
|
+
required: ['project_path']
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'seo_fix_plan',
|
|
60
|
+
description: 'Generates a structured, step-by-step code modification and verification plan for AI coding agents to remediate project SEO issues.',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
project_path: { type: 'string', description: 'Path to project workspace root' },
|
|
65
|
+
finding_ids: { type: 'array', items: { type: 'string' }, description: 'Optional subset of finding IDs to plan fixes for' }
|
|
66
|
+
},
|
|
67
|
+
required: ['project_path']
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'seo_snapshot_create',
|
|
72
|
+
description: 'Creates a baseline or milestone project SEO snapshot adhering to canonical schema `seo.gravity/v1`, optionally exporting to a JSON file.',
|
|
73
|
+
inputSchema: {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
project_path: { type: 'string', description: 'Path to project workspace root' },
|
|
77
|
+
base_url: { type: 'string', description: 'Optional live or dev server URL' },
|
|
78
|
+
output_path: { type: 'string', description: 'Optional destination file path to save snapshot JSON' }
|
|
79
|
+
},
|
|
80
|
+
required: ['project_path']
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'seo_snapshot_compare',
|
|
85
|
+
description: 'Compares two SEO project snapshots (e.g. baseline vs current) to compute exact resolved issues, new regressions, and multidimensional score deltas.',
|
|
86
|
+
inputSchema: {
|
|
87
|
+
type: 'object',
|
|
88
|
+
properties: {
|
|
89
|
+
baseline_snapshot: { type: 'object', description: 'Baseline ProjectSnapshot object or file path' },
|
|
90
|
+
current_snapshot: { type: 'object', description: 'Current ProjectSnapshot object or file path' }
|
|
91
|
+
},
|
|
92
|
+
required: ['baseline_snapshot', 'current_snapshot']
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'seo_regression_check',
|
|
97
|
+
description: 'Automated CI/PR regression check: compares current project state against a baseline snapshot and returns a pass/fail verdict with regression alerts.',
|
|
98
|
+
inputSchema: {
|
|
99
|
+
type: 'object',
|
|
100
|
+
properties: {
|
|
101
|
+
project_path: { type: 'string', description: 'Path to project workspace root' },
|
|
102
|
+
baseline_snapshot: { type: 'object', description: 'Baseline ProjectSnapshot object or file path' },
|
|
103
|
+
base_url: { type: 'string', description: 'Optional live or dev server URL' }
|
|
104
|
+
},
|
|
105
|
+
required: ['project_path', 'baseline_snapshot']
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
// ==========================================
|
|
109
|
+
// Layer 1. SERP & Competitor Intelligence
|
|
110
|
+
// ==========================================
|
|
17
111
|
{
|
|
18
112
|
name: 'seo_serp_analyze',
|
|
19
113
|
description: 'Scrapes live Google SERP for any keyword. Returns top ranking URLs, snippets, People Also Ask (PAA), Related Searches, and rich SERP features.',
|
|
@@ -76,7 +170,9 @@ const TOOLS = [
|
|
|
76
170
|
required: ['topic_or_keyword']
|
|
77
171
|
}
|
|
78
172
|
},
|
|
79
|
-
//
|
|
173
|
+
// ==========================================
|
|
174
|
+
// Layer 2. GEO & AI Search (AEO)
|
|
175
|
+
// ==========================================
|
|
80
176
|
{
|
|
81
177
|
name: 'seo_geo_ai_readiness_audit',
|
|
82
178
|
description: 'Evaluates content for citation readiness in Google AI Overviews, Perplexity.ai, and ChatGPT Search (checks direct definitions, semantic chunking, tables, and stats).',
|
|
@@ -125,7 +221,9 @@ const TOOLS = [
|
|
|
125
221
|
required: ['domain_or_url']
|
|
126
222
|
}
|
|
127
223
|
},
|
|
128
|
-
//
|
|
224
|
+
// ==========================================
|
|
225
|
+
// Layer 3. Information Gain & E-E-A-T
|
|
226
|
+
// ==========================================
|
|
129
227
|
{
|
|
130
228
|
name: 'seo_information_gain_score',
|
|
131
229
|
description: 'Quantifies content novelty vs top 10 Google results (Google Information Gain Patent) to detect and fix generic AI fluff.',
|
|
@@ -149,7 +247,9 @@ const TOOLS = [
|
|
|
149
247
|
required: ['url_or_html']
|
|
150
248
|
}
|
|
151
249
|
},
|
|
152
|
-
//
|
|
250
|
+
// ==========================================
|
|
251
|
+
// Layer 4. On-Page & Content Strategy
|
|
252
|
+
// ==========================================
|
|
153
253
|
{
|
|
154
254
|
name: 'seo_onpage_audit',
|
|
155
255
|
description: 'Comprehensive on-page audit of a URL, local file, or raw HTML (title pixel width, meta CTR, heading hierarchy, image alt, and slug).',
|
|
@@ -190,7 +290,9 @@ const TOOLS = [
|
|
|
190
290
|
required: ['text_or_url']
|
|
191
291
|
}
|
|
192
292
|
},
|
|
193
|
-
//
|
|
293
|
+
// ==========================================
|
|
294
|
+
// Layer 5. Technical SEO & JS Hydration
|
|
295
|
+
// ==========================================
|
|
194
296
|
{
|
|
195
297
|
name: 'seo_technical_audit',
|
|
196
298
|
description: 'Inspects HTTP status code, redirect chains, canonical consistency, meta robots (noindex/nofollow), hreflang, SSL, and OpenGraph tags.',
|
|
@@ -248,7 +350,9 @@ const TOOLS = [
|
|
|
248
350
|
required: ['url']
|
|
249
351
|
}
|
|
250
352
|
},
|
|
251
|
-
//
|
|
353
|
+
// ==========================================
|
|
354
|
+
// Layer 6. Keyword Research & Intent
|
|
355
|
+
// ==========================================
|
|
252
356
|
{
|
|
253
357
|
name: 'seo_keyword_suggestions',
|
|
254
358
|
description: 'Extracts keyword suggestions and long-tail variations using Google Autocomplete and the Alphabet Soup method.',
|
|
@@ -295,7 +399,9 @@ const TOOLS = [
|
|
|
295
399
|
required: ['keywords']
|
|
296
400
|
}
|
|
297
401
|
},
|
|
298
|
-
//
|
|
402
|
+
// ==========================================
|
|
403
|
+
// Layer 7. Schema & Entity Graph
|
|
404
|
+
// ==========================================
|
|
299
405
|
{
|
|
300
406
|
name: 'seo_entity_salience_map',
|
|
301
407
|
description: 'Extracts core entities, computes salience scores, and extracts Subject-Predicate-Object (SPO) relationship triples.',
|
|
@@ -334,7 +440,9 @@ const TOOLS = [
|
|
|
334
440
|
required: ['url_or_jsonld']
|
|
335
441
|
}
|
|
336
442
|
},
|
|
337
|
-
//
|
|
443
|
+
// ==========================================
|
|
444
|
+
// Layer 8. Performance & Maintenance
|
|
445
|
+
// ==========================================
|
|
338
446
|
{
|
|
339
447
|
name: 'seo_pagespeed_audit',
|
|
340
448
|
description: 'Checks Core Web Vitals (LCP, FCP, CLS, TTFB) with performance optimization fixes.',
|
|
@@ -376,7 +484,7 @@ const TOOLS = [
|
|
|
376
484
|
// Initialize Server
|
|
377
485
|
const server = new Server({
|
|
378
486
|
name: 'seo-gravity-mcp',
|
|
379
|
-
version: '1.0.
|
|
487
|
+
version: '1.0.2'
|
|
380
488
|
}, {
|
|
381
489
|
capabilities: {
|
|
382
490
|
tools: {}
|
|
@@ -393,6 +501,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
393
501
|
try {
|
|
394
502
|
let result;
|
|
395
503
|
switch (name) {
|
|
504
|
+
// 0. Agent Orchestration & Remediation
|
|
505
|
+
case 'seo_project_audit':
|
|
506
|
+
result = await auditProject(a.project_path, a.base_url, a.crawl_depth);
|
|
507
|
+
break;
|
|
508
|
+
case 'seo_diagnose':
|
|
509
|
+
result = await diagnoseSeo(a.project_path, a.target_url_or_file, a.focus_issue_id);
|
|
510
|
+
break;
|
|
511
|
+
case 'seo_prioritize':
|
|
512
|
+
result = await prioritizeFindings(a.project_path, a.max_count);
|
|
513
|
+
break;
|
|
514
|
+
case 'seo_fix_plan':
|
|
515
|
+
result = await generateFixPlan(a.project_path, a.finding_ids);
|
|
516
|
+
break;
|
|
517
|
+
case 'seo_snapshot_create':
|
|
518
|
+
result = await createSnapshotTool(a.project_path, a.base_url, a.output_path);
|
|
519
|
+
break;
|
|
520
|
+
case 'seo_snapshot_compare':
|
|
521
|
+
result = await compareSnapshotsTool(a.baseline_snapshot, a.current_snapshot);
|
|
522
|
+
break;
|
|
523
|
+
case 'seo_regression_check':
|
|
524
|
+
result = await checkRegression(a.project_path, a.baseline_snapshot, a.base_url);
|
|
525
|
+
break;
|
|
396
526
|
// 1. SERP & Competitors
|
|
397
527
|
case 'seo_serp_analyze':
|
|
398
528
|
result = await analyzeSerp(a.query, a.country, a.language, a.num_results);
|
package/dist/test.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { fileURLToPath } from 'url';
|
|
3
|
+
// Core Tool Imports
|
|
1
4
|
import { auditOnPage } from './tools/onpage.js';
|
|
2
|
-
import { auditGeoAiReadiness
|
|
5
|
+
import { auditGeoAiReadiness } from './tools/geo.js';
|
|
3
6
|
import { clusterKeywords, classifySearchIntent } from './tools/keywords.js';
|
|
4
7
|
import { generateSchemaMarkup, validateSchema } from './tools/schema.js';
|
|
5
|
-
|
|
8
|
+
// New v1.0.2 Agent Orchestration Imports
|
|
9
|
+
import { auditProject, diagnoseSeo, prioritizeFindings, generateFixPlan, createSnapshotTool, checkRegression } from './tools/orchestration.js';
|
|
10
|
+
import { detectFramework, discoverRoutes, mapUrlToRouteSource } from './utils/projectScanner.js';
|
|
11
|
+
import { CrawlGraphBuilder } from './utils/crawlGraph.js';
|
|
12
|
+
import { calculatePriorityScore } from './utils/findingEngine.js';
|
|
13
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
const __dirname = path.dirname(__filename);
|
|
15
|
+
const FIXTURES_DIR = path.resolve(__dirname, '../test/fixtures');
|
|
6
16
|
async function runTests() {
|
|
7
|
-
console.log('š§Ŗ Starting SEO Gravity MCP Comprehensive Test Suite...\n');
|
|
17
|
+
console.log('š§Ŗ Starting SEO Gravity MCP v1.0.2 Comprehensive Test Suite...\n');
|
|
18
|
+
// -------------------------------------------------------------
|
|
8
19
|
// Test 1: On-Page Audit
|
|
20
|
+
// -------------------------------------------------------------
|
|
9
21
|
console.log('1ļøā£ Testing On-Page Audit...');
|
|
10
22
|
const sampleHtml = `
|
|
11
23
|
<!DOCTYPE html>
|
|
@@ -28,20 +40,18 @@ async function runTests() {
|
|
|
28
40
|
</html>
|
|
29
41
|
`;
|
|
30
42
|
const onpage = await auditOnPage(sampleHtml, 'project management software');
|
|
31
|
-
console.log(
|
|
32
|
-
//
|
|
33
|
-
|
|
43
|
+
console.log(` ā
On-Page Score: ${onpage.overallScore}/100 | Title: ${onpage.titleAudit.status} | H1s: ${onpage.headingsAudit.h1Count}`);
|
|
44
|
+
// -------------------------------------------------------------
|
|
45
|
+
// Test 2: GEO / AEO Readiness with Evidence Tiers
|
|
46
|
+
// -------------------------------------------------------------
|
|
47
|
+
console.log('\n2ļøā£ Testing GEO & AI Search Readiness Audit (with Evidence Tiers)...');
|
|
34
48
|
const geo = await auditGeoAiReadiness(sampleHtml, 'best project management software');
|
|
35
|
-
console.log(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
]);
|
|
42
|
-
console.log(`ā
llms.txt generated (${llms.llmsTxt.length} chars)`);
|
|
43
|
-
// Test 4: Schema Generation & Validation
|
|
44
|
-
console.log('\n4ļøā£ Testing Schema.org JSON-LD Generation & Validation...');
|
|
49
|
+
console.log(` ā
GEO Score: ${geo.overallGeoScore}/100 | Citation: ${geo.citationLikelihood} | Confidence: ${geo.confidence}`);
|
|
50
|
+
console.log(` ā
AI Retrieval Signals: Direct Answer=${geo.aiRetrievalSignals?.directEntityDefinition}, Stats=${geo.aiRetrievalSignals?.factualDataAndStats}`);
|
|
51
|
+
// -------------------------------------------------------------
|
|
52
|
+
// Test 3: Schema Generation & Validation
|
|
53
|
+
// -------------------------------------------------------------
|
|
54
|
+
console.log('\n3ļøā£ Testing Schema.org JSON-LD Generation & Validation...');
|
|
45
55
|
const schema = generateSchemaMarkup('FAQPage', {
|
|
46
56
|
items: [
|
|
47
57
|
{ question: 'What is project management software?', answer: 'It is a platform to coordinate team tasks and roadmaps.' },
|
|
@@ -49,9 +59,11 @@ async function runTests() {
|
|
|
49
59
|
]
|
|
50
60
|
});
|
|
51
61
|
const val = await validateSchema(schema.jsonLdScript.replace(/<script[^>]*>/, '').replace(/<\/script>/, ''));
|
|
52
|
-
console.log(
|
|
53
|
-
//
|
|
54
|
-
|
|
62
|
+
console.log(` ā
Schema Validated (${val.schemasDetectedCount} detected, Valid: ${val.schemas[0]?.isValid})`);
|
|
63
|
+
// -------------------------------------------------------------
|
|
64
|
+
// Test 4: Keyword Clustering & Intent Classification
|
|
65
|
+
// -------------------------------------------------------------
|
|
66
|
+
console.log('\n4ļøā£ Testing Keyword Clustering & Search Intent Classification...');
|
|
55
67
|
const keywords = [
|
|
56
68
|
'best running shoes',
|
|
57
69
|
'buy running shoes online',
|
|
@@ -62,15 +74,94 @@ async function runTests() {
|
|
|
62
74
|
];
|
|
63
75
|
const clusters = clusterKeywords(keywords);
|
|
64
76
|
const intents = classifySearchIntent(keywords);
|
|
65
|
-
console.log(
|
|
66
|
-
console.log(
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
console.log(
|
|
71
|
-
|
|
77
|
+
console.log(` ā
Clustered ${keywords.length} keywords into ${clusters.clusterCount} cluster(s)`);
|
|
78
|
+
console.log(` ā
Intent: "${keywords[1]}" -> ${intents[1].intent} (${(intents[1].confidenceScore * 100).toFixed(0)}%)`);
|
|
79
|
+
// -------------------------------------------------------------
|
|
80
|
+
// Test 5: Priority Scoring Algorithm
|
|
81
|
+
// -------------------------------------------------------------
|
|
82
|
+
console.log('\n5ļøā£ Testing Finding Priority Scoring Algorithm...');
|
|
83
|
+
const p1 = calculatePriorityScore('critical', 1.0, 'trivial', 'site_wide');
|
|
84
|
+
const p2 = calculatePriorityScore('low', 0.8, 'high', 'isolated');
|
|
85
|
+
console.log(` ā
Critical Site-wide Issue Priority: ${p1.priorityScore} (Tier: ${p1.priorityTier})`);
|
|
86
|
+
console.log(` ā
Isolated Low-Severity Issue Priority: ${p2.priorityScore} (Tier: ${p2.priorityTier})`);
|
|
87
|
+
// -------------------------------------------------------------
|
|
88
|
+
// Test 6: Project Framework Detection & Route Discovery
|
|
89
|
+
// -------------------------------------------------------------
|
|
90
|
+
console.log('\n6ļøā£ Testing Framework Scanner & Route Discovery on Fixtures...');
|
|
91
|
+
const nextAppPath = path.join(FIXTURES_DIR, 'nextjs-app');
|
|
92
|
+
const nextFramework = detectFramework(nextAppPath);
|
|
93
|
+
const nextRoutes = discoverRoutes(nextAppPath, nextFramework);
|
|
94
|
+
console.log(` ā
Next.js Fixture: Framework=${nextFramework.framework}, TypeScript=${nextFramework.hasTypeScript}, Sitemap=${nextFramework.hasSitemapConfig}`);
|
|
95
|
+
console.log(` ā
Discovered ${nextRoutes.length} route(s): ${nextRoutes.map(r => r.routePath).join(', ')}`);
|
|
96
|
+
const astroAppPath = path.join(FIXTURES_DIR, 'astro-app');
|
|
97
|
+
const astroFramework = detectFramework(astroAppPath);
|
|
98
|
+
const astroRoutes = discoverRoutes(astroAppPath, astroFramework);
|
|
99
|
+
console.log(` ā
Astro Fixture: Framework=${astroFramework.framework}, Routes=${astroRoutes.map(r => r.routePath).join(', ')}`);
|
|
100
|
+
// -------------------------------------------------------------
|
|
101
|
+
// Test 7: Source-to-URL Mapping
|
|
102
|
+
// -------------------------------------------------------------
|
|
103
|
+
console.log('\n7ļøā£ Testing Source-to-URL Correlation...');
|
|
104
|
+
const map1 = mapUrlToRouteSource('/blog/ai-productivity-2026', nextRoutes);
|
|
105
|
+
const map2 = mapUrlToRouteSource('/about', nextRoutes);
|
|
106
|
+
console.log(` ā
URL '/blog/ai-productivity-2026' mapped to -> ${map1.sourceFilePath} (Method: ${map1.resolutionMethod}, Conf: ${map1.confidence})`);
|
|
107
|
+
console.log(` ā
URL '/about' mapped to -> ${map2.sourceFilePath} (Method: ${map2.resolutionMethod}, Conf: ${map2.confidence})`);
|
|
108
|
+
// -------------------------------------------------------------
|
|
109
|
+
// Test 8: Crawl Graph Analysis & PageRank
|
|
110
|
+
// -------------------------------------------------------------
|
|
111
|
+
console.log('\n8ļøā£ Testing Crawl Graph Analysis...');
|
|
112
|
+
const brokenPath = path.join(FIXTURES_DIR, 'broken-site/index.html');
|
|
113
|
+
const crawlBuilder = new CrawlGraphBuilder(brokenPath);
|
|
114
|
+
const crawlGraph = await crawlBuilder.buildGraph();
|
|
115
|
+
console.log(` ā
Crawl Graph Built: ${crawlGraph.totalNodes} node(s), ${crawlGraph.totalEdges} edge(s), Max Depth: ${crawlGraph.maxClickDepth}`);
|
|
116
|
+
// -------------------------------------------------------------
|
|
117
|
+
// Test 9: Flagship Project Audit (seo_project_audit)
|
|
118
|
+
// -------------------------------------------------------------
|
|
119
|
+
console.log('\n9ļøā£ Testing Flagship seo_project_audit Tool...');
|
|
120
|
+
const auditResult = await auditProject(nextAppPath);
|
|
121
|
+
console.log(` ā
Project Audit Completed:`);
|
|
122
|
+
console.log(` - Overall Health Score: ${auditResult.scores.overallHealth}/100 (Confidence: ${auditResult.scores.overallConfidence})`);
|
|
123
|
+
console.log(` - Technical: ${auditResult.scores.technical.score}/100 (${auditResult.scores.technical.state})`);
|
|
124
|
+
console.log(` - Content: ${auditResult.scores.content.score}/100 (${auditResult.scores.content.state})`);
|
|
125
|
+
console.log(` - AI Readiness: ${auditResult.scores.aiReadiness.score}/100 (${auditResult.scores.aiReadiness.state})`);
|
|
126
|
+
console.log(` - Total Findings Detected: ${auditResult.totalFindingsCount}`);
|
|
127
|
+
console.log(` - Immediate Action: ${auditResult.recommendedImmediateAction}`);
|
|
128
|
+
// -------------------------------------------------------------
|
|
129
|
+
// Test 10: Deep Root-Cause Diagnosis (seo_diagnose)
|
|
130
|
+
// -------------------------------------------------------------
|
|
131
|
+
console.log('\nš Testing Deep Diagnostic (seo_diagnose)...');
|
|
132
|
+
const diagResult = await diagnoseSeo(nextAppPath, '/about');
|
|
133
|
+
console.log(` ā
Diagnosis for '/about':`);
|
|
134
|
+
console.log(` - Matched File: ${diagResult.sourceLocation?.filePath}`);
|
|
135
|
+
console.log(` - Issues Detected: ${diagResult.detectedIssues.length}`);
|
|
136
|
+
if (diagResult.suggestedFixBlueprints.length > 0) {
|
|
137
|
+
console.log(` - Suggested Fix Blueprint: ${diagResult.suggestedFixBlueprints[0].title}`);
|
|
138
|
+
}
|
|
139
|
+
// -------------------------------------------------------------
|
|
140
|
+
// Test 11: Sprint Prioritization (seo_prioritize)
|
|
141
|
+
// -------------------------------------------------------------
|
|
142
|
+
console.log('\n1ļøā£1ļøā£ Testing Finding Prioritization (seo_prioritize)...');
|
|
143
|
+
const sprintResult = await prioritizeFindings(nextAppPath);
|
|
144
|
+
console.log(` ā
Prioritization Sprints:`);
|
|
145
|
+
console.log(` - Quick Wins: ${sprintResult.sprints.quickWins.length} items`);
|
|
146
|
+
console.log(` - Critical Blockers: ${sprintResult.sprints.criticalBlockers.length} items`);
|
|
147
|
+
console.log(` - Projected Score After Quick Wins: ${sprintResult.projectedScoreImprovement.projectedScoreAfterQuickWins}/100`);
|
|
148
|
+
// -------------------------------------------------------------
|
|
149
|
+
// Test 12: Fix Plan Generation (seo_fix_plan)
|
|
150
|
+
// -------------------------------------------------------------
|
|
151
|
+
console.log('\n1ļøā£2ļøā£ Testing Fix Plan Generation (seo_fix_plan)...');
|
|
152
|
+
const fixPlan = await generateFixPlan(nextAppPath);
|
|
153
|
+
console.log(` ā
Fix Plan Generated: ${fixPlan.totalSteps} remediation step(s) ready for AI coding execution.`);
|
|
154
|
+
// -------------------------------------------------------------
|
|
155
|
+
// Test 13: Snapshot Creation, Diffing & Regression Checks
|
|
156
|
+
// -------------------------------------------------------------
|
|
157
|
+
console.log('\n1ļøā£3ļøā£ Testing Snapshot Creation & Regression Verification (seo_snapshot_create & seo_regression_check)...');
|
|
158
|
+
const baselineSnap = await createSnapshotTool(nextAppPath);
|
|
159
|
+
console.log(` ā
Baseline Snapshot Created: ID=${baselineSnap.snapshot.snapshotId}, Score=${baselineSnap.snapshot.scores.overallHealth}/100`);
|
|
160
|
+
const regCheck = await checkRegression(nextAppPath, baselineSnap.snapshot);
|
|
161
|
+
console.log(` ā
Regression Check: ${regCheck.verdict} (Status: ${regCheck.regressionReport.status})`);
|
|
162
|
+
console.log('\nš ALL 13 TEST SUITES (CORE + v1.0.2 ORCHESTRATION) PASSED CLEANLY!\n');
|
|
72
163
|
}
|
|
73
164
|
runTests().catch(err => {
|
|
74
|
-
console.error('Test failed:', err);
|
|
165
|
+
console.error('ā Test failed:', err);
|
|
75
166
|
process.exit(1);
|
|
76
167
|
});
|
package/dist/tools/geo.js
CHANGED
|
@@ -36,11 +36,47 @@ export async function auditGeoAiReadiness(urlOrText, targetQuery) {
|
|
|
36
36
|
const entityScore = queryWords.every(w => content.toLowerCase().includes(w)) ? 15 : 5;
|
|
37
37
|
const totalScore = directAnswerScore + chunkingScore + structuredScore + statsScore + entityScore;
|
|
38
38
|
const citationLikelihood = totalScore >= 75 ? 'High' : totalScore >= 50 ? 'Medium' : 'Low';
|
|
39
|
+
const confidence = content.length > 300 ? 'High' : content.length > 100 ? 'Medium' : 'Low';
|
|
39
40
|
const firstSentence = content.split(/[.!?]+/)[0] || '';
|
|
41
|
+
const aiRetrievalSignals = {
|
|
42
|
+
directEntityDefinition: directAnswerPassed,
|
|
43
|
+
selfContainedAnswerBlocks: semanticChunkingPassed,
|
|
44
|
+
modularSemanticHeadings: hasHeadings,
|
|
45
|
+
factualDataAndStats: statsMatches.length >= 2,
|
|
46
|
+
structuredListsOrTables: structuredDataPassed
|
|
47
|
+
};
|
|
48
|
+
const evidenceTypeSummary = {
|
|
49
|
+
observed: [
|
|
50
|
+
`Heading tags present: ${hasHeadings}`,
|
|
51
|
+
`Bullet list items found: ${listItemsCount}`,
|
|
52
|
+
`Data tables detected: ${tablesCount}`,
|
|
53
|
+
`Numerical statistics/percentages found: ${statsMatches.length}`
|
|
54
|
+
],
|
|
55
|
+
derived: [
|
|
56
|
+
directAnswerPassed
|
|
57
|
+
? 'Target query defined directly in opening section.'
|
|
58
|
+
: 'Target query definition missing from opening paragraph.',
|
|
59
|
+
semanticChunkingPassed
|
|
60
|
+
? 'Content is structured for autonomous LLM extraction.'
|
|
61
|
+
: 'Content may be difficult for LLMs to segment into discrete facts.'
|
|
62
|
+
],
|
|
63
|
+
heuristic: [
|
|
64
|
+
`Entity coverage score: ${entityScore}/15 based on query keyword presence.`,
|
|
65
|
+
`Estimated citation probability: ${citationLikelihood} based on multi-signal retrieval weights.`
|
|
66
|
+
],
|
|
67
|
+
predictive: [
|
|
68
|
+
citationLikelihood === 'High'
|
|
69
|
+
? 'High likelihood of inclusion in Google AI Overviews and Perplexity synthesis.'
|
|
70
|
+
: 'Low to moderate probability of direct LLM citation without structured definition addition.'
|
|
71
|
+
]
|
|
72
|
+
};
|
|
40
73
|
return {
|
|
41
74
|
targetQuery,
|
|
42
75
|
overallGeoScore: totalScore,
|
|
43
76
|
citationLikelihood,
|
|
77
|
+
confidence,
|
|
78
|
+
aiRetrievalSignals,
|
|
79
|
+
evidenceTypeSummary,
|
|
44
80
|
checks: {
|
|
45
81
|
directAnswerParagraph: {
|
|
46
82
|
passed: directAnswerPassed,
|