-
Notifications
You must be signed in to change notification settings - Fork 113
feat: secure cyrus-tools MCP auth and codex MCP header mapping (CYPACK-817) #870
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9a4f17b
chore: initialize draft PR for CYPACK-817
cyrusagent 70456aa
feat(edge-worker): serve cyrus tools via Fastify MCP (CYPACK-817)
cyrusagent 76bd13c
refactor: move cyrus tools server and tests to mcp-tools
cyrusagent be7e39f
fix(edge-worker): resolve cyrus-mcp-tools as package for builds
cyrusagent 22e1148
feat(runners): pass MCP configs to gemini cursor codex
cyrusagent 1922f34
feat(edge-worker): enforce CYRUS_API_KEY auth for cyrus-tools MCP
cyrusagent 1668474
fix(codex-runner): map MCP auth headers for HTTP servers
cyrusagent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
apps/f1/test-drives/2026-02-18-cypack-817-fastify-mcp-validation.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| # Test Drive CYPACK-817: Fastify-MCP Cyrus Tools Validation | ||
|
|
||
| **Date**: 2026-02-18 | ||
| **Goal**: Validate that cyrus-tools are served from the existing Fastify server (CYRUS_PORT/CYRUS_SERVER_PORT equivalent) via `fastify-mcp`. | ||
| **Test Repo**: `/tmp/f1-test-drive-cypack-817-20260217-185650` | ||
| **Server Port**: `3617` | ||
|
|
||
| ## Verification Results | ||
|
|
||
| ### Issue-Tracker | ||
| - [x] Issue created | ||
| - [x] Issue ID returned | ||
| - [x] Issue metadata accessible | ||
|
|
||
| ### EdgeWorker | ||
| - [x] Session started | ||
| - [x] Worktree created (fallback path used after existing checked-out branch warning) | ||
| - [x] Activities tracked | ||
| - [x] Agent processed issue | ||
|
|
||
| ### Renderer | ||
| - [x] Activity format correct (`thought`, `action`, `response` visible) | ||
| - [x] Pagination works (`--limit`, `--offset`) | ||
| - [x] Search works (`--search Bash`) | ||
|
|
||
| ### MCP Endpoint (CYPACK-817 target) | ||
| - [x] `cyrus-tools` endpoint registered on same Fastify server: `/mcp/cyrus-tools` | ||
| - [x] MCP `initialize` succeeds with `mcp-session-id` returned | ||
| - [x] MCP `tools/list` succeeds and returns cyrus tool set | ||
|
|
||
| ## Session Log | ||
|
|
||
| 1. Create fresh F1 repo | ||
| ```bash | ||
| cd apps/f1 | ||
| ./f1 init-test-repo --path /tmp/f1-test-drive-cypack-817-20260217-185650 | ||
| ``` | ||
| Result: repo created with git init + initial commit. | ||
|
|
||
| 2. Start F1 server | ||
| ```bash | ||
| cd apps/f1 | ||
| HOME=/tmp CYRUS_PORT=3617 CYRUS_REPO_PATH=/tmp/f1-test-drive-cypack-817-20260217-185650 node dist/server.js | ||
| ``` | ||
| Key output included: | ||
| - `✅ Cyrus tools MCP endpoint registered at /mcp/cyrus-tools` | ||
| - `RPC endpoint: /cli/rpc` | ||
| - `Shared application server listening on http://localhost:3617` | ||
|
|
||
| 3. Health checks | ||
| ```bash | ||
| CYRUS_PORT=3617 ./f1 ping | ||
| CYRUS_PORT=3617 ./f1 status | ||
| ``` | ||
| Result: healthy, `status: ready`. | ||
|
|
||
| 4. Issue + session flow | ||
| ```bash | ||
| CYRUS_PORT=3617 ./f1 create-issue --title "CYPACK-817 MCP fastify validation" --description "Validate cyrus-tools served from fastify-mcp endpoint on CYRUS_SERVER_PORT" | ||
| CYRUS_PORT=3617 ./f1 start-session --issue-id issue-1 | ||
| CYRUS_PORT=3617 ./f1 view-session --session-id session-1 --limit 10 --offset 0 | ||
| CYRUS_PORT=3617 ./f1 view-session --session-id session-1 --limit 5 --offset 0 --search Bash | ||
| ``` | ||
| Result: | ||
| - session created (`session-1`) | ||
| - activities present with expected types | ||
| - pagination/search behavior verified | ||
|
|
||
| 5. Direct MCP validation on same Fastify server | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:3617/mcp/cyrus-tools \ | ||
| -H 'Content-Type: application/json' \ | ||
| -H 'Accept: application/json, text/event-stream' \ | ||
| -H 'x-cyrus-mcp-context-id: f1-test-repo:session-1' \ | ||
| --data '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"cypack817-test","version":"1.0.0"}}}' | ||
| ``` | ||
| Initialize response included: | ||
| - `mcp-session-id: 959cb3f1-b2b2-4597-88f9-e37bf20db049` | ||
| - `serverInfo.name: "cyrus-tools"` | ||
|
|
||
| Then: | ||
| ```bash | ||
| curl -X POST http://127.0.0.1:3617/mcp/cyrus-tools \ | ||
| -H 'Content-Type: application/json' \ | ||
| -H 'Accept: application/json, text/event-stream' \ | ||
| -H 'x-cyrus-mcp-context-id: f1-test-repo:session-1' \ | ||
| -H 'mcp-session-id: 959cb3f1-b2b2-4597-88f9-e37bf20db049' \ | ||
| --data '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | ||
| ``` | ||
| Result: tool list returned (`linear_upload_file`, `linear_agent_session_create`, `linear_agent_give_feedback`, etc.). | ||
|
|
||
| 6. Cleanup | ||
| ```bash | ||
| CYRUS_PORT=3617 ./f1 stop-session --session-id session-1 | ||
| # Ctrl+C on server process | ||
| ``` | ||
| Result: clean session stop + graceful server shutdown. | ||
|
|
||
| ## Final Retrospective | ||
|
|
||
| - Fastify MCP wiring is working end-to-end on the same server port as RPC/status/version routes. | ||
| - `buildMcpConfig` now routes `cyrus-tools` through local HTTP MCP with context headers, and Claude connected successfully (`cyrus-tools MCP session connected` observed). | ||
| - One environment-specific issue occurred on an initial run (`EPERM` writing under `/Users/agentops/.claude/debug`); rerunning server with `HOME=/tmp` resolved this in the sandbox and did not affect MCP functionality. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a server config contains both Codex-native
http_headersand genericheaders, the second assignment overwriteshttp_headerswithheaders, so explicitly configured Codex auth headers are silently dropped. This breaks authenticated MCP setups that intentionally provide Codex-specific headers (for example viahttp_headers/env_http_headers) alongside generic metadata, and contradicts the intended pass-through behavior.Useful? React with 👍 / 👎.