社区研究MCP
来自经验丰富的开发人员的街头智慧提示、技巧和变通方法。
一个MCP服务器,可以挖掘Stack Overflow、GitHub Issues、Hacker News和其他开发人员的漏洞,找到经过实战考验的解决方案、巧妙的变通方法和实际可行的现实模式。
┌────────────────────────────────────────────────────────────────────────┐
│ "How do I handle FastAPI background tasks with Redis?" │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌────────────┐ │
│ │ Stack │ │ GitHub │ │ Hacker │ │ Discourse │ │
│ │ Overflow │ │ Issues │ │ News │ │ Forums │ │
│ └──────┬───────┘ └──────┬───────┘ └──────┬───────┘ └─────┬──────┘ │
│ │ │ │ │ │
│ └─────────────────┴─────────────────┴────────────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Deduplicate │ │
│ │ & Score │ │
│ └────────┬────────┘ │
│ │ │
│ ┌────────▼────────┐ │
│ │ Ranked Results │ │
│ │ with Quality │ │
│ │ Scores 0-100 │ │
│ └─────────────────┘ │
└────────────────────────────────────────────────────────────────────────┘______________________________________________________________________
快速开始
1.安装
git clone https://github.com/your-repo/community-research-mcp.git
cd community-research-mcp
pip install -e .2.配置克劳德桌面
把这个放到你的 claude_desktop_config.json:
{
"mcpServers": {
"community-research": {
"command": "python",
"args": ["-m", "community_research_mcp"],
"cwd": "/path/to/community-research-mcp"
}
}
}3.使用它
问问克劳德:
*“搜索Python异步数据库连接池模式”*
MCP利用开发人员社区,展示具有质量分数的排名解决方案。
推荐型号
使用克劳德·海库3.5,而不是作品4.5 Opus 4.5倾向于忽略MCP指令,将您的查询重新表述为您没有问过的内容,并搜索无关紧要的主题,而不是使用它得到的结果。Haiku 3.5更可靠地遵循MCP的指导。
______________________________________________________________________
它做什么
多源搜索
点击量 9个开发者社区 马上:
| 来源 | 您得到什么 | API密钥? |
|---|---|---|
| 堆栈溢出 | 问答金 | 否 |
| GitHub问题 | Bug报告、解决方法 | 可选 |
| 黑客新闻 | 技术战争故事 | 否 |
| 龙虾 | 深度技术潜水 | 否 |
| 论述 | 特定语言论坛 | 否 |
| Serper | 谷歌搜索结果 | 是 |
| 塔维利 | AI优化搜索 | 是 |
| 勇敢 | 以隐私为中心的搜索 | 是 |
| 火爬 | 网络抓取 | 是 |
质量评分
每个结果都得到一个 街头信誉评分(0-100) 基于:
| 信号 | 这意味着什么 |
|---|---|
| 来源权威机构 | Stack Overflow接受的答案击败了随机博客帖子 |
| 社区验证 | 支持票、反应——人群已经发声 |
| 近期性 | 快速发展的技术的新解决方案 |
| 特异性 | 实际代码,而不是波浪形解释 |
| 证据 | 基准、重复步骤、实际数字 |
结构可靠性
| 功能 | 为什么重要 |
|---|---|
| 断路器 | 停止敲打死API |
| 自动重试 | 片状连接的指数回退 |
| 去重 | 消除重复结果(降噪约20%) |
| 缓存 | 1小时TTL,这样您就不会耗尽速率限制 |
______________________________________________________________________
配置
环境变量
创建一个 .env 文件:
# Web Search APIs (unlock more sources)
SERPER_API_KEY=your_key # https://serper.dev
TAVILY_API_KEY=your_key # https://tavily.com
BRAVE_SEARCH_API_KEY=your_key # https://brave.com/search/api
FIRECRAWL_API_KEY=your_key # https://firecrawl.dev
# Higher rate limits
GITHUB_TOKEN=your_token # https://github.com/settings/tokens
STACKEXCHANGE_API_KEY=your_key # https://stackapps.com
# Reddit (requires app registration)
REDDIT_CLIENT_ID=your_id
REDDIT_CLIENT_SECRET=your_secret
REDDIT_REFRESH_TOKEN=your_token源权重
调整优先事项 config.json:
{
"sources": {
"stackoverflow": {"enabled": true, "weight": 10},
"github": {"enabled": true, "weight": 9},
"hackernews": {"enabled": true, "weight": 6},
"serper": {"enabled": true, "weight": 4}
}
}权重越高=街道智能解决方案越受信任。
______________________________________________________________________
MCP工具
community_search
主要的劳动力。搜索所有启用的源并返回排名结果。
language: "Python"
topic: "async SQLAlchemy connection pooling with FastAPI"
goal: "Handle 1000 concurrent database connections"
current_setup: "FastAPI + PostgreSQL + SQLAlchemy 2.0"get_source_status
检查所有源的情况-启用、API键、断路器跳闸等。
get_rate_limit_status
查看您在所有API中消耗了多少配额。
clear_cache
当你需要新的结果时,清空搜索缓存。
______________________________________________________________________
速率限制
| 来源 | 免费层 | 使用API密钥 |
|---|---|---|
| 堆栈交换 | 300/天 | 10000/天 |
| GitHub | 10/分钟 | 30/分钟 |
| 黑客新闻 | 1000/小时 | -- |
| Serper | -- | 2500/月 |
| Tavily | -- | 1000/月 |
| 勇敢 | -- | 2000/月 |
______________________________________________________________________
项目结构
community-research-mcp/
├── community_research_mcp.py # Main MCP server & tools
├── api/ # Source integrations
│ ├── stackexchange.py # Stack Overflow + 19 SE sites
│ ├── github.py # GitHub Issues
│ ├── hackernews.py # HN via Algolia
│ ├── lobsters.py # Lobsters.rs
│ ├── discourse.py # Discourse forums
│ ├── serper.py # Google Search
│ ├── tavily.py # Tavily API
│ ├── brave.py # Brave Search
│ └── firecrawl.py # Web scraping
├── core/ # Reliability & quality
│ ├── reliability.py # Circuit breaker, retry logic
│ ├── quality.py # Quality scoring
│ ├── dedup.py # Deduplication
│ └── metrics.py # Performance monitoring
├── models/ # Pydantic models
├── utils/ # Cache, rate limiting
└── tests/ # Test cases______________________________________________________________________
发展
运行测试
pytest tests/代码风格
black . && isort . # Format
flake8 && mypy . # Lint添加新源
- 创建
api/yoursource.py使用asyncsearch()函数 - 出口自
api/__init__.py - 添加到源配置
community_research_mcp.py - 添加速率限制信息
______________________________________________________________________
故障排除
"No results found"
- 使您的查询更具体(不仅仅是“性能”或“设置”)
- 检查是否为web搜索源设置了API键
- 跑
get_source_status查看断路器是否跳闸
"Rate limit exceeded"
- 冷静下来,等待窗口重置
- 添加API密钥以获得更高的限制
- 依靠缓存来避免重复搜索
"Source is failing"
- 检查
get_source_status断路器状态 - 断路器在5次故障后跳闸,5分钟后重置
- 有时,消息来源会突然中断——这种情况确实会发生
______________________________________________________________________
贡献
- 分叉回购
- 创建要素分支
- 进行更改
- 运行测试和梳理
- 提交PR
______________________________________________________________________
MIT许可证 --看 许可证 了解详情。
*专为那些想要真正的解决方案而不是文档绒毛的开发人员而设计。*
