# Cursor Agent Exits Tool-Call Loop on MCP Tool Error

**URL:** <https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088>\
**Category:** Bug Reports\
**Tags:** cli\
**Created:** [October 20, 2025, 6:21am UTC](https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088 "2025-10-20T06:21:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fanbingxin](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fanbingxin](https://forum.cursor.com/u/fanbingxin)\
**Post date:** [October 20, 2025, 6:21am UTC](https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088/1 "2025-10-20T06:21:39Z")

</div>

### Where does the bug appear (feature/product)?

Cursor CLI

### Describe the Bug

When the Cursor Agent calls an MCP tool and the tool returns an error, the Agent immediately exits its execution loop instead of handling the error and trying a new plan or calling another tool. This results in the overall task failing prematurely whenever an MCP tool-call is unsuccessful.

### Steps to Reproduce

Start a task with the Cursor Agent that requires calling a custom MCP tool.

Ensure the MCP tool-call fails and returns an error message. (e.g., provide invalid input that triggers a gitlab tool error).

Observe that the Agent stops its current operation (plan/execute loop) immediately after receiving the error.

### Expected Behavior

The Agent should receive the MCP tool error, recognize it as an execution failure, and attempt to self-correct by:

Revising its plan.

Trying the tool again with corrected parameters.

Trying an alternative tool or approach.

(As a last resort) clearly stating the tool-call failed and asking the user for guidance.

### Operating System

Linux

### Current Cursor Version (Menu → About Cursor → Copy)

cursor-agent --version  
2025.10.13-405ee2e

### For AI issues: which model did you use?

auto

### Does this stop you from using Cursor

Yes - Cursor is unusable

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [October 20, 2025, 7:21am UTC](https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088/2 "2025-10-20T07:21:44Z")

</div>

Hey, thanks for the report. This looks like a separate issue from the MCP STDIO transport bug the team is already working on.

Your request is specifically about error recovery, the agent should retry or adjust its plan when an MCP tool returns an error, rather than exiting immediately. I’ll pass this to the team.

---

<div class="post-metadata">

**Author:** ![fanbingxin](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fanbingxin](https://forum.cursor.com/u/fanbingxin)\
**Post date:** [October 20, 2025, 7:52am UTC](https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088/3 "2025-10-20T07:52:29Z")

</div>

Thanks for the quick response and for clarifying that this is a distinct issue regarding error recovery!

To provide more context: the specific MCP server I was using when I encountered this bug is the GitLab MCP Server available here: [Florian Forster / gitlab-mcp · GitLab](https://gitlab.com/fforster/gitlab-mcp) via STDIO mode.

Since the team is already working on an MCP STDIO transport bug, could you please share the link to the thread or issue where that is being discussed? I’d like to check if there is any temporary workaround mentioned there that might help me avoid the immediate exit/loop-break issue in the meantime.

Thanks again!

---

<div class="post-metadata">

**Author:** ![fanbingxin](https://avatars.discourse-cdn.com/v4/letter/f/c67d28/32.png) [@fanbingxin](https://forum.cursor.com/u/fanbingxin)\
**Post date:** [October 20, 2025, 7:54am UTC](https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088/4 "2025-10-20T07:54:40Z")

</div>

On a separate but related note regarding MCP usage in automation: I’ve also run into issues with MCP tool authentication in headless/CLI mode.

Currently, even if I configure an MCP tool in `~/.cursor/mcp.json`, the agent in headless mode cannot access it without an initial interactive “Trust Workspace” approval. **Are there any plans or existing workarounds to simplify MCP tool access/trust in headless (CLI) environments for CI/CD workflows?**

Any insight would be greatly appreciated! Thanks again for your support.

---

<div class="post-metadata">

**Author:** ![system](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/system/32/99069_2.png) [@system](https://forum.cursor.com/u/system)\
**Post date:** [November 11, 2025, 2:22pm UTC](https://forum.cursor.com/t/cursor-agent-exits-tool-call-loop-on-mcp-tool-error/138088/6 "2025-11-11T14:22:08Z")

</div>

This topic was automatically closed 22 days after the last reply. New replies are no longer allowed.
