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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.