grok-web-search-mcp
언어: English | 中文
프로젝트 소개
에이전트는 단순한 채팅 완성(chat completion)이 아니라 인용이 포함된 실시간 웹 및 X 접근이 필요합니다. 이 프로젝트는 xAI의 서버 측 web_search 및 x_search 도구를 단일 MCP 도구로 감싸서, Grok, Cursor, Claude Desktop 같은 호스트가 xAI 클라이언트 로직을 내장하지 않고도 호출할 수 있게 합니다.
저장소: https://github.com/NakanoSanku/grok-web-search-mcp
업스트림 호출(단순화):
POST {base_url}/responses
Authorization: Bearer <api_key>
Content-Type: application/json
{
"model": "grok-4.5",
"input": [{"role": "user", "content": "<query>"}],
"tools": [
{"type": "web_search", "enable_image_understanding": true},
{
"type": "x_search",
"allowed_x_handles": ["xai"],
"from_date": "2025-10-01",
"to_date": "2025-10-10",
"enable_image_understanding": true,
"enable_video_understanding": true
}
]
}설계 목표:
하나의 MCP 도구, 하나의 호출 규약 — 모델은
query/scope/recency/images만 전달할 수 있음간결한 결과 —
query/text/citations/sources_used(원시 업스트림 덤프 없음)커스텀 base URL — 공식
https://api.x.ai/v1또는 OpenAI 호환 프록시선택적 비전 입력 — https URL 또는 data URI 첨부 가능 (로컬 경로는 옵트인)
PyPI 불필요 —
uvx --from git+...로 GitHub에서 직접 실행
기능
기능 | 비고 |
실시간 웹 검색 | Grok이 소스 URL과 함께 답변을 종합 |
실시간 X 검색 | 기본 포함; |
X 필터 | 허용/차단 목록(최대 20개, |
도메인 필터 | 허용 목록 또는 차단 목록(최대 5개, 상호 배타적; 스킴/경로 제거) |
검색 미디어 이해 | 웹 페이지 및 X 게시물의 이미지; X 게시물의 동영상 |
클라이언트 이미지 입력 | 선택적 |
간결한 JSON 출력 | 도구 결과에 |
프로토콜 오류 | 업스트림/검증 실패 시 MCP |
재시도 | 429 / 502 / 503 / 504 및 전송 타임아웃, 백오프 포함 |
프록시 친화적 |
|
GitHub 설치 |
|
미포함: enable_image_search (웹 이미지 갤러리 임베딩). 사용자가 이미지를 제공할 때는 images를 사용하고, 탐색한 페이지 및 X 게시물의 이미지에는 enable_image_understanding을 사용하세요.
사용된 기술
Related MCP server: WebQuest MCP
시작하기
사전 요구사항
Python 3.10+
xAI API 키 (또는 호환 게이트웨이용 키)
uv (GitHub에서
uvx사용 시 권장)
# optional: install uv
curl -LsSf https://astral.sh/uv/install.sh | sh빠른 시작 (GitHub에서 uvx)
일상적인 MCP 사용에는 로컬 클론이 필요 없습니다:
export GROK_API_KEY=xai-...
uvx --from git+https://github.com/NakanoSanku/grok-web-search-mcp.git grok-web-search-mcp재현성이 필요할 때는 브랜치, 태그 또는 커밋을 고정하세요:
uvx --from git+https://github.com/NakanoSanku/grok-web-search-mcp.git@main grok-web-search-mcp
# uvx --from git+https://github.com/NakanoSanku/grok-web-search-mcp.git@v0.3.0 grok-web-search-mcp로컬 개발 설치
저장소를 클론합니다:
git clone https://github.com/NakanoSanku/grok-web-search-mcp.git cd grok-web-search-mcp의존성을 설치합니다:
uv sync # or: pip install -e ".[dev]"로컬 env 파일을 생성합니다:
cp .env.example .env.env를 편집하고 최소한GROK_API_KEY를 설정합니다 (설정 참조).
설정
변수 | 필수 | 기본값 | 설명 |
| 예 | — |
|
| 아니요 |
|
|
| 아니요 |
|
|
| 아니요 |
| 요청 타임아웃(초, 1–3600). 높은 추론 + 검색은 수 분이 걸릴 수 있음 |
| 아니요 |
| TCP/TLS 연결 타임아웃 ( |
| 아니요 |
| 탐색한 페이지 및 X 게시물의 이미지 분석 |
| 아니요 |
| 기본 추론 길이: |
| 아니요 |
|
|
| 아니요 | cwd | 활성화 시 로컬 이미지용 디렉터리 격리(jail) |
| 아니요 |
| 429/5xx/타임아웃 재시도 횟수 (0–8) |
| 아니요 |
|
|
| 아니요 |
| X 게시물의 동영상 분석 (운영자 전용; 도구 인자가 아님) |
| 아니요 | — | 운영자 웹 허용 목록 (최대 5개). 호출자는 설정할 수 없음 |
| 아니요 | — | 운영자 웹 차단 목록 (최대 5개) |
| 아니요 | — | 운영자 X 핸들 허용 목록 (최대 20개) |
| 아니요 | — | 운영자 X 핸들 차단 목록 (최대 20개) |
| 아니요 | — | 서버 소유 시스템 프롬프트에 추가되는 추가 규칙 |
비밀값을 git에 커밋하지 마세요. 가능하면 MCP 설정에는 호스트가 주입한 env를 사용하세요.
사용법
서버 실행
권장 (GitHub에서):
export GROK_API_KEY=xai-...
uvx --from git+https://github.com/NakanoSanku/grok-web-search-mcp.git grok-web-search-mcp로컬 체크아웃에서:
export GROK_API_KEY=xai-...
# Windows PowerShell: $env:GROK_API_KEY="xai-..."
uv run grok-web-search-mcp
# or
uv run python -m grok_web_search_mcp호환 프록시 예시:
export GROK_API_KEY=sk-xxx
export GROK_BASE_URL=http://127.0.0.1:8317/v1
export GROK_MODEL=grok-4.5
uvx --from git+https://github.com/NakanoSanku/grok-web-search-mcp.git grok-web-search-mcpMCP 호스트 설정
권장: uvx로 GitHub에서 실행 (로컬 경로 불필요).
JSON 스타일 호스트 (Cursor / Claude Desktop 등):
{
"mcpServers": {
"grok-web-search": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/NakanoSanku/grok-web-search-mcp.git",
"grok-web-search-mcp"
],
"env": {
"GROK_API_KEY": "xai-your-key",
"GROK_BASE_URL": "https://api.x.ai/v1",
"GROK_MODEL": "grok-4.5"
}
}
}
}Grok 사용자 설정 (~/.grok/config.toml):
[mcp_servers.grok-web-search]
command = "uvx"
args = [
"--from",
"git+https://github.com/NakanoSanku/grok-web-search-mcp.git",
"grok-web-search-mcp",
]
enabled = true
[mcp_servers.grok-web-search.env]
GROK_API_KEY = "xai-your-key"
GROK_BASE_URL = "https://api.x.ai/v1"
GROK_MODEL = "grok-4.5"ref 고정 (브랜치 / 태그 / 커밋):
args = [
"--from",
"git+https://github.com/NakanoSanku/grok-web-search-mcp.git@main",
"grok-web-search-mcp",
]로컬 개발 전용 (체크아웃의 절대 경로):
[mcp_servers.grok-web-search]
command = "uv"
args = [
"run",
"--directory",
"/absolute/path/to/grok-web-search-mcp",
"grok-web-search-mcp",
]
enabled = true도구: web_search
모든 호스트 모델은 동일한 4키 계약을 사용해야 합니다. 추가 인자(model, reasoning_effort, system_prompt, 도메인/핸들 필터)는 거부됩니다. 품질 조정은 환경 변수에 있으므로 검색 동작이 모델 간에 달라지지 않습니다.
매개변수 | 유형 | 설명 |
| string | 필수. 자연어 질문, 2–600자. 키워드 목록( |
|
| 기본값 |
|
| 기본값 |
| string[]? | 선택적 이미지 URL (http(s) / data URI, 최대 5개). 사용자가 이미지를 제공한 경우에만 사용하세요. |
표준 예시:
{ "query": "What is xAI's latest valuation?" }그런 다음 서버는: query를 정규화하고, 고정 시스템 프롬프트를 주입하고, env에서 운영자 필터를 적용하고, recency를 X 날짜 범위로 매핑하며, 항상 설정된 모델 / 추론 수준을 사용합니다.
images는 Responses API input_image 파트입니다. 로컬 파일시스템 경로는 기본적으로 비활성화되어 있습니다. 이는 "스톡 이미지를 웹에서 검색"하는 기능이 아닙니다.
응답 형태
성공(MCP isError: false, 구조화된 콘텐츠):
{
"query": "What is xAI?",
"text": "...",
"citations": [{"url": "https://x.ai", "title": "xAI"}],
"sources_used": ["web", "x"],
"scope": "all",
"recency": "any"
}실패는 짧은 메시지와 함께 프로토콜 수준 도구 오류(isError: true)입니다(예: Grok API error (401): Invalid API key). 불완전하거나 빈 업스트림 응답도 오류로 처리되며, 조용한 성공으로 간주되지 않습니다.
의도적으로 반환하지 않는 항목: API 키, model, base_url, 원시 업스트림 JSON 또는 주석 블롭(URL은 citations로만 추출됩니다). 도구 결과 외부(env / 호스트 MCP 설정 / stderr 로그)에서 구성을 진단하세요.
Python 클라이언트 예제
import asyncio
from grok_web_search_mcp.client import GrokWebSearchClient
from grok_web_search_mcp.config import Settings
async def main():
async with GrokWebSearchClient(Settings.from_env()) as client:
result = await client.web_search("What is xAI?")
print(result.to_dict())
asyncio.run(main())실제 호출은 모델 및 서버 측 검색 할당량을 소비합니다. 단위 테스트는 목(mock)을 사용하며 네트워크에 접속하지 않습니다.
개발
git clone https://github.com/NakanoSanku/grok-web-search-mcp.git
cd grok-web-search-mcp
uv sync --extra dev
uv run pytest
# live API (optional): GROK_LIVE=1 uv run pytest -m live프로젝트 구조:
src/grok_web_search_mcp/
server.py # MCP tool surface
client.py # Responses API client + image helpers
config.py # Environment settings
tests/로드맵
단일 경량
web_searchMCP 도구기본적으로 업스트림
web_search및x_search활성화X 핸들/날짜 필터 및 이미지/비디오 이해
사용자 지정
base_url/ 프록시 지원도메인 허용/차단 필터
선택적 멀티모달 이미지 입력
uvx를 통한 GitHub 설치/실행프로토콜 수준 오류, 재시도, 타임아웃/추론 기본값
로컬 이미지 격리(기본적으로 비활성화)
표준 MCP 호출 계약(
query/scope/recency/images)선택적 Streamable HTTP 전송 문서/예제
검색 품질을 위한 골든 세트 평가 하네스
오픈 이슈를 참조하세요.
기여
기여를 환영합니다.
프로젝트를 포크하세요
기능 브랜치를 생성하세요 (
git checkout -b feature/AmazingFeature)변경 사항을 커밋하세요 (
git commit -m 'Add some AmazingFeature')브랜치에 푸시하세요 (
git push origin feature/AmazingFeature)풀 리퀘스트를 여세요
도구 표면을 간결하게 유지하세요: 많은 얇은 래퍼보다 잘 문서화된 단일 도구를 선호하세요.
라이선스
MIT 라이선스에 따라 배포됩니다. 자세한 내용은 LICENSE를 참조하세요.
감사의 말
Available Tools
1 toolweb_searchA
Live web and X search via Grok. Returns ok, text (answer), citations (URL list). Optional images: public URL, data:image/...;base64,..., or local file path (max 5) to ask about a picture while searching. Supports web domain filters, X handle/date filters, and reasoning_effort (low/medium/high). Image understanding applies to browsed pages and X posts; video understanding applies to X posts only.
| Name | Required | Description | Default |
|---|---|---|---|
| model | No | Optional model override (default from GROK_MODEL / grok-4.5). | |
| query | Yes | Natural-language search question or topic. | |
| images | No | Optional image input(s) for visual questions: URL / data-URI / local path (comma or newline separated, max 5). Not an image-search API. | |
| to_date | No | Optional inclusive X search end date (YYYY-MM-DD). | |
| from_date | No | Optional inclusive X search start date (YYYY-MM-DD). | |
| image_detail | No | Vision detail for input images: low | high | auto (default high). | |
| system_prompt | No | Optional system instruction prepended to the request. | |
| allowed_domains | No | Optional comma-separated allowlist (max 5). Mutually exclusive with excluded_domains. | |
| excluded_domains | No | Optional comma-separated denylist (max 5). | |
| reasoning_effort | No | Optional thinking length for reasoning models: low | medium | high. | |
| allowed_x_handles | No | Optional comma-separated X handle allowlist (max 20). Mutually exclusive with excluded_x_handles. | |
| excluded_x_handles | No | Optional comma-separated X handle denylist (max 20). | |
| enable_image_understanding | No | Analyze images found on browsed pages and X posts (default on). | |
| enable_video_understanding | No | Analyze videos found in X posts (default off). |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It discloses return format, image handling constraints (max 5, types), and scoping of image/video understanding. It lacks explicit mention of read-only nature but is otherwise transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (6 sentences), front-loaded with core purpose, and every sentence adds meaningful information without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (14 parameters, optional features) and the presence of an output schema, the description covers most behavioral aspects. Minor gaps exist (e.g., rate limits, indexing scope), but overall it is thorough.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so baseline is 3. The description adds value by summarizing key parameters (domain filters, reasoning_effort) and clarifying behavior of image/video understanding fields, which are not detailed in schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it performs 'Live web and X search via Grok' and details return values. It uses a specific verb (search) and resource (web and X), and the purpose is unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
While no sibling tools exist for comparison, the description provides clear context on features and filters, sufficiently guiding usage. It could benefit from explicit when-not-to-use, but the absence of alternatives makes this less critical.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
web_search
TDQS
Only one tool exists, so there is no possibility of confusion or overlap with other tools.
With a single tool, naming consistency is inherently perfect as there is no pattern to break.
A single tool is slightly minimal but reasonably scoped for a focused web search server, as the tool itself is comprehensive.
The tool covers web search, X search, image understanding, domain and date filters, and reasoning effort, leaving no obvious gaps for its stated purpose.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Live AI-native web search with citations. One tool for every MCP client. Flat per-request pricing.
Docs: https://docs.keenable.ai/mcp-server Keenable is a free, remote MCP server that gives agents access to the web index. Search the web with ranked results and date/site filters, then fetch any indexed page as clean markdown. Works out of the box with no account or API key.
Scrape, crawl and search the web for AI agents via MCP.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that provides real-time web search and X (Twitter) search capabilities via the xAI API.228MIT
- AlicenseNot gradedqualityCmaintenanceA Model Context Protocol server that exposes powerful web search and scraping tools to AI agents and MCP-compatible clients.Apache 2.0
- AlicenseAqualityBmaintenanceMCP server for live X/Twitter and web search, driven by your locally logged-in Grok CLI and leveraging your X Premium or SuperGrok subscription quota.31MIT
- FlicenseNot gradedqualityCmaintenanceMCP server providing web search, news search, and X/Twitter search capabilities via HTTP or stdio.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/NakanoSanku/grok-web-search-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server