MP

mitsuhiko/pi-codemode-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

40 stars 2 forks 품질 45 트렌드 12

MCP를 Pi로 연결하는 실험 방법

개요

2개의 도구를 통해 MCP를 노출하는 Pi 연장: - list mcp tools - 모든 MCP 도구 (첫 번째 20 인라인, 임시 직원 파일에 전체 목록보기) - call mcp - sandbox에서 JavaScript를 실행하고 MCP 서버를 호출 할 수 있습니다 상태에 /mcp 명령을 추가, 활성화 / 비활성화, 재연결, 그리고 auth 설정. 이 실험은 구성을 허용하는 방법에 MCP와 코딩 에이전트 인터페이스를 허용하는 효율성이 있는지 확인하는 실험이었다. 이 블로그 게시물을 참조하십시오. 실제 발견은 MCP가 오늘 어떻게 작동합니까? 이러한 효율성은 유용하지 않습니다. 다른 한편으로 MCP 서버를 사용하여 코드를 내부적으로 매우 도움이 될 수 있습니다. 예를 들어, MCP 서버는 JavaScript 환경을 사용하여 Google 서비스를 호출합니다. 실제로는 비슷한 기술도 수행합니다. 병합 명령에 로드 됨 (이전에 later overrides): 1. ~/.pi/agent/mcp.json 2. ~/.pi/agent/.mcp.json 3. /.피/mcp.json 4. /.mcp.json의 --mcp-config /path/to/file.json과 중복할 수 있습니다.

개요(AI 번역)

2개의 도구를 통해 MCP를 노출하는 Pi 연장:

  • list_mcp_tools - 모든 MCP 도구 (첫 번째 20 인라인, 임시 직원 파일에 전체 목록을 표시합니다)
  • call_mcp - sandbox에서 JavaScript를 실행하고 MCP 서버를 호출 할 수

그것은 또한 /mcp] 상태를 위한 명령을 추가, 활성화/disable, reconnect, 그리고 auth 설정.

왜?

이 실험은 코딩 에이전트 인터페이스를 허용하는 효율성이 있는 경우 MCP는 구성을 허용하는 방법입니다. 이 블로그 게시물을 참조하십시오.

실제 발견은 MCP가 오늘 어떻게 작동합니까? 이러한 효율성은 유용하지 않습니다. 기타 내부 코드를 사용하는 MCP 서버는 매우 도움이 될 수 있습니다. 이름 * 예를 들어 MCP 서버 JavaScript 환경을 사용하여 Google 서비스를 호출합니다. 즉, 실제로는 동일합니다. 기술이 있습니다.

구성 파일

병합 명령에 로드 됨 (이전에 later overrides):

  1. ~/.pi/agent/mcp.json
  2. [T4]]
  3. [T5]
  4. [T6]]

--mcp-config /path/to/file.json]로 덮을 수 있습니다.

list_mcp_tools

모수:

  • query (선택 사항) : /pattern/flags을 통해 case-insensitive text match 또는 regex]

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

pi-codemode-mcp

Pi extension that exposes MCP through two tools:

  • list_mcp_tools — enumerates all MCP tools (shows first 20 inline, overflows full list to a temp file)
  • call_mcp — runs JavaScript in a sandbox and lets the script call MCP servers

It also adds a /mcp command for status, enable/disable, reconnect, and auth setup.

Why?

This was an experiment to see if there is an efficiency benefit of allowing a coding agent interface with MCP in a way that allows composition. See this blog post.

The actual findings are that with how MCP works today, such efficiency gains are not useful. On the other hand an MCP server that uses code internally can be very helpful. See for instance an example MCP server that uses a JavaScript environment to call Google services. That one actually performs as well as a similar skill does.

Configuration files

Loaded in merge order (later overrides earlier):

  1. ~/.pi/agent/mcp.json
  2. ~/.pi/agent/.mcp.json
  3. /.pi/mcp.json
  4. /.mcp.json

You can override with --mcp-config /path/to/file.json.

list_mcp_tools

Parameters:

  • query (optional): case-insensitive text match, or regex via /pattern/flags

The tool always shows the first 20 matches inline. If more matches exist, it writes the full list to a temp .tsv file so the agent can grep/rg it.

Each listed MCP tool includes a compact schema signature, with required fields marked by * and optional fields in brackets.

Only currently enabled MCP tools are listed.

/mcp command

Use /mcp to manage MCP from interactive mode:

  • /mcp — opens an interactive select menu (status, reconnect, auth, and per-server tool toggles)
  • /mcp status — show server connection/auth state + enabled/disabled counts
  • /mcp enable — enable a specific MCP tool (or all tools for server)
  • /mcp disable — disable a specific MCP tool (or all tools for server)
  • /mcp reconnect [server] — reconnect one/all servers and refresh metadata
  • /mcp auth — trigger auth setup flow

Tool enable/disable policies are persisted in:

  • ~/.pi/agent/mcp-tool-policies.json

Auth behavior

  • OAuth flow (standard MCP auth)
    • /mcp auth starts an OAuth browser login flow with localhost callback (for URL-based servers).
    • received tokens are stored in: ~/.pi/agent/mcp-oauth//tokens.json
    • then the server is reconnected.
    • if a server’s auth metadata does not support dynamic client registration, /mcp auth falls back to bearer setup for the current session (for GitHub Copilot MCP, it will try gh auth token automatically).
  • Bearer servers (auth: "bearer" or bearer token config)
    • if bearerTokenEnv is configured, /mcp auth lets you paste a token into that env var for the current pi process.
GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →