gsearch-mcp-cli 0.0.1__tar.gz
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.
- gsearch_mcp_cli-0.0.1/.github/workflows/release.yml +167 -0
- gsearch_mcp_cli-0.0.1/.gitignore +11 -0
- gsearch_mcp_cli-0.0.1/CHANGELOG.md +44 -0
- gsearch_mcp_cli-0.0.1/PKG-INFO +131 -0
- gsearch_mcp_cli-0.0.1/README.md +93 -0
- gsearch_mcp_cli-0.0.1/docs/plans/2026-03-21-gsearch-implementation.md +1874 -0
- gsearch_mcp_cli-0.0.1/docs/specs/2026-03-21-gsearch-design.md +664 -0
- gsearch_mcp_cli-0.0.1/pyproject.toml +71 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/__init__.py +6 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/__init__.py +0 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/ai_cmd.py +83 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/ai_doc.py +88 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/config_cmd.py +64 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/doctor_cmd.py +77 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/fetch_cmd.py +50 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/main.py +64 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/search_cmd.py +92 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/setup_cmd.py +390 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/cli/skill_cmd.py +157 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/config.py +78 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/constants.py +143 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/__init__.py +0 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/browser.py +217 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/cdp.py +198 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/extractor.py +229 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/fetcher.py +187 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/rate_limiter.py +49 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/core/warmup.py +61 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/data/SKILL.md +202 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/data/references/commands.md +220 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/data/references/mcp-tools.md +44 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/exceptions.py +46 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/mcp/__init__.py +5 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/mcp/__main__.py +4 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/mcp/server.py +147 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/models.py +50 -0
- gsearch_mcp_cli-0.0.1/src/gsearch_mcp_cli/shared.py +289 -0
- gsearch_mcp_cli-0.0.1/tests/conftest.py +72 -0
- gsearch_mcp_cli-0.0.1/tests/test_browser.py +53 -0
- gsearch_mcp_cli-0.0.1/tests/test_cdp.py +94 -0
- gsearch_mcp_cli-0.0.1/tests/test_cli.py +34 -0
- gsearch_mcp_cli-0.0.1/tests/test_cli_commands.py +98 -0
- gsearch_mcp_cli-0.0.1/tests/test_config.py +59 -0
- gsearch_mcp_cli-0.0.1/tests/test_extractor.py +94 -0
- gsearch_mcp_cli-0.0.1/tests/test_fetcher.py +78 -0
- gsearch_mcp_cli-0.0.1/tests/test_integration.py +49 -0
- gsearch_mcp_cli-0.0.1/tests/test_mcp.py +35 -0
- gsearch_mcp_cli-0.0.1/tests/test_models.py +56 -0
- gsearch_mcp_cli-0.0.1/tests/test_rate_limiter.py +63 -0
- gsearch_mcp_cli-0.0.1/tests/test_shared.py +310 -0
- gsearch_mcp_cli-0.0.1/tests/test_warmup.py +92 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
name: Release to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write
|
|
10
|
+
id-token: write
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: Run tests
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
|
|
22
|
+
- name: Install uv
|
|
23
|
+
uses: astral-sh/setup-uv@v5
|
|
24
|
+
|
|
25
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
26
|
+
run: uv python install ${{ matrix.python-version }}
|
|
27
|
+
|
|
28
|
+
- name: Install dependencies
|
|
29
|
+
run: uv sync --extra dev --python ${{ matrix.python-version }}
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: uv run ruff check src/ tests/
|
|
33
|
+
|
|
34
|
+
- name: Run tests
|
|
35
|
+
run: uv run pytest tests/ -v -k "not integration"
|
|
36
|
+
|
|
37
|
+
build:
|
|
38
|
+
name: Build package
|
|
39
|
+
needs: test
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
|
|
44
|
+
- name: Install uv
|
|
45
|
+
uses: astral-sh/setup-uv@v5
|
|
46
|
+
|
|
47
|
+
- name: Set up Python
|
|
48
|
+
run: uv python install 3.12
|
|
49
|
+
|
|
50
|
+
- name: Verify all versions match tag
|
|
51
|
+
run: |
|
|
52
|
+
TAG_VERSION="${GITHUB_REF_NAME#v}"
|
|
53
|
+
ERRORS=0
|
|
54
|
+
|
|
55
|
+
# 1. pyproject.toml
|
|
56
|
+
TOML_VERSION=$(grep -oP '(?<=^version = ")[^"]+' pyproject.toml)
|
|
57
|
+
if [ "$TOML_VERSION" != "$TAG_VERSION" ]; then
|
|
58
|
+
echo "❌ pyproject.toml version ($TOML_VERSION) != tag ($TAG_VERSION)"
|
|
59
|
+
ERRORS=$((ERRORS + 1))
|
|
60
|
+
else
|
|
61
|
+
echo "✅ pyproject.toml: $TOML_VERSION"
|
|
62
|
+
fi
|
|
63
|
+
|
|
64
|
+
# 2. __init__.py fallback
|
|
65
|
+
INIT_VERSION=$(grep -oP '(?<=__version__ = ")[^"]+' src/gsearch_mcp_cli/__init__.py)
|
|
66
|
+
if [ "$INIT_VERSION" != "$TAG_VERSION" ]; then
|
|
67
|
+
echo "❌ __init__.py fallback ($INIT_VERSION) != tag ($TAG_VERSION)"
|
|
68
|
+
ERRORS=$((ERRORS + 1))
|
|
69
|
+
else
|
|
70
|
+
echo "✅ __init__.py: $INIT_VERSION"
|
|
71
|
+
fi
|
|
72
|
+
|
|
73
|
+
# 3. SKILL.md frontmatter
|
|
74
|
+
SKILL_VERSION=$(grep -oP '(?<=^version: ")[^"]+' src/gsearch_mcp_cli/data/SKILL.md)
|
|
75
|
+
if [ "$SKILL_VERSION" != "$TAG_VERSION" ]; then
|
|
76
|
+
echo "❌ SKILL.md version ($SKILL_VERSION) != tag ($TAG_VERSION)"
|
|
77
|
+
ERRORS=$((ERRORS + 1))
|
|
78
|
+
else
|
|
79
|
+
echo "✅ SKILL.md: $SKILL_VERSION"
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
if [ "$ERRORS" -gt 0 ]; then
|
|
83
|
+
echo ""
|
|
84
|
+
echo "VERSION MISMATCH: Update all 3 files before tagging:"
|
|
85
|
+
echo " 1. pyproject.toml -> version = \"$TAG_VERSION\""
|
|
86
|
+
echo " 2. src/gsearch_mcp_cli/__init__.py -> __version__ = \"$TAG_VERSION\""
|
|
87
|
+
echo " 3. src/gsearch_mcp_cli/data/SKILL.md -> version: \"$TAG_VERSION\""
|
|
88
|
+
exit 1
|
|
89
|
+
fi
|
|
90
|
+
|
|
91
|
+
echo ""
|
|
92
|
+
echo "All versions match: $TAG_VERSION ✅"
|
|
93
|
+
|
|
94
|
+
- name: Build sdist and wheel
|
|
95
|
+
run: uv build
|
|
96
|
+
|
|
97
|
+
- name: Upload build artifacts
|
|
98
|
+
uses: actions/upload-artifact@v4
|
|
99
|
+
with:
|
|
100
|
+
name: dist
|
|
101
|
+
path: dist/
|
|
102
|
+
|
|
103
|
+
publish-pypi:
|
|
104
|
+
name: Publish to PyPI
|
|
105
|
+
needs: build
|
|
106
|
+
runs-on: ubuntu-latest
|
|
107
|
+
environment:
|
|
108
|
+
name: pypi
|
|
109
|
+
url: https://pypi.org/p/gsearch-mcp-cli
|
|
110
|
+
steps:
|
|
111
|
+
- name: Download build artifacts
|
|
112
|
+
uses: actions/download-artifact@v4
|
|
113
|
+
with:
|
|
114
|
+
name: dist
|
|
115
|
+
path: dist/
|
|
116
|
+
|
|
117
|
+
- name: Publish to PyPI
|
|
118
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
119
|
+
|
|
120
|
+
github-release:
|
|
121
|
+
name: Create GitHub Release
|
|
122
|
+
needs: publish-pypi
|
|
123
|
+
runs-on: ubuntu-latest
|
|
124
|
+
steps:
|
|
125
|
+
- uses: actions/checkout@v4
|
|
126
|
+
with:
|
|
127
|
+
fetch-depth: 0
|
|
128
|
+
|
|
129
|
+
- name: Download build artifacts
|
|
130
|
+
uses: actions/download-artifact@v4
|
|
131
|
+
with:
|
|
132
|
+
name: dist
|
|
133
|
+
path: dist/
|
|
134
|
+
|
|
135
|
+
- name: Extract version from tag
|
|
136
|
+
id: version
|
|
137
|
+
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
|
|
138
|
+
|
|
139
|
+
- name: Generate changelog
|
|
140
|
+
id: changelog
|
|
141
|
+
run: |
|
|
142
|
+
VERSION="v${{ steps.version.outputs.VERSION }}"
|
|
143
|
+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || git rev-list --max-parents=0 HEAD)
|
|
144
|
+
|
|
145
|
+
{
|
|
146
|
+
echo "## What's Changed"
|
|
147
|
+
echo ""
|
|
148
|
+
echo "| Date (UTC) | Commit Message | Link |"
|
|
149
|
+
echo "|------------|----------------|------|"
|
|
150
|
+
git log --date=iso-strict --pretty=format:"| %ad | %s | [\`%h\`](https://github.com/${{ github.repository }}/commit/%H) |" $PREVIOUS_TAG..HEAD | tac
|
|
151
|
+
echo ""
|
|
152
|
+
echo ""
|
|
153
|
+
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREVIOUS_TAG...$VERSION"
|
|
154
|
+
} > changelog.md
|
|
155
|
+
|
|
156
|
+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
|
|
157
|
+
cat changelog.md >> $GITHUB_OUTPUT
|
|
158
|
+
echo "EOF" >> $GITHUB_OUTPUT
|
|
159
|
+
|
|
160
|
+
- name: Create GitHub Release
|
|
161
|
+
uses: softprops/action-gh-release@v2
|
|
162
|
+
with:
|
|
163
|
+
name: v${{ steps.version.outputs.VERSION }}
|
|
164
|
+
body: ${{ steps.changelog.outputs.changelog }}
|
|
165
|
+
files: dist/*
|
|
166
|
+
draft: false
|
|
167
|
+
prerelease: false
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to gsearch-mcp-cli will be documented in this file.
|
|
4
|
+
|
|
5
|
+
Format based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.0.1] - 2026-03-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **Google Search** (`gsearch search` / `gsearch "query"`) — regular Google search with AI Overview, organic results, People Also Ask, and related searches
|
|
13
|
+
- **Google AI Mode** (`gsearch ai`) — synthesized AI response with structured sections and cited sources, equivalent to g.ai
|
|
14
|
+
- **Page Fetching** (`gsearch fetch`) — fetch any URL and convert to clean Markdown using trafilatura + html-to-markdown. SSRF-safe with IPv4/IPv6 validation
|
|
15
|
+
- **MCP Server** (`gsearch-mcp`) — 3 tools: `gsearch_search`, `gsearch_ai`, `gsearch_fetch` for AI agent integration via Model Context Protocol
|
|
16
|
+
- **Time/Date Filtering** — `--time` flag (hour, 1h, 12h, day, 24h, week, 7d, month, year) and `--after`/`--before` for custom date ranges. Supports arbitrary `Nh` patterns (e.g., 6h = last 6 hours)
|
|
17
|
+
- **Browser Automation** — headless Chrome via CDP (Chrome DevTools Protocol) with persistent warmed profile. No authentication needed
|
|
18
|
+
- **Multi-Browser Support** — auto-detects Chrome, Brave, Edge, Chromium, Vivaldi, Opera, Opera GX on macOS, Linux, and Windows
|
|
19
|
+
- **MCP Setup** (`gsearch setup add`) — configure MCP server for Claude Code, Gemini CLI, Cursor, Windsurf, Cline, Antigravity, Codex, and OpenCode
|
|
20
|
+
- **Skill Installer** (`gsearch skill install`) — install SKILL.md for Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Antigravity, Cline, OpenClaw, CC-Claw, and generic agents
|
|
21
|
+
- **Profile Warmup** (`gsearch setup`) — one-time ~8s warmup establishes BotGuard trust cookies for anonymous Google access
|
|
22
|
+
- **Configuration** (`gsearch config`) — persistent config for browser preference, language, region, rate limits, timeouts
|
|
23
|
+
- **Diagnostics** (`gsearch doctor`) — check browser, profile, config, and connectivity
|
|
24
|
+
- **Rate Limiting** — built-in token bucket (default 1 search/2s, burst of 3) to prevent Google blocking
|
|
25
|
+
- **Crash Recovery** — auto-relaunch Chrome on CDP connection failure
|
|
26
|
+
- **Tab Context Manager** — guaranteed tab cleanup on error, max 5 concurrent tabs
|
|
27
|
+
- **Error Sanitization** — MCP responses strip file paths, PIDs, and port numbers
|
|
28
|
+
- **JSON Output** — `--json` flag on all search/fetch commands for programmatic use
|
|
29
|
+
- **AI Documentation** — `gsearch --docs` prints LLM-optimized reference for AI agents
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
|
|
33
|
+
- SSRF prevention in `gsearch fetch`: scheme whitelist (http/https only), private IP blocklist, DNS pre-resolution, IPv6 validation
|
|
34
|
+
- CDP restricted to `--remote-allow-origins=http://localhost`
|
|
35
|
+
- TOCTOU-safe port allocation via `--remote-debugging-port=0` + stderr parsing
|
|
36
|
+
- Error sanitization prevents information leakage to MCP clients
|
|
37
|
+
|
|
38
|
+
### Technical
|
|
39
|
+
|
|
40
|
+
- Python 3.10+, async throughout (websockets library for CDP)
|
|
41
|
+
- Pydantic BaseModel for all data models with automatic JSON serialization
|
|
42
|
+
- Single shared backend (`shared.py`) serves both CLI and MCP
|
|
43
|
+
- Click + rich-click for CLI, FastMCP for MCP server
|
|
44
|
+
- 86 unit tests, 1 integration test
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gsearch-mcp-cli
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Google Search CLI and MCP server for AI agents
|
|
5
|
+
Project-URL: Homepage, https://github.com/jacob-bd/gsearch-mcp-cli
|
|
6
|
+
Project-URL: Repository, https://github.com/jacob-bd/gsearch-mcp-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/jacob-bd/gsearch-mcp-cli/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/jacob-bd/gsearch-mcp-cli/blob/main/CHANGELOG.md
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Indexing/Search
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: click>=8.0
|
|
21
|
+
Requires-Dist: fastmcp>=0.1
|
|
22
|
+
Requires-Dist: html-to-markdown>=1.0
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: orjson>=3.9
|
|
25
|
+
Requires-Dist: pydantic>=2.0
|
|
26
|
+
Requires-Dist: rich-click>=1.7
|
|
27
|
+
Requires-Dist: rich>=13.0
|
|
28
|
+
Requires-Dist: trafilatura>=1.8
|
|
29
|
+
Requires-Dist: truststore>=0.9
|
|
30
|
+
Requires-Dist: websockets>=12.0
|
|
31
|
+
Provides-Extra: dev
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-cov>=4.1; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest-mock>=3.12; extra == 'dev'
|
|
35
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# gsearch-mcp-cli
|
|
40
|
+
|
|
41
|
+
Google Search CLI and MCP server for AI agents. Search Google (regular + AI Mode), fetch web pages as Markdown, with time filtering. No Google account needed.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install gsearch-mcp-cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Or with uv / pipx:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
uv pip install gsearch-mcp-cli # uv
|
|
53
|
+
pipx install gsearch-mcp-cli # pipx (isolated)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Run without installing:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
uvx --from gsearch-mcp-cli gsearch "your query"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Requirements:** A Chromium-based browser (Chrome, Brave, Edge, Chromium, Vivaldi, or Opera).
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
gsearch setup # one-time profile warmup (~8s)
|
|
68
|
+
gsearch "what is kubernetes" # search Google
|
|
69
|
+
gsearch "AI news" --time day # last 24 hours
|
|
70
|
+
gsearch "breaking news" --time 1h # last hour
|
|
71
|
+
gsearch ai "explain docker architecture" # AI Mode (g.ai)
|
|
72
|
+
gsearch fetch "https://example.com" # page to Markdown
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Time Filtering
|
|
76
|
+
|
|
77
|
+
Filter results by time period -- critical for news and recent events:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
gsearch "query" --time hour # last hour
|
|
81
|
+
gsearch "query" --time 12h # last 12 hours
|
|
82
|
+
gsearch "query" --time day # last 24 hours
|
|
83
|
+
gsearch "query" --time week # last 7 days
|
|
84
|
+
gsearch "query" --time month # last month
|
|
85
|
+
gsearch "query" --time year # last year
|
|
86
|
+
gsearch "query" --after 2026-01-01 --before 2026-03-31 # custom range
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Commands
|
|
90
|
+
|
|
91
|
+
| Command | Description |
|
|
92
|
+
|---------|-------------|
|
|
93
|
+
| `gsearch "query"` | Google Search (default) with AI Overview + organic results |
|
|
94
|
+
| `gsearch ai "query"` | Google AI Mode -- synthesized answer with citations |
|
|
95
|
+
| `gsearch fetch "url"` | Fetch URL and convert to clean Markdown |
|
|
96
|
+
| `gsearch setup` | Browser profile warmup (one-time) |
|
|
97
|
+
| `gsearch setup add <tool>` | Configure MCP server for an AI tool |
|
|
98
|
+
| `gsearch config show` | Show configuration |
|
|
99
|
+
| `gsearch doctor` | Run diagnostics |
|
|
100
|
+
| `gsearch skill install <tool>` | Install skill for AI tools |
|
|
101
|
+
| `gsearch --ai` | Print AI-optimized documentation |
|
|
102
|
+
|
|
103
|
+
## MCP Server
|
|
104
|
+
|
|
105
|
+
For AI agents via Model Context Protocol:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
gsearch-mcp # start MCP server (stdio)
|
|
109
|
+
gsearch setup add cursor # configure for Cursor
|
|
110
|
+
gsearch setup add claude-code # configure for Claude Code
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**MCP Tools:**
|
|
114
|
+
|
|
115
|
+
- `gsearch_search(query, time_filter="day", ...)` -- Google Search
|
|
116
|
+
- `gsearch_ai(query, time_filter="week", ...)` -- AI Mode
|
|
117
|
+
- `gsearch_fetch(url, format="md", ...)` -- Fetch page as Markdown
|
|
118
|
+
|
|
119
|
+
## How It Works
|
|
120
|
+
|
|
121
|
+
Uses headless Chrome via CDP (Chrome DevTools Protocol) with a persistent anonymous profile. Google's BotGuard requires a warmed-up browser session -- `gsearch setup` establishes this once. No Google account or login needed.
|
|
122
|
+
|
|
123
|
+
## Supported AI Tools
|
|
124
|
+
|
|
125
|
+
**MCP Setup** (`gsearch setup add`): Claude Code, Gemini CLI, Cursor, Windsurf, Cline, Antigravity, Codex, OpenCode
|
|
126
|
+
|
|
127
|
+
**Skill Install** (`gsearch skill install`): Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Antigravity, Cline, OpenClaw, CC-Claw
|
|
128
|
+
|
|
129
|
+
## License
|
|
130
|
+
|
|
131
|
+
MIT
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# gsearch-mcp-cli
|
|
2
|
+
|
|
3
|
+
Google Search CLI and MCP server for AI agents. Search Google (regular + AI Mode), fetch web pages as Markdown, with time filtering. No Google account needed.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install gsearch-mcp-cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with uv / pipx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
uv pip install gsearch-mcp-cli # uv
|
|
15
|
+
pipx install gsearch-mcp-cli # pipx (isolated)
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Run without installing:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
uvx --from gsearch-mcp-cli gsearch "your query"
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Requirements:** A Chromium-based browser (Chrome, Brave, Edge, Chromium, Vivaldi, or Opera).
|
|
25
|
+
|
|
26
|
+
## Quick Start
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
gsearch setup # one-time profile warmup (~8s)
|
|
30
|
+
gsearch "what is kubernetes" # search Google
|
|
31
|
+
gsearch "AI news" --time day # last 24 hours
|
|
32
|
+
gsearch "breaking news" --time 1h # last hour
|
|
33
|
+
gsearch ai "explain docker architecture" # AI Mode (g.ai)
|
|
34
|
+
gsearch fetch "https://example.com" # page to Markdown
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Time Filtering
|
|
38
|
+
|
|
39
|
+
Filter results by time period -- critical for news and recent events:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
gsearch "query" --time hour # last hour
|
|
43
|
+
gsearch "query" --time 12h # last 12 hours
|
|
44
|
+
gsearch "query" --time day # last 24 hours
|
|
45
|
+
gsearch "query" --time week # last 7 days
|
|
46
|
+
gsearch "query" --time month # last month
|
|
47
|
+
gsearch "query" --time year # last year
|
|
48
|
+
gsearch "query" --after 2026-01-01 --before 2026-03-31 # custom range
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Commands
|
|
52
|
+
|
|
53
|
+
| Command | Description |
|
|
54
|
+
|---------|-------------|
|
|
55
|
+
| `gsearch "query"` | Google Search (default) with AI Overview + organic results |
|
|
56
|
+
| `gsearch ai "query"` | Google AI Mode -- synthesized answer with citations |
|
|
57
|
+
| `gsearch fetch "url"` | Fetch URL and convert to clean Markdown |
|
|
58
|
+
| `gsearch setup` | Browser profile warmup (one-time) |
|
|
59
|
+
| `gsearch setup add <tool>` | Configure MCP server for an AI tool |
|
|
60
|
+
| `gsearch config show` | Show configuration |
|
|
61
|
+
| `gsearch doctor` | Run diagnostics |
|
|
62
|
+
| `gsearch skill install <tool>` | Install skill for AI tools |
|
|
63
|
+
| `gsearch --ai` | Print AI-optimized documentation |
|
|
64
|
+
|
|
65
|
+
## MCP Server
|
|
66
|
+
|
|
67
|
+
For AI agents via Model Context Protocol:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
gsearch-mcp # start MCP server (stdio)
|
|
71
|
+
gsearch setup add cursor # configure for Cursor
|
|
72
|
+
gsearch setup add claude-code # configure for Claude Code
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**MCP Tools:**
|
|
76
|
+
|
|
77
|
+
- `gsearch_search(query, time_filter="day", ...)` -- Google Search
|
|
78
|
+
- `gsearch_ai(query, time_filter="week", ...)` -- AI Mode
|
|
79
|
+
- `gsearch_fetch(url, format="md", ...)` -- Fetch page as Markdown
|
|
80
|
+
|
|
81
|
+
## How It Works
|
|
82
|
+
|
|
83
|
+
Uses headless Chrome via CDP (Chrome DevTools Protocol) with a persistent anonymous profile. Google's BotGuard requires a warmed-up browser session -- `gsearch setup` establishes this once. No Google account or login needed.
|
|
84
|
+
|
|
85
|
+
## Supported AI Tools
|
|
86
|
+
|
|
87
|
+
**MCP Setup** (`gsearch setup add`): Claude Code, Gemini CLI, Cursor, Windsurf, Cline, Antigravity, Codex, OpenCode
|
|
88
|
+
|
|
89
|
+
**Skill Install** (`gsearch skill install`): Claude Code, Cursor, Codex, Gemini CLI, OpenCode, Antigravity, Cline, OpenClaw, CC-Claw
|
|
90
|
+
|
|
91
|
+
## License
|
|
92
|
+
|
|
93
|
+
MIT
|