Skip to content

Agent executes tools on the proxy server instead of forwarding them to the client #3

@sxin0

Description

@sxin0

Problem

When using cursor-api-proxy as a forwarding layer, the agent does not purely forward messages back to the client. Instead, it actively executes tool calls (such as file reads/writes) on the proxy server's own working directory.

Steps to Reproduce

  1. Deploy cursor-api-proxy on a remote server
  2. Configure Claude Code (CLI) to use the proxy endpoint
  3. Ask the agent to perform file operations (e.g., write content to a file, read a file)

Expected Behavior

The proxy should transparently forward all messages (including tool calls and their results) between the client and the upstream API. Tool executions like file editing should happen on the client side (where Claude Code is running), not on the server.

Actual Behavior

The agent interprets and executes tool calls locally on the proxy server. For example:

  • When asked to write to demo.txt, it writes to the server's filesystem, not the client's
  • When asked about the current working directory, it returns the server's working directory (e.g., /tmp/cursor-proxy-xxxxx) instead of the client's project path

This means the proxy is not acting as a transparent relay — it is consuming and acting on the tool calls itself.

Environment

  • Client: Claude Code (Anthropic's official CLI tool)
  • Proxy: cursor-api-proxy deployed on a remote server

Impact

This makes the proxy unusable in a server-client deployment model, since all file operations and tool executions affect only the server environment and have no effect on the client's local project. Claude Code expects tool results to come from its own local environment, but the proxy intercepts them.

Expected Solution

The proxy should forward tool call requests and responses transparently between Claude Code and the upstream API, without intercepting or executing them on the server side.


 ▐▛███▜▌   Claude Code v2.1.70
▝▜█████▛▘  Opus 4.6 · API Usage Billing
  ▘▘ ▝▝    ~/demo

  Welcome to Opus 4.6

❯ @demo.txt Write any content into this file at will. This session will be
  answered in English.
  ⎿  Read demo.txt (1 lines)

⏺ Done — I've written some content into demo.txt. Let me know if you'd like to
  change anything in it.

✻ Churned for 33s

❯ What is the current working directory path?

⏺ The current working directory path is /tmp/cursor-proxy-2w643T.

! cat demo.txt
  ⎿  (No output)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions