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 "Install 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
| Name | Required | Description | Default |
|---|---|---|---|
| sort | No | votes | |
| max_answers | No | ||
| question_id | Yes | ||
| convert_to_markdown | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It discloses that only answers are fetched (not question body), which is a key behavioral trait. However, it does not mention potential rate limits, authentication requirements, or pagination behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is concise with clear sections: a title line, a purpose sentence, usage guidance, and a structured Args list. No redundant information. Could be slightly more compact but overall efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no output schema and no annotations, the description provides adequate information for invocation: purpose, when to use, and parameter details. However, it lacks description of return format or example usage, which would be helpful.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema has 0% description coverage, so description must compensate. It adds meaning for each parameter: specifies question_id type, max_answers range (1-50), sort order options (votes, creation, activity), and convert_to_markdown purpose. This significantly enhances schema understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Get answers for a specific StackOverflow question' and distinguishes from sibling tools like 'get_question' by noting it fetches only answers without re-fetching the question body.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly says 'Use this when you already have the question context and just need the responses', providing clear when-to-use guidance. Also specifies constraints like max_answers range (1-50) and sort order options.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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
| Name | Required | Description | Default |
|---|---|---|---|
| max_answers | No | ||
| question_id | Yes | ||
| include_answers | No | ||
| convert_to_markdown | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only lists parameters. It does not disclose behavioral traits such as safety (read-only), error handling (missing ID), rate limits, or return format.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is brief and front-loaded with the main purpose. No redundant sentences, but it could be more structured (e.g., bullet points) for faster scanning.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 4 parameters and no output schema, the description covers parameters but lacks information about the return structure (e.g., what fields are returned) and error handling. This is a moderate gap for a retrieval tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, but the description adds meaningful explanations for all four parameters (e.g., 'Maximum number of answers to include (1-20)'). This compensates well, though defaults and interactions are not explained.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool retrieves detailed information for a specific question, using a specific verb-resource pair. It distinguishes from siblings like get_answers (answers only) and get_related (related questions).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives like search_questions or get_answers. Context is implied (when you have a question ID) but not stated, and no exclusions are mentioned.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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)
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| site | No | stackoverflow | |
| sort | No | activity | |
| tags | Yes | ||
| limit | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, and the description does not disclose behavioral traits like authentication needs, rate limits, or error handling. It only describes parameters without behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise and structured as a docstring with Args. It is front-loaded with the main purpose and parameter details. However, the Pythonic format may be less familiar to some agents.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description explains all parameters but lacks information about return format, pagination behavior beyond page parameter, and error handling. Given the number of parameters and no output schema, it is adequate but not fully complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant meaning beyond the schema: it defines tag format with examples, constrains limit (1-50) and page (minimum 1), enumerates sort values, and gives site examples. Schema coverage is 0%, so the description fully compensates.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states it searches StackOverflow questions by programming tags, with a specific verb and resource. It distinguishes from siblings like search_questions by focusing on tag-based filtering.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives. The description does not mention when to prefer this over search_questions or other siblings, nor does it provide exclusions or prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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)
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | ||
| site | No | stackoverflow | |
| sort | No | relevance | |
| tags | No | ||
| limit | No | ||
| query | Yes | ||
| to_date | No | ||
| from_date | No | ||
| min_score | No | ||
| accepted_only | No |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It mentions combined keyword+tag search behavior but omits details on rate limits, authentication, or result handling. The parameter descriptions are thorough but not behavioral.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-structured: a clear one-liner purpose, a secondary usage note, and a bulleted parameter list. It is concise and every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description does not explain the return value format or structure, which is critical since no output schema exists. It also lacks details on pagination behavior or how to handle results.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description fully carries the burden. It provides a complete parameter list with meaningful explanations for all 10 parameters, including usage nuances like 'empty string for tag-only search' for query and 'list of tag names' for tags.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool searches StackOverflow questions by keywords, and explicitly mentions combined keyword+tag search. It differentiates from siblings like search_by_tags by explaining how to perform tag-only searches with an empty query.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a usage hint for tag-only searches (empty query) but does not explicitly compare with the sibling tool search_by_tags or state when not to use this tool. It lacks clear guidance on alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
5 tool updates
v1.3.3- First observed
get_answers - First observed
get_question - First observed
get_related - First observed
search_by_tags - First observed
search_questions
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
StackExchange MCP ā wraps the StackExchange API v2.3 (free, no auth required for read)
Search Stack Exchange questions, fetch Q&A threads as markdown, look up tag FAQs and user profiles.
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP ā built for coding agents.
- OneOAuthai.withone
Search, document and execute authenticated API calls across 700+ apps via one MCP server
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Linear resources through an MCP interface, offering functionality for issue management and resource retrieval with rate limiting and error handling support.7131MIT
- AlicenseBqualityCmaintenanceMCP server for searching Stack Overflow questions and retrieving answers with body content, supporting advanced filters and multiple transport types.3MIT
- FlicenseNot gradedqualityCmaintenanceProvides MCP tools for searching, retrieving, and answering questions about indexed Nextcloud developer documentation from multiple sources.-
- AlicenseNot gradedqualityBmaintenanceAgent-native developer Q&A service providing MCP tooling and A2A runtime endpoints for deep research and citations.2MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/NoTalkTech/stackoverflow-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server