Skip to main content

MCP client adapter that joins external MCP server tools into the Spakky Agent tool catalog

Project description

spakky-mcp

MCP(Model Context Protocol) 양방향 어댑터 플러그인입니다. 클라이언트 방향은 외부 MCP 서버의 도구를 발견해 Spakky Agent 도구 카탈로그에 합류시키고, 서버 방향은 Agent의 @agent_tool 도구를 MCP 서버로 노출해 외부 MCP 클라이언트가 발견·호출하게 합니다. 양쪽 모두 @agent_tool로 선언한 도구와 동일한 디스패치 경로(AgentToolDispatcher)로 실행됩니다.

ADR-0013 §2에 따라 코어(spakky-agent)는 MCP 라이브러리에 의존하지 않으며, 외부 도구 정규화·연결 수명주기와 도구의 MCP 서버 노출은 이 어댑터가 전담합니다.

언제 필요한가

  • 클라이언트: 운영 중인 외부 MCP 서버의 도구를 에이전트가 일반 도구처럼 사용하고 싶을 때.
  • 서버: 에이전트의 도구를 외부 MCP 클라이언트(다른 에이전트·IDE·MCP 호스트)에 표준 프로토콜로 노출하고 싶을 때.

이 플러그인은 도구 공급원/노출원이며 모델 어댑터가 아닙니다 — 에이전트 실행에는 별도의 IAgentModel 공급자(예: spakky-vllm)가 필요합니다.

설치

uv add spakky-mcp
# 또는 에이전트 번들로
uv add "spakky[agent]"

설정

외부 서버는 SPAKKY_MCP__ 접두사 환경변수 또는 McpConfig로 선언합니다.

환경변수 의미 기본값
SPAKKY_MCP__SERVERS 외부 MCP 서버 목록(JSON 배열) []
SPAKKY_MCP__CONNECT_TIMEOUT_SECONDS 연결 수립 타임아웃(초) 30.0

서버 항목은 name, transport(stdio 또는 streamable_http), command/args/env(stdio), url(streamable_http), call_timeout_seconds를 가집니다. name은 도구 이름 충돌을 막는 접두사로 쓰이며 __를 포함할 수 없습니다.

도구를 MCP 서버로 노출할 때의 식별자·전송은 SPAKKY_MCP__TOOL_SERVER__NAME(기본 spakky-agentSPAKKY_MCP__TOOL_SERVER__TRANSPORT(기본 stdio)로 선언합니다.

사용

클라이언트: 외부 도구 끌어오기

from spakky.plugins.mcp import McpClient


async def run_with_external_tools(client: McpClient, agent: object) -> None:
    # 선언된 외부 서버에 연결하고, 외부 도구를 카탈로그에 더한 runner를 받는다.
    async with client.open_runner(agent) as runner:
        async for item in runner.run(run_input):
            ...  # 외부 도구가 native @agent_tool 도구와 같은 경로로 디스패치된다

모델이 보는 외부 도구 이름은 <서버이름>__<도구이름> 형태로 접두사가 붙어 서버 간 이름 충돌을 막습니다.

서버: 자신의 도구 내보내기

from spakky.plugins.mcp import McpToolServer


async def expose_tools(server: McpToolServer, agent: object) -> None:
    # 에이전트의 @agent_tool 도구를 stdio MCP 서버로 노출한다.
    await server.serve_stdio(agent)

원격 노출에는 McpToolServer.streamable_http_session_manager(agent)가 돌려주는 세션 매니저를 호스트 애플리케이션 lifespan에서 구동합니다.

자세한 내용은 MCP 어댑터 가이드를 참고하세요.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spakky_mcp-6.10.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spakky_mcp-6.10.0-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

Details for the file spakky_mcp-6.10.0.tar.gz.

File metadata

  • Download URL: spakky_mcp-6.10.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spakky_mcp-6.10.0.tar.gz
Algorithm Hash digest
SHA256 c7c52f31c21694638f42d7ac56ff73de793d35d5b9c835f4fdb7741447df175c
MD5 4d745114efb4a67dc50e2133520767f5
BLAKE2b-256 313507ce017fd5dad51aa00087e8f8273d7b86802bb3cee2bd16ffc560ff8673

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_mcp-6.10.0.tar.gz:

Publisher: publish-package.yml on E5presso/spakky-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spakky_mcp-6.10.0-py3-none-any.whl.

File metadata

  • Download URL: spakky_mcp-6.10.0-py3-none-any.whl
  • Upload date:
  • Size: 14.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for spakky_mcp-6.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfdc50cfb222bf5494dc2e52dc87a1020d2f82649a8fd7ed5daa9a958b21d6f
MD5 c84b1e8113a38aedc45a20013a5bf273
BLAKE2b-256 6131703a109ed2b225f447effac2247543e414222c850b1d6a37578e24b284f5

See more details on using hashes here.

Provenance

The following attestation bundles were made for spakky_mcp-6.10.0-py3-none-any.whl:

Publisher: publish-package.yml on E5presso/spakky-framework

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page