Field notes
Can an MCP server handle two tool calls at once?
Yes, the MCP TypeScript SDK dispatches concurrent tool calls. Whether they overlap is decided by your handler. We measured three parallel calls at 900ms and 302ms.
Mark
Head of Marketing, MCPOrbit
- Published
- Updated
- · Updated
- Read time
- · 8 min read
Yes. A Model Context Protocol (MCP) server built on the TypeScript SDK accepts a second tools/call request before the first one has finished. Whether the two calls actually overlap is decided by your handler, not by the protocol and not by the SDK.
This matters because models call tools in parallel. One assistant turn can carry several tool calls, and the client sends them together. If one of your handlers blocks the event loop, those calls queue behind each other, and the user waits for the sum of them instead of the slowest one. We measured both shapes on the same server: three parallel calls to a blocking handler took 900ms, and three parallel calls to a handler that yields took 302ms.
Does an MCP server really get more than one request at a time?
It does. MCP is JSON-RPC, and every request carries an id. A client is free to write a second request onto the pipe before the first response comes back, then match responses to requests by id. That is true of both transports, so a stdio server on a single pair of pipes is not limited to one request in flight. See MCP transport: stdio vs Streamable HTTP for how the two differ.
The SDK reads a message, finds the handler, and calls it. It does not wait for your promise to settle before reading the next message. So the concurrency is real, and the limit is whatever your handler does with the thread it is given.
A server that shows the difference
This server has four tools. Two of them wait 300ms in different ways. The other two do the same real CPU work in different places. Versions are pinned so the numbers below are reproducible.
{
"name": "mcp-concurrency-demo",
"private": true,
"type": "module",
"dependencies": { "@modelcontextprotocol/sdk": "1.32.2" }
}import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { z } from "zod"
import { setTimeout as sleep } from "node:timers/promises"
import { pbkdf2, pbkdf2Sync } from "node:crypto"
import { promisify } from "node:util"
const pbkdf2Async = promisify(pbkdf2)
const ROUNDS = 800_000
const server = new McpServer({ name: "concurrency-demo", version: "1.0.0" })
server.registerTool("wait_blocking",
{ description: "Waits by spinning on the clock. Blocks the event loop.",
inputSchema: { ms: z.number() } },
async ({ ms }) => {
const until = Date.now() + ms
while (Date.now() < until) {} // busy-wait: nothing else can run
return { content: [{ type: "text", text: `blocked ${ms}ms` }] }
})
server.registerTool("wait_async",
{ description: "Waits by yielding to the event loop.",
inputSchema: { ms: z.number() } },
async ({ ms }) => {
await sleep(ms)
return { content: [{ type: "text", text: `awaited ${ms}ms` }] }
})
server.registerTool("hash_sync",
{ description: "CPU-bound key derivation on the main thread.",
inputSchema: { seed: z.string() } },
async ({ seed }) => {
const out = pbkdf2Sync(seed, "salt", ROUNDS, 32, "sha512").toString("hex")
return { content: [{ type: "text", text: out.slice(0, 16) }] }
})
server.registerTool("hash_threadpool",
{ description: "Same CPU work, handed to the libuv threadpool.",
inputSchema: { seed: z.string() } },
async ({ seed }) => {
const out = (await pbkdf2Async(seed, "salt", ROUNDS, 32, "sha512")).toString("hex")
return { content: [{ type: "text", text: out.slice(0, 16) }] }
})
await server.connect(new StdioServerTransport())wait_blocking and wait_async both take about 300ms on their own. The difference only appears when two calls arrive together.
Measure it from a client
The client spawns the server over stdio, then fires n calls with Promise.all and times the whole batch. Running each case three times and taking the median keeps a single slow start from deciding the result.
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
const client = new Client({ name: "bench", version: "1.0.0" })
await client.connect(new StdioClientTransport({ command: "node", args: ["server.mjs"] }))
async function run(name, args, n) {
const t0 = performance.now()
await Promise.all(
Array.from({ length: n }, () => client.callTool({ name, arguments: args }))
)
return Math.round(performance.now() - t0)
}
for (const [name, args, n] of [
["wait_blocking", { ms: 300 }, 1], ["wait_blocking", { ms: 300 }, 3],
["wait_async", { ms: 300 }, 1], ["wait_async", { ms: 300 }, 3],
["hash_sync", { seed: "a" }, 1], ["hash_sync", { seed: "a" }, 3],
["hash_threadpool", { seed: "a" }, 1], ["hash_threadpool", { seed: "a" }, 3],
["hash_threadpool", { seed: "a" }, 8],
]) {
const runs = []
for (let i = 0; i < 3; i++) runs.push(await run(name, args, n))
runs.sort((a, b) => a - b)
console.log(`${name.padEnd(16)} n=${String(n).padEnd(2)} median=${runs[1]}ms`)
}
await client.close()Measured on an Apple M4 with Node 25.8.1 and @modelcontextprotocol/sdk 1.32.2:
wait_blocking n=1 median=301ms
wait_blocking n=3 median=900ms
wait_async n=1 median=302ms
wait_async n=3 median=302ms
hash_sync n=1 median=144ms
hash_sync n=3 median=430ms
hash_threadpool n=1 median=144ms
hash_threadpool n=3 median=166ms
hash_threadpool n=8 median=333msRead the pairs. wait_blocking goes from 301ms to 900ms, which is exactly three times one call: the three calls ran one after another. wait_async goes from 302ms to 302ms, so all three ran in the same 300ms window. Same protocol, same SDK, same number of calls. The only thing that changed is whether the handler gave the event loop a chance to run.
Why async does not fix a CPU-bound tool
An async function is not a thread. If the body of your handler runs 800,000 rounds of key derivation on the main thread, nothing else runs until it finishes, and the async keyword changes none of that. hash_sync is that case, and three calls took 430ms against a 144ms baseline. It serialized just as badly as the busy-wait.
hash_threadpool does the identical work through the callback form of pbkdf2, which runs on Node's libuv threadpool instead of the main thread. Three calls took 166ms against the same 144ms baseline. The work now overlaps, and the main thread stays free to read the next request.
The threadpool has a ceiling, and it is four
Moving work to the threadpool buys you four parallel operations, not unlimited ones. That is the libuv default. Eight concurrent calls to hash_threadpool took 333ms, roughly two waves of four. Raising the pool size and re-running the same eight calls shows where the limit was:
UV_THREADPOOL_SIZE=default(4) 8 concurrent -> 319ms, 329ms
UV_THREADPOOL_SIZE=8 8 concurrent -> 245ms, 244msThe time drops, so the queue was real. It does not drop all the way to one wave, because eight key derivations now compete for cores instead of waiting for a thread. That is the honest shape of this knob: it moves a queue, it does not create capacity. Set UV_THREADPOOL_SIZE deliberately, and remember the pool is shared with file system and DNS work.
What to change in your server
- Find every handler that does work without an
awaitin it. Those are the ones that serialize your server. - Replace synchronous library calls with their async forms.
pbkdf2Sync,readFileSyncandexecSyncare the usual offenders. - Move real computation to a worker thread or a separate process. The threadpool is for library work that already uses it.
- Time your tools with more than one call in flight. A single-call benchmark cannot show this class of problem at all.
- Give a slow tool a timeout and a progress signal, so a client is not left guessing.
The last point has its own mechanics. How to handle timeouts in an MCP server covers the cancellation side, and how to build an MCP server that runs long tasks without timing out covers work that outlives a single request. Both assume the server can still answer while the slow tool runs, which is what this post is about.
Frequently asked questions
Frequently asked questions
- Can an MCP server handle concurrent tool calls?
- Yes. MCP is JSON-RPC and each request carries an
id, so a client can have severaltools/callrequests in flight at once. The TypeScript SDK reads the next message without waiting for your handler to finish, so the concurrency depends on whether your handler yields. - Does the MCP TypeScript SDK run my tool handlers in parallel?
- It calls them without waiting for the previous one to settle, but it does not give them threads. Handlers share one event loop, so two handlers overlap only if they
awaitsomething. A handler that blocks runs to completion before any other work happens. - Why does my MCP server get slower when the model calls several tools at once?
- Most often one handler is blocking the event loop, so the calls run one after another and the total is their sum. Time the same tool with one call and with three concurrent calls. If three calls take three times as long, the handler is serializing them.
- Does making a tool handler async make my MCP server concurrent?
- Only if the handler actually awaits. An
asyncfunction that runs a long synchronous computation blocks the event loop exactly like a non-async one. Use the async form of the library, a threadpool call, or a worker thread. - What should UV_THREADPOOL_SIZE be for an MCP server?
- The default is four, which caps how many threadpool operations run at once. Raise it only if you have measured a queue and have cores to spare, and remember file system and DNS calls share the same pool. It moves a bottleneck rather than removing one.
- How do I test MCP tool concurrency?
- Spawn the server from a real MCP client, send n calls with Promise.all, and compare the batch time against a single call. Run each case a few times and take the median so a cold start does not set the number.
If you want to see this on a server you did not write, MCPOrbit connects to any MCP server and writes the config for you, so you can watch how it behaves with real traffic.
About the author
Mark
Head of Marketing, MCPOrbit
Mark writes about running MCP servers in production at MCPOrbit, where we connect to a lot of other people's servers and watch what breaks.
