MCP server that lets AI assistants search Stack Overflow and other Stack Exchange sites.
pip install stackexchange-mcp Copy PIP instructions
An MCP server that lets your AI assistant search Stack Overflow and other Stack Exchange sites, read questions with their best answers, and ground its debugging help in real, voted answers instead of guessing.
Not affiliated with Stack Exchange, Inc. Content returned by the API is licensed CC BY-SA (3.0 or 4.0 depending on the post). The server returns the author, link and license so assistants can attribute it.
[project] name = "mcp-server" version = "0.1.0" requires-python = ">=3.12" dependencies = [ "httpx>=0.28.1", "mcp[cli]>=1.0, =2.14.2", ]
[dependency-groups] dev = [ "pytest>=9.2.0", ]
The server works without a key, but the anonymous quota is small: the API reported 300 requests per day without a key and 10,000 with one. Register an app on Stack Apps to get a key; you do not need OAuth for read-only use.
You need uv. The server runs straight from PyPI:
uvx stackexchange-mcp (That starts a stdio server and waits; you normally let your AI app launch it using one of the configs below.)
Use the full path to uvx if your app cannot find it (which uvx).
VS Code (GitHub Copilot, Agent mode) - .vscode/mcp.json:
{ "servers": { "stackexchange": { "type": "stdio", "command": "uvx", "args": ["stackexchange-mcp"], "env": { "STACKEXCHANGE_KEY": "${input:se_key}" } } }, "inputs": [ { "type": "promptString", "id": "se_key", "description": "Stack Exchange API key", "password": true } ] } Antigravity CLI - .agents/mcp_config.json in your project (or ~/.gemini/config/mcp_config.json globally):
{ "mcpServers": { "stackexchange": { "command": "uvx", "args": ["stackexchange-mcp"], "env": { "STACKEXCHANGE_KEY": "your-key" } } } } Start agy and run /mcp to confirm it is connected.
claude mcp add --env STACKEXCHANGE_KEY=your-key stackexchange -- uvx stackexchange-mcp Claude Desktop (macOS/Windows) and Cursor - same JSON shape as Antigravity (mcpServers), in claude_desktop_config.json or ~/.cursor/mcp.json.
The API key is never written to logs or error messages.
You do not need to name a tool. Things that should make the assistant use this server:
git clone https://github.com/YashLimbani/stackexchange-mcp cd stackexchange-mcp uv sync uv run pytest -q npx @modelcontextprotocol/inspector uv run stackexchange-mcp Tests need no network: the API is mocked using real saved responses in samples/. See DESIGN.md for the design and CONTRIBUTING.md for how to help.
MIT for the code (see LICENSE). Stack Exchange content is CC BY-SA; attribute the author and link when you reuse it.
ai llm mcp model-context-protocol stackexchange stackoverflow
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




