DEV Community

Cover image for Claude Code now backgrounds slow MCP calls. claude -p still waits
The Paste-Ready Engineer
The Paste-Ready Engineer

Posted on

Claude Code now backgrounds slow MCP calls. claude -p still waits

I asked "what's 17×3?" in the middle of a 60-second build. Claude answered right away, then told me the build had finished.

Whenever I hand a build or a test run to an MCP tool, Claude Code's input box is locked until it finishes. A five-minute build means five minutes of staring at the terminal. I always think of a question halfway through ("wait, what was that warning last time?") and I can't ask it.

Recent versions of Claude Code ship something called MCP Tasks: long MCP calls are supposed to move to the background so you can keep talking. I wanted to know if that's true in practice, and where it doesn't apply.

So I built the most boring MCP server possible, one that sleeps and then says "BUILD OK", and tried it two ways. In the terminal, the call moved to the background after 15 seconds and Claude answered my next question instantly. With claude -p, it didn't background at all and waited the full 25 seconds, which turned out to be exactly what you want for scripts.

A fake build is enough to test it

The test server is a few lines of Python. One tool, slow_build, takes a number of seconds, sleeps that long, and returns "BUILD OK" with a warning count.

By default a call moves to the background after two minutes. I didn't want to wait two minutes per try, so I set the threshold with an environment variable before starting Claude Code:

CLAUDE_CODE_MCP_AUTO_BACKGROUND_MS=15000 claude
Enter fullscreen mode Exit fullscreen mode

Then the whole experiment was three steps:

  1. Ask Claude to call slow_build with 60 seconds
  2. Thirty seconds in, while it's still running, ask "what's 17×3?"
  3. Wait for the build to finish

The call moved to the background at 15 seconds

Fifteen seconds after the call started, Claude said, roughly: "slow_build is still running, so I've moved it to the background as a task. You'll be notified when it finishes."

A "1 MCP task" indicator appeared at the bottom of the screen, and the input box was free again.

I asked "what's 17×3?" and got "51" immediately, with the build still going. That sounds trivial, but it's the first time I've had a normal conversation in the middle of a build. I was happier about it than a multiplication deserves.

About thirty seconds later, the build finished. A "MCP task … completed" notice appeared, and Claude reported on its own: "slow_build finished. BUILD OK, 3 warnings." I didn't have to ask whether it was done.

Background tasks show up in /tasks, and that's also where you stop one. Pressing Esc does not stop it, which is the one thing I'd tell a teammate before they try this.


claude -p still waits, and that's a good thing

Next I called the same tool from claude -p, the one-shot mode with no interactive screen. I set the threshold even lower, 5 seconds, and asked for a 25-second build.

It never went to the background. Claude waited the full 25 seconds, returned "BUILD OK after 25s", and the whole run took about 30 seconds.

That makes sense once you think about it. -p prints an answer and exits. If the call were pushed to the background, nobody would be around to receive the result. From what I could find, calls made from subagents don't go to the background either.

So if you run builds through claude -p from cron or CI, nothing changes. Your scripts wait like they always did. The new behavior only applies when a person is sitting at the terminal.

Backgrounding can break steps that must happen in order

The two-minute threshold is adjustable with the same variable. Setting it to 0 turns the feature off and brings back the old "always wait" behavior.

The case I'd be careful with is work where the next step depends on the build. Once a call goes to the background, Claude replies and is free again. If I then ask for something else, it can move on without having looked at the build result. "Build, then deploy if it passed" is exactly the kind of request where that matters.

For those, I either don't say anything until the completion notice arrives, or I start that session with the threshold at 0. The official Claude Code MCP docs are the place to check the current default and options, since this area is still moving.

What I'd keep from all this:

  • In the interactive terminal, long MCP calls move to the background (after 2 minutes by default) and you can keep talking
  • When they finish, you get a notice and Claude reports the result; stop them from /tasks, not Esc
  • claude -p and subagents never background, so scripts and CI behave exactly as before
  • For "do A, then B only if A passed", wait for the notice or set the threshold to 0

Getting those few minutes of build time back for other questions is a small change, but it's one I notice every day.

Over to you: what's the longest-running tool you call from Claude Code, a build, a test suite, something else? Tell me in the comments.

📦 If you use Claude Code every day, my Claude Code Workflow Kit bundles 5 skills I actually run (claude-org, scout, local-worker, skill-folderize, split-commits) for $29.

🎁 New here? Start with my free skill: mcp-key-check finds the API keys your MCP setup left in plain text and prints the commands to fix them. Pay what you want, $0 is fine.

If this was useful, a ❤️ and a follow would mean a lot. I write about practical ways to put AI to work in indie development.

The experiments and numbers in this post come from my own projects. I wrote it with the help of AI (Claude).

Top comments (1)

Collapse
 
smtahosin profile image
S M Tahosin •

that /tasks not Esc detail lol, i'd 100% mash Esc and wonder why my docker build kept going xD longest tool for me is a docker build through my own agent setup, 3-4 mins on a cold cache, and yea ordering scares me too.. B starting before A passes is how i'd ship a broken image at 1am. threshold 0 for those runs, stealing that :D