StackOverflow MCP Server
Provides tools for searching and retrieving Stack Overflow questions, answers, and related content via the Stack Exchange API. Includes advanced search filters, HTML-to-Markdown conversion, and rate limit management.
Click on "Deploy 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., "@StackOverflow MCP Serversearch for Python async questions"
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.
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-mcpUsing Python Module
# Direct execution
python -m stackoverflow_mcp
# With uv (recommended)
uv run python -m stackoverflow_mcp --api-key your_keyRelated MCP server: stack-overflow-mcp-light
šÆ 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
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 startProject 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 filesTesting
# 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
Available Tools
5 toolsget_answersA
Get answers for a specific StackOverflow question.
Fetches only answers without re-fetching the question body.
Use this when you already have the question context and just need the responses.
Args:
question_id: StackOverflow question ID
max_answers: Maximum number of answers to return (1-50)
sort: Sort order (votes, creation, activity)
convert_to_markdown: Convert HTML content to markdown
Inputs: question_id (required), sort, max_answers, convert_to_markdown.
get_questionA
Get detailed information about a specific question.
Args:
question_id: StackOverflow question ID
include_answers: Whether to include answers
max_answers: Maximum number of answers to include (1-20)
convert_to_markdown: Convert HTML content to markdown
Inputs: question_id (required), max_answers, include_answers, convert_to_markdown.
search_by_tagsA
Search StackOverflow questions by programming tags.
Args:
tags: List of tags to search for (e.g., ['python', 'async'])
limit: Maximum number of results (1-50)
page: Page number for pagination (minimum 1)
sort: Sort order (activity, votes, creation, relevance)
site: Site name to search in (e.g., stackoverflow, serverfault, askubuntu)
Inputs: tags (required), page, site, sort, +1 more.
search_questionsA
Search StackOverflow questions by keywords.
Supports combined keyword + tag search. When searching by tags only,
pass an empty string for query.
Args:
query: Search query keywords (empty string for tag-only search)
limit: Maximum number of results (1-50)
page: Page number for pagination (minimum 1)
sort: Sort order (relevance, activity, votes, creation)
site: Site name to search in (e.g., stackoverflow, serverfault, askubuntu)
tags: Filter by tags (list of tag names)
accepted_only: Only return questions with an accepted answer
min_score: Minimum score threshold
from_date: Earliest creation date (Unix timestamp)
to_date: Latest creation date (Unix timestamp)
Inputs: query (required), page, site, sort, +6 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
TDQS
Scored across 5 tools
Each tool targets a distinct aspect of StackOverflow: retrieving a question, retrieving answers, finding related questions, searching by tags, and searching by keywords. There is no ambiguity between them.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., get_question, search_by_tags). No deviations or mixed conventions.
With 5 tools, the set is well-scoped for a StackOverflow Q&A server. It covers core retrieval and discovery operations without being excessive or insufficient.
The tool set covers key read operations: question retrieval, answer retrieval, related questions, and two search methods. Missing operations like comment or user retrieval are minor gaps for a read-only informational server, but core workflows are well supported.
Maintenance
Related MCP Connectors
Serper MCP ā wraps the Serper Google Search API (serper.dev)
Market Data App MCP ā wraps the Market Data App API (marketdata.app)
Search and inspect source-pinned agent skills, plugins and tools through a free public MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceWraps the StackExchange API v2.3 to enable reading StackExchange data (questions, answers, etc.) without authentication. Allows AI agents to query StackExchange content through natural language or direct tool calls.317 npm1MIT
- AlicenseBqualityDmaintenanceMCP server for searching Stack Overflow questions and retrieving answers with body content, supporting advanced filters and multiple transport types.317 PyPIMIT
- AlicenseNot gradedqualityCmaintenanceMCP server for Stack Overflow for Agents, enabling search, post creation, voting, and knowledge exchange for AI agents.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceSearch Stack Exchange questions, fetch complete Q&A threads as clean markdown, browse tag FAQs, and look up user profiles via MCP.182 npm2Apache 2.0