grok-mcp
Provides web search capabilities using DuckDuckGo, including site-specific searches, news searches, and page fetching.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@grok-mcpsearch for recent SpaceX launch news"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
grok-mcp
Web 搜索 + X/Twitter 搜索 的 MCP Server,供外部客户端(Claude Code / Cursor / Grok / OpenClaw / mcporter 等)调用。
HTTP 模式强制 Bearer API Key 鉴权。
给别人部署? 看 DEPLOY.md(拷贝 / 安装 / 开机自启 / 客户端配置 / 安全清单)。
配置(config.env)
端口和 Key 只写在配置文件里,安装脚本直接读取。
变量 | 默认值 | 说明 |
|
| Bearer 鉴权 |
|
| 端口 |
|
| 监听地址 |
|
| 传输 |
# 客户端 Header
Authorization: Bearer gmk-web-x-2026
# 或: X-API-Key: gmk-web-x-2026
# MCP: http://127.0.0.1:17666/mcp
# 健康: GET /health(无需鉴权)改 key/端口:编辑 config.env → ./install.sh 或 systemctl --user restart grok-mcp。
Related MCP server: evo-scry
目录结构
grok-mcp/
├── README.md / DEPLOY.md # 说明
├── config.env # ★ key / 端口 等(改这里)
├── .env.example # 配置模板
├── install.sh # ★ 一键安装入口
├── install-service.sh # 安装实现
├── server.py / auth.py
├── grok-mcp.service.in # systemd 模板
├── run.sh / run_stdio.sh
└── test_auth.sh工具列表
Tool | 说明 |
| 网页搜索(支持 |
| 打开 URL,返回正文文本 |
| 新闻搜索 |
| X 关键词 / 高级语法搜索 |
| 搜用户 |
| 自然语言找相关帖 |
| 当前热搜 |
| twitter CLI 登录状态 |
说明:这是 等效能力 封装,不是 Grok 内置索引的直出。X 完整帖搜索需可选配置
TWITTER_AUTH_TOKEN+TWITTER_CT0。
安装
cd /path/to/grok-mcp
# 可选:编辑 config.env(key / 端口,有默认值)
./install.sh不改配置也能装:默认 key=gmk-web-x-2026,端口=17666。
完整部署说明见 DEPLOY.md。
启动
开机自启(推荐,重启后自动恢复)
已配置 user systemd 服务,机器重启后会自动拉起(Linger=yes):
# 一键安装 / 启用 / 重启(读 config.env)
cd /path/to/grok-mcp
./install.sh
# 常用命令
systemctl --user status grok-mcp # 状态
systemctl --user restart grok-mcp # 重启服务
systemctl --user stop grok-mcp # 停止
systemctl --user disable grok-mcp # 取消开机自启
journalctl --user -u grok-mcp -f # 看日志
curl -s http://127.0.0.1:17666/health # 健康检查项 | 值 |
Unit 文件 |
|
副本 |
|
开机启用 |
|
崩溃恢复 |
|
配置加载 |
|
修改 config.env 后需:
systemctl --user restart grok-mcpHTTP 前台调试
cd /home/ubuntu/grok-mcp
./run.sh
# → http://0.0.0.0:17666/mcp
# 注意:若 systemd 已在跑,会端口冲突;先 systemctl --user stop grok-mcpstdio(本地 MCP 客户端拉起进程,不走 HTTP 鉴权)
./run_stdio.sh鉴权自测
# 服务已由 systemd 运行时:
./test_auth.sh http://127.0.0.1:17666期望:
GET /health→ 200POST /mcp无 key → 401POST /mcp有Authorization: Bearer gmk-web-x-2026→ 非 401
客户端配置
1) Grok — HTTP + Bearer
~/.grok/config.toml:
[mcp_servers.grok-mcp]
url = "http://127.0.0.1:17666/mcp"
headers = { Authorization = "Bearer gmk-web-x-2026" }
enabled = true或 CLI:
grok mcp add --transport http grok-mcp http://127.0.0.1:17666/mcp \
--header "Authorization: Bearer gmk-web-x-2026"2) Grok — stdio(本机进程)
[mcp_servers.grok-mcp]
command = "python3"
args = ["/home/ubuntu/grok-mcp/server.py"]
env = { GROK_MCP_TRANSPORT = "stdio" }
enabled = truegrok mcp add grok-mcp --env GROK_MCP_TRANSPORT=stdio -- \
python3 /home/ubuntu/grok-mcp/server.py3) Claude Code / Cursor — mcp.json
HTTP:
{
"mcpServers": {
"grok-mcp": {
"url": "http://127.0.0.1:17666/mcp",
"headers": {
"Authorization": "Bearer gmk-web-x-2026"
}
}
}
}stdio:
{
"mcpServers": {
"grok-mcp": {
"command": "python3",
"args": ["/home/ubuntu/grok-mcp/server.py"],
"env": {
"GROK_MCP_TRANSPORT": "stdio",
"GROK_MCP_API_KEY": "gmk-web-x-2026"
}
}
}
}4) curl 示例
# 健康检查(无需 key)
curl -s http://127.0.0.1:17666/health
# 带鉴权访问 MCP 端点
curl -s http://127.0.0.1:17666/mcp \
-H "Authorization: Bearer gmk-web-x-2026" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'5) mcporter
{
"mcpServers": {
"grok-mcp": {
"url": "http://127.0.0.1:17666/mcp",
"headers": {
"Authorization": "Bearer gmk-web-x-2026"
}
}
}
}mcporter list grok-mcp --schema
mcporter call grok-mcp.web_search query="MCP protocol" num_results=5
mcporter call grok-mcp.x_trending region=worldwide环境变量
变量 | 默认 | 说明 |
|
| HTTP Bearer key |
|
|
|
|
| 监听地址 |
|
| 监听端口 |
| — | 可选,增强 X 搜索 |
| — | 可选,增强 X 搜索 |
安全说明
生产环境务必更换
GROK_MCP_API_KEY,不要使用仓库示例值。公网暴露时建议再加反向代理(TLS + IP 限制)。
config.env含密钥,勿提交到公开仓库(可只提交.env.example)。stdio 模式由本机客户端 spawn,一般不校验 HTTP Bearer;请控制谁能启动该进程。
能力边界
能力 | 说明 |
Web 搜索 | DuckDuckGo 聚合,非 Grok 专有索引 |
打开网页 | httpx 抓取 + 简易去 HTML |
X 热搜 | trends24 等公开站 |
X 实时帖 | 有 cookie 时走 twitter-cli;否则 |
故障排查
现象 | 处理 |
HTTP 401 | 检查 |
连不上 | 确认 |
| 网络 / DDG 限流,稍后重试 |
X 结果质量差 | 配置 |
# 查看 key 是否加载
python3 -c "from pathlib import Path; import os; exec(open('server.py').read().split('mcp =')[0]); print('key', API_KEY)"
# 或直接:
grep GROK_MCP_API_KEY config.envThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/dq52099/grok-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server