Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/requirements/mcp-minimum.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Exact supported SDK floor; transitive packages resolve normally and are audited.
mcp==1.30.0
73 changes: 70 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,86 @@ jobs:
test ! -L "$HOME/.local/bin/session-peer"

mcp:
name: optional MCP (${{ matrix.os }}, python ${{ matrix.python }})
name: optional MCP (${{ matrix.os }}, python ${{ matrix.python }}, ${{ matrix.profile }})
runs-on: ${{ matrix.os }}
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python: ['3.10', '3.13']
profile: [minimum, latest]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- run: python -m pip install '.[mcp]' --requirement .github/requirements/build.txt
- run: python -m unittest discover -s tests/mcp_integration -t . -v
- name: Install separate build and audit tooling
run: python -m pip install --requirement .github/requirements/build.txt --requirement .github/requirements/audit.txt
- name: Install MCP runtime profile
id: mcp_runtime
shell: bash
env:
MCP_PROFILE: ${{ matrix.profile }}
run: |
mkdir -p mcp-reports
python -m venv "$RUNNER_TEMP/session-peer-mcp-runtime"
runtime="$RUNNER_TEMP/session-peer-mcp-runtime/bin/python"
"$runtime" -m pip install --upgrade pip setuptools
if test "$MCP_PROFILE" = minimum; then
"$runtime" -m pip install '.[mcp]' --constraint .github/requirements/mcp-minimum.txt --report mcp-reports/install.json
else
test "$MCP_PROFILE" = latest
"$runtime" -m pip install --upgrade '.[mcp]' --report mcp-reports/install.json
fi
"$runtime" -m pip check
- name: Record and verify resolved MCP profile
id: mcp_profile
shell: bash
env:
MCP_PROFILE: ${{ matrix.profile }}
run: |
runtime="$RUNNER_TEMP/session-peer-mcp-runtime/bin/python"
"$runtime" -m pip list --format=json > mcp-reports/runtime.json
"$runtime" -m pip freeze --all > mcp-reports/runtime.txt
"$runtime" - <<'PY' | tee mcp-reports/profile.json
import importlib.metadata as metadata
import json, os, re, sys
from pathlib import Path
import mcp
pins = [line for line in Path('.github/requirements/mcp-minimum.txt').read_text().splitlines() if line and not line.startswith('#')]
if len(pins) != 1 or not re.fullmatch(r'mcp==[0-9]+\.[0-9]+\.[0-9]+', pins[0]):
raise SystemExit('Invalid MCP minimum constraint')
minimum = pins[0].removeprefix('mcp==')
version = metadata.version('mcp')
profile = os.environ['MCP_PROFILE']
if profile not in ('minimum', 'latest') or not (version == minimum if profile == 'minimum' else version.startswith('1.')):
raise SystemExit('MCP profile version mismatch')
print(json.dumps({'profile': profile, 'mcp': version, 'python': sys.version, 'platform': sys.platform}))
PY
- name: MCP stdio, policy, timeout and owned-child cleanup
shell: bash
run: '"$RUNNER_TEMP/session-peer-mcp-runtime/bin/python" -m unittest discover -s tests/mcp_integration -t . -v'
- name: Audit resolved MCP runtime graph
if: ${{ !cancelled() && steps.mcp_runtime.outcome == 'success' && steps.mcp_profile.outcome == 'success' }}
shell: bash
run: |
audit_path=$("$RUNNER_TEMP/session-peer-mcp-runtime/bin/python" -I -c 'import site; print(site.getsitepackages()[0])')
set +e
python -m pip_audit --path "$audit_path" --format=json --output mcp-reports/audit.json 2> mcp-reports/audit.log
audit_status=$?
set -e
echo "$audit_status" > mcp-reports/audit-exit-status.txt
cat mcp-reports/audit.log >&2
exit "$audit_status"
- name: Retain MCP dependency and audit reports
if: ${{ always() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: mcp-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.profile }}
path: mcp-reports/
if-no-files-found: error
retention-days: 30
- run: python -m build
- name: Verify optional module in distributions
run: |
Expand Down
2 changes: 1 addition & 1 deletion docs/i18n-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"docs/diagnostics.md": "0949e53612eeab2cd7c7bbda498e14d71e9cb1b1189aa7722030cb8702cd8481",
"docs/download-metrics.md": "a537300d3fe2b60273b6f4bd84e0ae0944364fda3881d7fb7e32ce665dc2c724",
"docs/handoff-runtime.md": "a236e48392c91eca0f7c3734a6008a991955ae66d16fd71f97691aac5bf0091f",
"docs/mcp.md": "a64010cdd63f2cde6a0052450bed2d05faa0f19c93c76143cb0d585d36f8ff62",
"docs/mcp.md": "48c761666abc09540fdbdb39b6974b0002e5cc89dda774ac6c24376190fa2c7b",
"docs/multi-home-list.md": "f8d8e3adf727e4842ea7c4d45e8f6523b11d0513bf2509d4d1204645875e6489",
"docs/paired-devices.md": "03619867241a2db20d0b2281f17fdef2020ba159b7d565a0f5bc32de3152228d",
"docs/relay-auth.md": "e6da5291ce6a9da31e79e66ceeff7e9fef7e95046359acbf04d708c96ffab62f",
Expand Down
8 changes: 6 additions & 2 deletions docs/ja/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Python 3.10 以降でインストールします: `pipx install 'session-peer[mcp]'`(または隔離された venv にエクストラをインストール)。依存関係のない Python 3.9 CLI および `install.sh` は引き続きサポートされます。シェルインストーラーは MCP の依存関係をインストールしません。Python 3.9 では、MCP エントリポイントが Python 3.10+ が必要である旨を報告します。

任意のエクストラはMCP SDK `mcp>=1.30,<2`を必要とします。上流の1.xセキュリティ修正を含む版まで依存関係の下限を引き上げるもので、stdio専用のこのサーバーで悪用可能な欠陥を確認したという意味ではありません。HTTP転送、OAuthサーバー経路、MCPクライアント経路は有効にしません。既存環境では明示的なパッケージ更新が必要で、宣言の変更だけではインストール済みSDKは更新されません。

`session-peer-mcp --config /absolute/path/policy.json` を起動します。ポリシーがない場合、サーバーは起動環境の Codex ホームを使用して、ローカルの一覧取得のみを許可します。ポリシーを指定するとデフォルトが置き換えられます。例:

```json
Expand Down Expand Up @@ -42,12 +44,14 @@ MCP ツールのアノテーションは、一覧取得を読み取り専用、

MCP エクストラの有無の両方で `python -m unittest discover -s tests -v` を実行します。オプションのテストでは実際の stdio MCP サーバーを起動し、モデルの認証情報なしで初期化、スキーマ、ポリシー拒否、および CLI の部分的な失敗を検証します。wheel と sdist の両方のインストールをテストしてください。実環境チェックでは Codex バージョン、OS、およびホストの承認設定を記録する必要があります。UDS アクセスは環境依存であり、承認のバイパスを約束するものではありません。メッセージには専用のテストセッションを使用してください。

公式リファレンス: [Codex MCP](https://developers.openai.com/codex/extend/mcp), [Python MCP SDK](https://github.com/modelcontextprotocol/python-sdk)。
CIではmacOS/LinuxのPython 3.10/3.13で、SDK下限の`mcp==1.30.0`と最新の互換1.xを別々に試験します。両プロファイルでstdio・ポリシー・タイムアウト・キャンセル・所有する子プロセスの終了処理を試験し、解決されたランタイム依存関係を監査して、版とレポートを保存します。推移的依存関係の版は通常の依存関係解決に従って選択されます。すべての推移的パッケージの最小版を試験するものではありません。版を固定したビルド・監査用要件はランタイム環境の外にインストールし、監査対象には初期構成用の`pip`/`setuptools`パッケージも含めます。既存の最新版解決監査とリリース監査も引き続き必須です。

公式リファレンス: [Codex MCP](https://developers.openai.com/codex/extend/mcp), [Python MCP SDK](https://github.com/modelcontextprotocol/python-sdk)。 [SDK 1.30.0](https://pypi.org/pypi/mcp/1.30.0/json), [GHSA-84m7-p3x7-pcfv](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv), [GHSA-fmmv-w9g8-j3gc](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-fmmv-w9g8-j3gc).

### 非対話型クライアントの承認

Codex `exec` は、サーバーポリシーが許可している場合でも「requires approval, but approval policy is never」として send ツールを拒否することがあります。`approval_mode="auto"` は無条件の承認ではありません。非対話型統合を明示的に承認するオペレーターは、制限された宛先ポリシーと併せて、その特定の MCP サーバー/ツールに対して `mcp_servers.session_peer.tools.send_message.approval_mode="approve"` を設定できます。プラグインがこの設定を有効にすることはありません。対話型クライアントは、代わりに通常の承認プロンプトを使用できます。テストクライアントがこの承認設定を無関係なサーバーやツールにコピーしてはなりません。

macOS/LinuxではMCP CLI呼び出しごとに新しいプロセスグループを所有します。完了・timeout・取消時はleaderの回収前にTERM→KILLでTERMを無視する子も整理し、取消は再伝播します。別sessionへ離脱した子やSSH先のプロセスは対象外です。Windowsは直接の子の終了のみで、ツリー終了は保証しません。ローカル終了で遠隔送信は取り消せません。timeoutは `outcome_unknown` のままで自動再送は禁止です。
macOS/LinuxではMCP CLI呼び出しごとに新しいプロセスグループを所有します。完了・timeout・取消時はleaderの回収前に制限時間付きのTERM→KILLでTERMを無視する子も整理し、キャンセルは引き続き伝播します。別sessionへ離脱した子やSSH先のプロセスは対象外です。Windowsは直接の子の終了のみで、ツリー終了は保証しません。ローカル終了で遠隔送信は取り消せません。timeoutは `outcome_unknown` のままで自動再送は禁止です。

呼び出し元セッションが不明であることを示す From ラベルを含め、MCP の本文は宛先 CLI の受信側の枠で引用されます。本文のヘッダーや埋め込まれた Reply-To は権限を与えません。第三者への宛先はセッション所有者に確認してください。共有 MCP プロセスは、認証済み呼び出し元セッションや自動返信経路を引き続き提供できません。最終的な枠もネイティブメッセージの上限に含まれます。
10 changes: 7 additions & 3 deletions docs/ko/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Python 3.10 이상에서 설치하십시오: `pipx install 'session-peer[mcp]'`(또는 격리된 venv에 extra 설치). 의존성이 없는 Python 3.9 CLI 및 `install.sh`는 계속 지원됩니다. 셸 설치기는 MCP 의존성을 설치하지 않습니다. Python 3.9에서 MCP 엔트리 포인트는 Python 3.10+이 필요하다고 보고합니다.

선택형 extra는 MCP SDK `mcp>=1.30,<2`를 요구합니다. 업스트림 1.x 보안 수정이 포함된 버전으로 의존성 하한을 올리는 것으로, stdio만 사용하는 이 서버에서 악용 가능한 결함이 확인됐다는 뜻은 아닙니다. 이번 변경으로 HTTP 전송, OAuth 서버 경로, MCP 클라이언트 경로가 활성화되지는 않습니다. 기존 환경에는 명시적인 패키지 업그레이드가 필요하며, 선언 변경만으로 설치된 SDK가 업데이트되지는 않습니다.

`session-peer-mcp --config /absolute/path/policy.json`으로 시작합니다. 정책이 없으면 서버는 실행 환경의 Codex 홈을 사용하여 로컬 목록 조회만 허용합니다. 제공된 정책은 기본값을 대체합니다. 예시:

```json
Expand Down Expand Up @@ -42,12 +44,14 @@ MCP 도구 어노테이션은 목록 조회를 읽기 전용으로, 전송을

MCP extra가 있는 상태와 없는 상태에서 각각 `python -m unittest discover -s tests -v`를 실행하십시오. 선택형 테스트는 실제 stdio MCP 서버를 시작하고 모델 자격 증명 없이 초기화, 스키마, 정책 거부 및 CLI 부분 실패를 실행합니다. wheel 및 sdist 설치를 모두 테스트하십시오. 실시간 확인 시에는 Codex 버전, OS 및 호스트 승인 설정을 기록해야 합니다. UDS 접근은 환경에 따라 다르며 승인 우회를 약속하는 것이 아닙니다. 메시지에는 전용 테스트 세션을 사용하십시오.

공식 참조: [Codex MCP](https://developers.openai.com/codex/extend/mcp), [Python MCP SDK](https://github.com/modelcontextprotocol/python-sdk).
CI는 macOS/Linux의 Python 3.10/3.13에서 SDK 하한 `mcp==1.30.0`과 최신 호환 1.x를 별도로 시험합니다. 두 프로필 모두 stdio·정책·시간 초과·취소·소유 자식 프로세스 정리 시험을 실행하고, 해결된 런타임 의존성 그래프를 감사하며 버전과 보고서를 보존합니다. 전이 의존성 버전은 패키지 관리자가 일반적인 방식으로 결정합니다. 모든 전이 패키지의 최솟값을 시험하는 것은 아닙니다. 버전을 고정한 빌드·감사 요구 패키지는 런타임 환경 밖에 설치하며, 감사 대상 환경에는 초기 구성용 `pip`/`setuptools` 패키지도 포함됩니다. 기존 최신 버전 해결 감사와 릴리스 감사도 계속 필수입니다.

공식 참조: [Codex MCP](https://developers.openai.com/codex/extend/mcp), [Python MCP SDK](https://github.com/modelcontextprotocol/python-sdk). [SDK 1.30.0](https://pypi.org/pypi/mcp/1.30.0/json), [GHSA-84m7-p3x7-pcfv](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv), [GHSA-fmmv-w9g8-j3gc](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-fmmv-w9g8-j3gc).

### 비대화형 클라이언트 승인

서버 정책이 허용하더라도 Codex `exec`는 전송 도구를 “requires approval, but approval policy is never”로 거부할 수 있습니다. `approval_mode="auto"`는 무조건적인 승인이 아닙니다. 비대화형 연동을 명시적으로 승인하는 운영자는 제한된 목적지 정책과 함께 해당 특정 MCP 서버/도구에 대해 `mcp_servers.session_peer.tools.send_message.approval_mode="approve"`를 구성할 수 있습니다. 플러그인은 이 설정을 활성화하지 않습니다. 대화형 클라이언트는 대신 일반적인 승인 프롬프트를 사용할 수 있습니다. 테스트 클라이언트는 이 승인을 관련 없는 서버나 도구에 복사해서는 안 됩니다.

macOS/Linux에서 MCP CLI 호출은 새 프로세스 그룹을 소유합니다. 완료·시간 초과·취소 시 리더를 회수하기 전에 TERM→KILL로 해당 그룹을 정리하며 TERM을 무시하는 자식도 포함합니다. 취소는 그대로 전파됩니다. 별도 세션으로 이탈한 자식과 원격 SSH 프로세스는 범위 밖입니다. Windows는 직접 자식 종료만 유지하며 프로세스 트리 보장을 주장하지 않습니다. 로컬 정리는 원격 제출을 취소하지 않습니다. timeout은 `outcome_unknown`이며 자동 재전송하면 안 됩니다.
macOS/Linux에서 MCP CLI 호출은 새 프로세스 그룹을 소유합니다. 완료·시간 초과·취소 시 리더를 회수하기 전에 시간 제한이 있는 TERM→KILL로 해당 그룹을 정리하며 TERM을 무시하는 자식도 포함합니다. 취소는 그대로 전파됩니다. 별도 세션으로 이탈한 자식과 원격 SSH 프로세스는 범위 밖입니다. Windows는 직접 자식 종료만 유지하며 프로세스 트리 보장을 주장하지 않습니다. 로컬 정리는 원격 제출을 취소하지 않습니다. timeout은 `outcome_unknown`이며 자동 재전송하면 안 됩니다.

호출 세션을 알 수 없다는 From 표시를 포함한 MCP 본문은 목적지 CLI의 수신 측 표시 안에 인용됩니다. 본문 헤더나 본문에 들어 있는 Reply-To는 권한을 부여하지 않습니다. 제삼자 목적지는 세션 소유자에게 확인하십시오. 공유 MCP 프로세스는 여전히 인증된 호출 세션이나 자동 회신 경로를 제공하지 못합니다. 최종 표시도 네이티브 메시지 한도에 포함됩니다.
호출 세션을 알 수 없다는 From 표시를 포함한 MCP 본문은 목적지 CLI의 수신 측 프레임 안에 인용됩니다. 본문 헤더나 본문에 들어 있는 Reply-To는 권한을 부여하지 않습니다. 제삼자 목적지는 세션 소유자에게 확인하십시오. 공유 MCP 프로세스는 여전히 인증된 호출 세션이나 자동 회신 경로를 제공하지 못합니다. 최종 프레임도 네이티브 메시지 한도에 포함됩니다.
6 changes: 5 additions & 1 deletion docs/mcp.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

Install with Python 3.10 or later: `pipx install 'session-peer[mcp]'` (or install the extra in an isolated venv). The dependency-free Python 3.9 CLI and `install.sh` remain supported. The shell installer does not install MCP dependencies. On Python 3.9 the MCP entry point reports that Python 3.10+ is required.

The optional extra requires MCP SDK `mcp>=1.30,<2`. This raises the dependency floor past upstream 1.x security fixes; it does not establish an exploitable issue in this stdio-only server. HTTP transports, OAuth server paths and MCP client paths are not enabled by this change. Existing environments need an explicit package upgrade; changing the manifest does not update an installed SDK.

Start `session-peer-mcp --config /absolute/path/policy.json`. Without a policy the server allows only local listing, using the launching environment's Codex home. A supplied policy replaces defaults. Example:

```json
Expand Down Expand Up @@ -42,7 +44,9 @@ A shared MCP process cannot reliably identify the invoking thread. Messages iden

Run `python -m unittest discover -s tests -v` with and without the MCP extra. Optional tests start a real stdio MCP server and exercise initialization, schemas, policy rejection and CLI partial failures without model credentials. Test both wheel and sdist installs. Live checks must record Codex version, OS and host approval settings; UDS access is environment-dependent and is not an approval-bypass promise. Use dedicated test sessions for messages.

Official references: [Codex MCP](https://developers.openai.com/codex/extend/mcp), [Python MCP SDK](https://github.com/modelcontextprotocol/python-sdk).
CI tests the exact SDK floor `mcp==1.30.0` and the latest compatible 1.x separately on macOS/Linux with Python 3.10/3.13. Both profiles run the stdio/policy/timeout/cancellation/owned-child tests and audit their resolved runtime dependency graphs, retaining versions and reports. Transitive dependencies resolve normally; this is not a test of every transitive package's minimum version. The pinned build/audit requirements are installed outside the runtime environment; the audited environment also includes its `pip`/`setuptools` bootstrap packages. Existing latest-resolution and release audits remain required.

Official references: [Codex MCP](https://developers.openai.com/codex/extend/mcp), [Python MCP SDK](https://github.com/modelcontextprotocol/python-sdk). [SDK 1.30.0](https://pypi.org/pypi/mcp/1.30.0/json), [GHSA-84m7-p3x7-pcfv](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-84m7-p3x7-pcfv), [GHSA-fmmv-w9g8-j3gc](https://github.com/modelcontextprotocol/python-sdk/security/advisories/GHSA-fmmv-w9g8-j3gc).

### Non-interactive client approvals

Expand Down
Loading
Loading