-
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 though 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 https://cursor.com/install | 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: Approve workspace trust and MCP servers interactively
env:
CURSOR_API_KEY: ${{ secrets.CURSOR_API_TOKEN }}
shell: bash
run: |
set -euo pipefail
SANITIZED="$(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.
would be awesome if cursor-cli support working with mcp servers in CI environments
is there any other solution/workaround we can try to solve this issue?