Stackexchange Mcp

io.github.YashLimbani由 GitHub 帳號 YashLimbani 發布v0.1.0更新於 Nov 7, 2026

An MCP server that provides [describe what your server does]

概覽

AI 產生的概覽

唯讀的 MCP 伺服器,讓助理搜尋 Stack Overflow 及其他 Stack Exchange 網站,並讀取問題與其最佳回答。

可以做什麼
  • 依主題、標籤、網站、排序方式或僅限已接受回答來搜尋問題
  • 讀取單一問題及其最佳回答,優先顯示已採納的回答
  • 用貼上的錯誤訊息或堆疊追蹤搜尋相關討論,搜尋前會移除路徑、行號與位址
  • 查詢精確的標籤名稱,並取得標籤概覽,包含問題數量與最高票問題
  • 查看剩餘 API 配額以及目前是否處於限流等待
  • 以資源形式提供網站清單、搜尋技巧與配額快照,並提供除錯、方案比較與標籤入門提示詞
適用情境
當你希望除錯協助或技術說明立基於真實且有投票的 Stack Overflow 回答,而非模型自行猜測時適用,例如貼上堆疊追蹤、比較兩種做法,或了解不熟悉的技術標籤。
執行需求
透過 stdio 在本機執行 PyPI 套件 stackexchange-mcp,以 uvx 啟動,因此需要安裝 uv。可選的 Stack Exchange API 金鑰透過 STACKEXCHANGE_KEY 傳入;未設定時匿名配額小得多。另可設定預設網站、快取時間與內文最大長度。需要能連線至 Stack Exchange API 的網路。
安裝前請注意
此伺服器為唯讀,不會發文、投票或編輯。API 金鑰屬於憑證,請勿寫入會提交的檔案,應透過用戶端的 env 設定傳入。回傳內容採 CC BY-SA 授權,需要標示出處;伺服器會回傳作者、連結與授權資訊以便標示。請求會消耗每日 API 配額,配額用盡後伺服器會停止呼叫 API。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Stackexchange Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

stackexchange-mcp

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.

  • Read-only: it never posts, votes or edits anything.
  • Model-friendly output: short summaries, Markdown instead of HTML, code blocks preserved, long posts truncated with a link.
  • Respects the API: optional API key, backoff handling, request spacing, retries, caching and quota tracking.
  • Clear errors: every failure tells the model what happened and what to try next.

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.

What it provides

[project] name = "mcp-server" version = "0.1.0" requires-python = ">=3.12" dependencies = [ "httpx>=0.28.1", "mcp[cli]>=1.0,<2", "pydantic>=2.14.2", ]

[dependency-groups] dev = [ "pytest>=9.2.0", ]

Tools

ToolUse it to
search_questionsFind discussions about a topic. Filter by tags, site, sort order, accepted answers only.
get_questionRead one question with its best answers (accepted answer first).
search_by_error_messageFind threads for a pasted error or stack trace. File paths, line numbers and addresses are stripped before searching.
search_tagsFind exact tag names (so the assistant does not guess tags).
get_tag_overviewGet a technology's summary, question count and top-voted questions.
get_quota_statusSee the remaining API quota and any active rate-limit wait.

Resources

URIContents
stackexchange://sitesSite slugs you can pass as site (cached for 24 hours).
stackexchange://help/search-tipsGuidance on effective searches.
stackexchange://quotaLive quota snapshot (JSON).

Prompts

PromptWhat it does
debug_errorSearches for your error, reads the best two threads, explains the likely fix with links.
compare_approachesCompares two approaches using highly voted discussions.
tag_primerBuilds a beginner overview of a technology from its tag.

Quick start

1. Get a free API key (recommended)

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.

2. Install

You need uv. The server runs straight from PyPI:

bash
uvx stackexchange-mcp

(That starts a stdio server and waits; you normally let your AI app launch it using one of the configs below.)

3. Connect your AI app

Use the full path to uvx if your app cannot find it (which uvx).

VS Code (GitHub Copilot, Agent mode) - .vscode/mcp.json:

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):

json
{  "mcpServers": {    "stackexchange": {      "command": "uvx",      "args": ["stackexchange-mcp"],      "env": { "STACKEXCHANGE_KEY": "your-key" }    }  }}

Start agy and run /mcp to confirm it is connected.

Claude Code:

bash
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.

Keep your key out of files you commit.

Configuration

VariableDefaultPurpose
STACKEXCHANGE_KEYnoneAPI key. Raises the daily quota.
SE_DEFAULT_SITEstackoverflowSite used when a tool call does not specify one.
SE_CACHE_TTL_SECONDS300How long identical requests are cached (0 disables caching).
SE_MAX_BODY_CHARS2000Maximum characters of any question or answer body returned.

Rate limits and errors

  • Identical requests within the cache window cost no quota.
  • If the API sends a backoff value, the server waits it out (up to 10 seconds) before the next call; longer waits are reported instead of blocking.
  • Requests are spaced at least 0.2 seconds apart.
  • Timeouts, network errors and 5xx responses are retried twice with exponential delay (0.5 s, then 1 s).
  • When the daily quota is exhausted the server stops calling the API until the next UTC day.
SituationWhat the assistant is told
Invalid input (bad site, bad tag)Which parameter is wrong and how to fix it.
Question or tag not foundIt may be deleted or on another site; use search_tags.
No search resultsBroaden the query, remove tags, or use search_tags.
Rate limitedHow long to wait.
Quota exhaustedSet STACKEXCHANGE_KEY or wait for the daily reset.
Invalid API keyCheck or unset STACKEXCHANGE_KEY.
Stack Exchange unavailableUsually temporary; try again shortly.

The API key is never written to logs or error messages.

Example prompts

You do not need to name a tool. Things that should make the assistant use this server:

  • "What's the difference between asyncio.sleep and time.sleep? Check Stack Overflow."
  • "I get AttributeError: 'NoneType' object has no attribute 'foo' - find help on Stack Overflow." (paste the traceback)
  • "Is there a Stack Overflow tag for testing async code with pytest?"
  • "I'm new to python-asyncio. Give me an overview from Stack Overflow."
  • "Find recent discussions about Docker networking on Server Fault."

Tested with

Results for each prompt are in TESTING.md.

  • Antigravity CLI: connects and lists all 6 tools. In a 10-prompt run, the model picked the expected tool without being told its name in 9 of 10 prompts (one prompt still needs a re-run) and chose sensible arguments such as site, sort and accepted_only. It correctly used no tool for an unrelated question.
  • VS Code (Copilot Agent mode): the server starts and 6 tools are discovered; tool-call results are not recorded yet.
  • MCP Inspector: connects and lists the server's tools (re-check all resources and prompts before release).

Troubleshooting

  • Server "anonymous (low quota)" in the log: the key did not reach the server. Put STACKEXCHANGE_KEY in the env block of your client's config.
  • Command not found: use the absolute path of uvx in the config.
  • VS Code shows no tools: use a normal Copilot Agent mode chat session in a workspace that contains .vscode/mcp.json; some session types keep their own separate server list.
  • The assistant never calls a tool: ask it explicitly once ("search Stack Overflow for ...") and check the tool list in your client.
  • Logs: the server writes logs to stderr (never stdout, which carries the protocol). In VS Code, open the Output panel and choose the server.

Development

bash
git clone https://github.com/YashLimbani/stackexchange-mcpcd stackexchange-mcpuv syncuv run pytest -qnpx @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.

License

MIT for the code (see LICENSE). Stack Exchange content is CC BY-SA; attribute the author and link when you reuse it.

來源:README.md,提交 b9bce4a

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.1.0最新Nov 7, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分