StackOverflow MCP Server
Provides seamless access to StackOverflow's Q\&A database through MCP, enabling advanced search, question/answer retrieval, and rate-limit management.
README
StackOverflow MCP Server
A Model Context Protocol (MCP) server that provides seamless access to StackOverflow's programming Q&A database using the FastMCP framework.
Quick Start
Using with Cursor (Recommended)
Add this configuration to your Cursor MCP settings:
{
"mcp_servers": {
"stackoverflow": {
"command": "npx",
"args": [
"-y",
"@notalk-tech/stackoverflow-mcp",
"--api-key", "your_stackoverflow_api_key"
]
}
}
}
Using NPX
# Run directly (no installation required)
npx @notalk-tech/stackoverflow-mcp
# With API key
npx @notalk-tech/stackoverflow-mcp --api-key your_key
# Skip installation prompts
npx -y @notalk-tech/stackoverflow-mcp
Using Python Module
# Direct execution
python -m stackoverflow_mcp
# With uv (recommended)
uv run python -m stackoverflow_mcp --api-key your_key
🎯 Features
- 🔍 Advanced Search: Search by keywords, tags, accepted status, score threshold, and date ranges
- 📖 Question Details: Get detailed content with automatic HTML-to-Markdown conversion
- 🏷️ Tag-based Search: Convenient tag-only search (proxies to main search)
- 💡 Related Questions: Discover related and linked questions for deeper exploration
- ⚡ Rate Limit Management: Intelligent retry, backoff, and auto-switching between authenticated/unauthenticated access
- 🔐 API Authentication: Full support for StackOverflow API keys with automatic quota tracking
- 📦 Unified Response Format: All tools return consistent
{success, data, meta}structure - 🚀 Auto-deployment: NPX-compatible with automatic Python environment setup
🔑 Getting Your API Key
To use this MCP server with higher rate limits, you'll need a StackOverflow API key:
Steps
-
Register Your Application
- Visit https://stackapps.com/applications/register
- Log in with your Stack Exchange account
- Fill in application details (name, description, OAuth domain)
- Submit the registration
-
Generate Your API Key
- Go to your application management page
- Click "Generate a new API key"
- Copy and save the generated key securely
Rate Limits
- Without API key: 300 requests/day per IP
- With API key: 10,000 requests/day
For read-only operations (searching and retrieving Q&A), a simple API key is sufficient. OAuth is only needed for write operations.
Learn more: https://api.stackexchange.com/docs/authentication
⚙️ Configuration
Create a .stackoverflow-mcp.json file in your working directory:
{
"stackoverflow_api_key": "your_api_key_here",
"log_level": "CRITICAL"
}
The server auto-discovers config files in this order:
.stackoverflow-mcp.jsonstackoverflow-mcp.config.jsonconfig/stackoverflow-mcp.json.config/stackoverflow-mcp.json
Command Line Options
--working-dir DIRECTORY Working directory (auto-detect if not specified)
--api-key TEXT StackOverflow API key
--version Show version and exit
--help Show help message
🌐 Available Tools
Once running, the MCP server provides these tools:
search_questions: Search StackOverflow questions by keywords with optional filters —tags,accepted_only,min_score,from_date,to_datesearch_by_tags: Convenience wrapper for tag-only search (proxies tosearch_questions)get_question: Get detailed question content with optional answer limiting (max_answers) and automatic HTML-to-Markdown conversionget_answers: Fetch answers independently without re-fetching the question bodyget_related: Discover related and linked questions for further exploration
Resource
stackoverflow://status: Server status including version, authentication state, rate limit status, and queue statistics
📋 Prerequisites
- Node.js 14.0.0 or higher
- Python 3.12 or higher
- uv (recommended) or pip
The NPX wrapper automatically handles Python package installation and environment setup.
🚀 Development
Local Setup
git clone https://github.com/NoTalkTech/stackoverflow-mcp.git
cd stackoverflow-mcp
# Install dependencies
npm install
pip install -e .
# Run in development mode
npm start
Project Structure
stackoverflow-mcp/
├── cli.js # NPX wrapper (Node.js)
├── package.json # NPM package configuration
├── pyproject.toml # Python package configuration
├── src/stackoverflow_mcp/ # Python MCP server
│ ├── __main__.py # Python module entry point
│ ├── main.py # CLI and server management
│ ├── server.py # MCP server implementation (5 tools + resource)
│ ├── config.py # Server configuration management
│ ├── logging.py # Logging configuration
│ └── stackoverflow_client.py # StackOverflow API client (rate limiting, caching, content formatting)
└── tests/ # Test files
Testing
# Run all tests
.venv/bin/python -m pytest tests/ -v
# Test npm package
npm test
🤝 Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🆘 Support
- Issues: GitHub Issues
- Documentation: GitHub README
🙏 Acknowledgments
- Model Context Protocol for the MCP specification
- StackOverflow for providing the API
- The open-source community for inspiration and contributions
Made for the developer community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。