Agent Eyes v1.0.0 — search + read the entire internet
Based on x-reader by @runes_leo (MIT License). Extended with: - Reddit support (posts + comments, proxy support) - GitHub support (repos, issues, PRs) - Web search via Exa semantic search - Reddit search (bypasses IP blocks via Exa) - GitHub search (repos by stars) - Renamed package: x_reader → agent_eyes - New MCP tools: search, search_reddit, search_github - Agent-first positioning and documentation
This commit is contained in:
+65
-6
@@ -9,7 +9,7 @@ Usage:
|
||||
Claude Code config (~/.claude/claude_desktop_config.json):
|
||||
{
|
||||
"mcpServers": {
|
||||
"x-reader": {
|
||||
"agent-eyes": {
|
||||
"command": "python",
|
||||
"args": ["/path/to/x-reader/mcp_server.py"]
|
||||
}
|
||||
@@ -23,12 +23,12 @@ from mcp.server.fastmcp import FastMCP
|
||||
|
||||
load_dotenv()
|
||||
|
||||
from x_reader.reader import UniversalReader
|
||||
from x_reader.schema import UnifiedInbox
|
||||
from agent_eyes.reader import UniversalReader
|
||||
from agent_eyes.schema import UnifiedInbox
|
||||
|
||||
mcp = FastMCP(
|
||||
"x-reader",
|
||||
instructions="Universal content reader — give it any URL, get structured content back.",
|
||||
"agent-eyes",
|
||||
instructions="Give your AI Agent eyes to see the entire internet. Search, read, and extract content from any platform.",
|
||||
)
|
||||
|
||||
reader = UniversalReader(inbox=UnifiedInbox())
|
||||
@@ -85,11 +85,70 @@ async def detect_platform(url: str) -> str:
|
||||
Detect which platform a URL belongs to.
|
||||
|
||||
Returns the platform name: youtube, bilibili, twitter, wechat,
|
||||
xhs, telegram, rss, or generic.
|
||||
xhs, reddit, github, telegram, rss, or generic.
|
||||
"""
|
||||
return reader._detect_platform(url)
|
||||
|
||||
|
||||
# ==================== Search Tools (NEW in Agent Eyes) ====================
|
||||
|
||||
@mcp.tool()
|
||||
async def search(query: str, num_results: int = 5) -> str:
|
||||
"""
|
||||
Search the entire web using semantic search (powered by Exa).
|
||||
|
||||
Great for finding articles, blog posts, discussions on any topic.
|
||||
Supports site: prefix, e.g. "site:reddit.com AI agent" to limit to specific sites.
|
||||
|
||||
Requires EXA_API_KEY env var. Get a free key at https://exa.ai
|
||||
|
||||
Args:
|
||||
query: Search query
|
||||
num_results: Number of results (1-10, default 5)
|
||||
"""
|
||||
import json
|
||||
from agent_eyes.fetchers.search import search_web
|
||||
|
||||
results = await search_web(query, num_results=num_results)
|
||||
return json.dumps(results, ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def search_reddit(query: str, subreddit: str = "", limit: int = 10) -> str:
|
||||
"""
|
||||
Search Reddit posts. Bypasses Reddit IP blocks via Exa.
|
||||
|
||||
Args:
|
||||
query: Search query
|
||||
subreddit: Optional subreddit name (e.g. "LocalLLaMA"). Empty = all of Reddit.
|
||||
limit: Number of results (default 10)
|
||||
"""
|
||||
import json
|
||||
from agent_eyes.fetchers.search import search_reddit_via_exa
|
||||
|
||||
sub = subreddit if subreddit else None
|
||||
results = await search_reddit_via_exa(query, subreddit=sub, num_results=limit)
|
||||
return json.dumps(results, ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
async def search_github(query: str, limit: int = 5) -> str:
|
||||
"""
|
||||
Search GitHub repositories by keyword.
|
||||
|
||||
Returns repos sorted by stars. No API key needed for public repos.
|
||||
|
||||
Args:
|
||||
query: Search query (e.g. "LLM agent framework", "language:python RAG")
|
||||
limit: Number of results (default 5)
|
||||
"""
|
||||
import json
|
||||
from agent_eyes.fetchers.github import search_github as _search_gh
|
||||
|
||||
results = await _search_gh(query, limit=limit)
|
||||
return json.dumps(results, ensure_ascii=False, indent=2)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
|
||||
|
||||
Reference in New Issue
Block a user