Where does the bug appear (feature/product)?
Cursor CLI
Describe the Bug
We have been experiencing issues when trying to integrate Cursor-CLI in a GitHub Actions CI pipeline to work with our configured mcp servers which runs on ubuntu-latest.
we have checked and verified that the mcp servers are configured and displayed within the pipeline so no issues seems to be related with the mcp servers.
however when running the ``cursor-agent mcp list`it always results with a`No MCP servers configured (expected in .cursor/mcp.json or ~/.cursor/mcp.json)``` no matter what solution or workaround we try
note that locally, when configuring mcp servers for the first time it asks as to trust this workspace, so we thought that maybe this is the issue that we need to trust the project in order to call the mcp servers via the cursor cli
so we created a local script to trust this workspace on MacOS in an automatic way without a manual intervention script can be found and this script works as expected, it prompts the trust shell, trusts the workspace and closes automatically:
#!/usr/bin/env bash
set -euo pipefail
command -v expect >/dev/null || { echo âbrew install expectâ; exit 1; }
command -v cursor-agent >/dev/null || { echo âInstall Cursor CLI: curl -fsSL CLI ¡ Cursor | bashâ; exit 1; }
: â${CURSOR_API_KEY:?Export CURSOR_API_KEY first}â
rm -rf ~/.cursor/projects/my-project-name
cat > /tmp/approve_cursor.exp << âEOFâ
#!/usr/bin/expect -f
set timeout 30
spawn /usr/bin/script -q /dev/null cursor-agent
Wait for the trust prompt to actually appear
expect {
-re âTrust this workspaceâ {
puts â\n=== Trust prompt detected, sending Enter ===â
send â â\râ
}
timeout {
puts â\n=== ERROR: Trust prompt never appeared ===â
exit 1
}
}
Give it time to write the files and show the agent prompt
sleep 10
Now force exit by closing the terminal
puts â\n=== Force exiting ===â
exit 0
expect eof
EOF
chmod +x /tmp/approve_cursor.exp
/tmp/approve_cursor.exp || true
we tried to implement the same script but for the linux CI environment and it is not solving the issue and try to tweak things here and there, increase timeouts and etc but always results with the same error that no mcp servers configured.
-
name: Setup MCP configuration
shell: bash
run: |Create MCP config directory
mkdir -p ~/.cursor
cp .cursor/mcp.json ~/.cursor/mcp.json
echo âMCP configuration copied to ~/.cursor/mcp.jsonâ
cat ~/.cursor/mcp.json -
name: Approve workspace trust and MCP servers interactively
env:
CURSOR_API_KEY: ${{ secrets.CURSOR_API_TOKEN }}
shell: bash
run: |
set -euo pipefailSANITIZED="$(printf '%s' "$GITHUB_WORKSPACE" | sed -e 's#^/##' -e 's/[.]/-/g' -e 's#/#-#g')" TARGET="$HOME/.cursor/projects/$SANITIZED" # Clean slate - remove any existing trust/approvals rm -rf "$TARGET" mkdir -p "$TARGET" # Install expect if not present sudo apt-get update && sudo apt-get install -y expect # Create expect script to approve workspace trust interactively cat > approve_cursor.exp << 'EOF' #!/usr/bin/expect -f set timeout 30 spawn script -q -c "cursor-agent" /dev/null # Wait for the trust prompt to actually appear expect { -re "Trust this workspace" { puts "\n=== Trust prompt detected, sending Enter ===" send -- "\r" } timeout { puts "\n=== ERROR: Trust prompt never appeared ===" exit 1 } } # Give it time to write the files and show the agent prompt sleep 10 # Now force exit by closing the terminal puts "\n=== Force exiting ===" exit 0 expect eof EOF chmod +x approve_cursor.exp ./approve_cursor.exp || true # Verify trust and approval files were created echo "=== Files created in $TARGET ===" ls -la "$TARGET" || true echo "" echo "=== .workspace-trusted ===" cat "$TARGET/.workspace-trusted" || echo "NOT FOUND" echo "" echo "=== mcp-approvals.json ===" cat "$TARGET/mcp-approvals.json" || echo "NOT FOUND"
we tried maybe forcing the mcp list command via cursor-agent mcp list --force and this results with === Listing MCP servers === Failed to load MCP server âcontext7â: Error: MCP server âcontext7â has not been approved. Please approve it before loading.
so it seems to be a trust/approval issue and there is no workaround for it, and it seems on cursor-cli side, when configuring the cursor-cli locally it creates a .workspace-trusted file along with mcp-approvals.json that has the configured mcp server along with a hashed id that I assume changes each time when a new machine is spun up in CI so creating them manually would not solve it.
what can we do in order to work around it? or is it not implemented yet on cursorâs side?
NOTE THAT WE HAVE LOGS AND WE EE IN THE LOGS THAT THE MCP SERVERS ARE RUNNING AND WE PRINT THE MCP.JSON file so it does not seem an issue with the mcps or configuration.
thanks!
Steps to Reproduce
- create a .github/workflows/workflow-name.yml
- setup a simple workflow that checks out the current repo branch and instals the cursor cli like in this link Code Review with Cursor CLI | Cursor Docs
- configure simple mcp server such as context7 in your .cursor/mcp.json and copy that file in your workflow i.e:
- name: Setup MCP configuration
shell: bash
run: |
# Create MCP config directory
mkdir -p ~/.cursor
cp .cursor/mcp.json ~/.cursor/mcp.json
echo "MCP configuration copied to ~/.cursor/mcp.json"
cat ~/.cursor/mcp.json
and use the cursor cli to call the mcp server with a simple prompt i.e
- name: đ use context7 mcp
timeout-minutes: 5
env:
MODEL: claude-4.5-sonnet
CURSOR_API_KEY: ${{ secrets.CURSOR_API_TOKEN }}
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
BRANCH_PERFIX: feature/
run: cursor-agent -p "get and display the latest docs on playwright fixtures using context7 mcp" -force --model "$MODEL" --output-format=text
Expected Behavior
- should call the configured mcp server and call itâs tools
Operating System
Linux
Current Cursor Version (Menu â About Cursor â Copy)
Version: 1.7.52 (Universal)
For AI issues: which model did you use?
claude-4.5-sonnet
Does this stop you from using Cursor
No - Cursor works, but with this issue