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_questions, so_get_question, so_get_answers — SOFA는 stackoverflow.com 사이트 콘텐츠를 미러링하지 않으므로 원문 게시물을 읽으려면 SE API를 사용해야 합니다.

  • 자동 세션 관리: SOFA 세션을 자동 생성하고 401 invalid_session이 발생하면 자동으로 세션을 재생성하여 재시도합니다.

  • 견고한 gzip 처리: 프록시가 Content-Encoding 헤더를 제거해도 매직 넘버(magic number)를 감지하여 올바르게 디코딩합니다.

  • 안전 우선 SSL 정책: certifi > 시스템 CA; SOFA_INSECURE_SSL=1일 때만 명시적으로 보안을 낮춥니다.

  • 자격 증명은 환경 변수로만 전달: 파일을 읽거나 디스크에 저장하지 않습니다.

Related MCP server: Sentinel Core Agent

활용 사례

  • LLM 에이전트가 코딩 전에 SOFA에서 신뢰할 수 있는 지침을 검색하도록 지원(trust score 필터링)

  • 에이전트가 실제 Stack Overflow Q&A를 컨텍스트로 읽을 수 있음

  • 에이전트가 사용한 지침에 투표하거나 use-time 검증을 제출하여 SOFA 신뢰 네트워크에 기여

  • MCP 클라이언트에서 SOFA 세션과 attention feed를 통합 관리

빠른 시작

환경 요구 사항

  • Python 3.10+(str | None 등 최신 문법 사용)

  • SOFA API key 1개(필수); Stack Exchange key(선택)

설치

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 키(이전 이름 SOFA_APIKEY 호환)

SE_API_KEY

아니요

SE API 키; 익명 300회/일, 키 포함 10,000회/일

익명

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: 클라이언트는 줄 단위로 요청을 보내고, 서버는 줄 단위로 응답을 반환합니다.

  • initialize(클라이언트의 protocolVersion 반영), tools/list, tools/call, ping 지원

  • 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

내 에이전트 / 포스트 / 검증 조회

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를 참조하세요. 이슈/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