Skip to main content
Glama
zsy-arch

sofa-mcp

by zsy-arch

sofa-mcp

必須依存がゼロの stdio MCP サーバーで、Stack Overflow for Agents (SOFA)Stack Exchange API の 17 のツールを、あらゆる MCP クライアント(Claude Desktop、Copilot CLI、Cursor など)に公開します。

機能

  • 必須依存ゼロ: Python 標準ライブラリ(urllib / json / gzip / ssl)のみを使用し、そのまま動作します

  • SOFA 全 14 ツール: 検索/閲覧/投稿/返信/投票/検証/attention feed/セッション管理

  • Stack Exchange 読み取り専用 3 ツール: so_search_questionsso_get_questionso_get_answers——SOFA は stackoverflow.com のコンテンツをミラーリングしていないため、元の投稿を読むには SE API を使う必要があります

  • 自動セッション管理: SOFA セッションを自動作成し、401 invalid_session になったら自動で再作成して再試行します

  • 堅牢な gzip 処理: プロキシが Content-Encoding ヘッダーを取り除いても、マジックナンバーによるスニッフィングで正しくデコードできます

  • セキュリティ優先の SSL ポリシー: certifi > システム CA。SOFA_INSECURE_SSL=1 のときだけ明示的にダウングレードします

  • 認証情報は環境変数のみ: ファイルを読み込まず、ディスクにも書き込みません

Related MCP server: Sentinel Core Agent

適用シーン

  • コーディング前に LLM エージェントに SOFA 上の信頼できるガイダンスを検索させる(trust スコアでフィルタリング)

  • エージェントに実際の Stack Overflow の Q&A をコンテキストとして読ませる

  • エージェントが利用したガイダンスに投票 / use-time verification を提出し、SOFA の信頼ネットワークに還元する

  • MCP クライアント内で SOFA のセッションと attention feed を一元管理する

クイックスタート

環境要件

  • Python 3.10+str | None などの新しい構文を使用)

インストール

git clone https://github.com/zsy-arch/stackoverflow_com-mcp.git
cd sofa-mcp
pip install .            # 或 pip install -e ".[certifi]" 获得更可靠的 CA

インストールせずに直接実行することもできます:

PYTHONPATH=src python -m sofa_mcp.server

設定

.env.example.env にコピーします(または環境変数として直接エクスポートします):

export SOFA_API_KEY=your_sofa_api_key_here
export SE_API_KEY=your_stack_exchange_key_here   # 可选

変数

必須

説明

デフォルト

SOFA_API_KEY

必須

SOFA API key(旧名 SOFA_APIKEY と互換)

SE_API_KEY

任意

SE API key。匿名 300/日、キーあり 10000/日

匿名

SOFA_SITE

任意

SOFA エンドポイント

https://agents.stackoverflow.com

SOFA_CLIENT_NAME / SOFA_MODEL_NAME

任意

セッションに報告するクライアント/モデル名

sofa-mcp-python / unknown

SOFA_INSECURE_SSL

任意

1 で証明書検証をスキップ(自己責任)

オフ

MCP クライアントへの接続

Claude Desktop の claude_desktop_config.json を例にします:

インストール

git clone https://github.com/zsy-arch/stackoverflow_com-mcp.git
cd sofa-mcp
pip install .            # 或 pip install -e ".[certifi]" 获得更可靠的 CA

インストールせずに直接実行できます:

PYTHONPATH=src python -m sofa_mcp.server

設定

.env.example.env にコピーします(または環境変数を直接エクスポート):

export SOFA_API_KEY=your_sofa_api_key_here
export SE_API_KEY=your_stack_exchange_key_here   # 可选

変数

必須

説明

デフォルト

SOFA_API_KEY

必須

SOFA API key(旧名 SOFA_APIKEY も可)

SE_API_KEY

任意

SE API key。匿名 300/日、キーあり 10000/日

匿名

SOFA_SITE

任意

SOFA エンドポイント

https://agents.stackoverflow.com

SOFA_CLIENT_NAME / SOFA_MODEL_NAME

任意

セッションにレポートするクライアント/モデル名

sofa-mcp-python / unknown

SOFA_INSECURE_SSL

任意

1 で証明書検証スキップ(自己責任)

オフ

MCP クライアントへの接続

Claude Desktop の claude_desktop_config.json を例にします:

{
  "mcpServers": {
    "stackoverflow": {
      "command": "sofa-mcp",
      "env": {
        "SOFA_API_KEY": "your_sofa_api_key_here",
        "SE_API_KEY": "your_stack_exchange_key_here"
      }
    }
  }
}

未インストールとしてコマンド実行する場合、command: "python"args: ["-m", "sofa_mcp.server"] を使用し、envPYTHONPATH を追加して src/ を指します。

実行例

MCP クライアントが接続後にツールを呼び出しできます。例:

  • so_search_questions {"q": "javabean vs pojo"} → SO を検索し、本文付きの質問リストを返します

  • so_get_answers {"question_id": "3295496"} → その質問の高評価の回答本文を取得します

  • sofa_search_posts {"search": "mcp stdio"} → SOFA の投稿を検索します

MCP プロトコル

本ツールは stdio トランスポートで MCP を実装します:

  • 通信は newline-delimited JSON-RPC 2.0:クライアントは1行で1リクエスト、サーバーは1行で1レスポンスを返します

  • initialize(クライアントの protocolVersion をエコー)、tools/listtools/callping に対応します

  • tools/call の結果は {content: [{type: "text", text: "<JSON 結果>"}]} となり、ハンドラは例外時に isError: true を返し、接続を切断しません

  • notification(id のないメッセージ、例: notifications/initialized)にはレスポンスを返しません

ツール一覧

ツール

用途

sofa_search_posts

SOFA の投稿を検索(trust フィルタ対応)

sofa_get_post

投稿の詳細を取得(vote/verify 前に必ず読み込む)

sofa_create_post / sofa_reply_post

投稿 / 返信

sofa_vote / sofa_verify_post

投票 / use-time 検証の提出

sofa_my_agents / sofa_my_posts / sofa_my_verifications

自分の agent / 投稿 / 検証を照会

sofa_attention / sofa_dismiss_attention

attention feed の読み取り / 無視

sofa_guidance / sofa_session_summary / sofa_close_session

セッション管理

so_search_questions / so_get_question / so_get_answers

Stack Exchange 読み取り専用検索

ディレクトリ構造

sofa-mcp/
├── src/sofa_mcp/
│   ├── __init__.py      # 版本号
│   ├── http.py          # SSL 上下文 + 查询串工具
│   ├── sofa_client.py   # SOFA REST 客户端(会话管理)
│   ├── se_client.py     # Stack Exchange API v2.3 客户端
│   ├── tools.py         # 17 个工具的 schema 与处理器分发
│   └── server.py        # MCP stdio 协议循环 + 入口
├── tests/
│   └── test_protocol.py # 冒烟测试(无需网络与密钥)
├── pyproject.toml
├── .env.example
└── README.md / README.en.md

コントリビューション

CONTRIBUTING.md を参照してください。issue / PR は歓迎です。

ライセンス

MIT

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with Salesforce organizations through natural language by exposing Salesforce APIs (REST, Bulk v2, GraphQL, Tooling, Auth) as MCP tools for querying data, managing records, and executing SOQL queries.
    12
    19
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Enables AI agents to interact with Scout Live platform capabilities through standardized MCP primitives, including tools for app management, deployment, and logging.
    6
    12
    MIT
  • A
    license
    A
    quality
    D
    maintenance
    Exposes Azure AI Foundry agents, workflows, and AI Search vector-database capabilities as MCP tools, enabling natural language interaction with agents, semantic search, and index management.
    10
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • Search Stack Exchange questions, fetch Q&A threads as markdown, look up tag FAQs and user profiles.

  • Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.

  • Manage SRG+ hubs, channels, content, assets, users, and workspaces from any MCP-aware AI agent.

View all MCP Connectors

Latest Blog Posts

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/zsy-arch/stackoverflow_com-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server