Stateless MCP has recaptured my interest

(simonwillison.net)

84 points | by tosh 4 days ago

12 comments

  • stpedgwdgfhgdd 2 minutes ago
    Interesting that a date format is used for MCP-Protocol-Version.
  • drdexebtjl 1 hour ago
    In retrospect, stateful MCP was clearly wrong.

    This essentially makes MCP just another REST API endpoint, and lets you use the same infrastructure you already have set up for REST APIs (like load balancers, API gateways, progressive rollouts, etc).

    • bloppe 37 minutes ago
      MCP is basically just:

      1. a REST-like API

      2. with a spec (OpenAPI, introspection, etc.)

      3. with harness-level authz (the ability to allow / deny specific methods in the harness)

      The only part that's actually new is #3, but it seems like it should be fairly easy to provide similar support for REST APIs. There might already be a Pi extension that allows you to allow / deny particular method / path patterns for particular sites. Regardless, there's always service-level authz with service accounts, at least for the more sophisticated APIs.

      So ya, I don't see why we need a whole new set of standards and protocols just to have harness-level fine-grained API permissions. We could have just done it all with REST.

      • 9dev 27 minutes ago
        The spec is more than just an OpenAPI scheme; it’s a strict wire format with shared semantics for a huge range of features.
    • pjmlp 44 minutes ago
      Something that anyone doing distributed systems knows after a few scars, stateless servers are always better, and stateful only if there is no way around it.

      I learnt this with Sun RPC and the whole "The network is the computer".

      Somehow this keeps having to be relearnt.

      • shermantanktop 31 minutes ago
        I keep encountering mistakes by people who are convinced that agentic interactions are nothing new, that all the decades of hard-won lessons about service API design are 100% relevant and nothing more is needed, that agents can be relegated to the role of just-another-caller and left to the dismal domain of client developers.

        It’s not true. It’s not totally untrue, but don’t hide your head in the sand.

        • tibbe 20 minutes ago
          You didn't provide any arguments to support your claim. Calling people names isn't going to convince anyone.
  • firasd 1 hour ago
    I think stateless-type MCP was already possible, eg my MCP Clock [https://github.com/firasd/mcpclock]:

      > curl -s -X POST "https://mcpclock.firasd.workers.dev/mcp" -H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" -d '{"jsonrpc":"2.0","id": 1,"method":"tools/call","params":{"name":"clock_get","arguments":{}}}' | grep '^data:' | sed 's/^data: //'| jq
    
      {"result": {"content": [{"type": "text",
              "text": "[\n  {\n    \"timezone\": \"UTC\",\n    \"iso\": \"2026-08-05T04:44:41.707Z\",\n    \"unixtime\": 1785905081\n  },\n  {\n    \"timezone\": \"Alphadec\",\n    \"alphadec\": \"2026_P4A0_466322\"\n  }\n]"
            }]},"jsonrpc": "2.0", "id": 1}
    
    The "just use a CLI" crowd is implicitly assuming:

    1) You're a developer 2) On a laptop 3) With a shell open inside an agentic coding harness (Claude Code, Codex CLI, Cursor) 4) Working on a software project

    That's maybe 2% of AI usage.

    The other 98% is: Someone on the ChatGPT iOS app asking a question on the subway; Someone in Claude.ai web chatting about their calendar; Someone using ChatGPT Desktop to summarize their Notion; A non-developer using AI in a browser at work; Voice mode on a phone; An embedded chat widget on some company's website...

    • eddythompson80 1 hour ago
      I think part of the “just use a CLI” crowd might also be building similar agents as ChatGPT and Claude.ai web interface. I know at least 4 teams doing that in one company.

      All those teams, including ChatGPT and Claude.ai, have figured out that you will eventually need to give your agent a small sandbox Linux environment to unlock the same level of “intelligence“ those coding harness exhibit. Stitching together the results of a cli command through scripting or coding gives the agent a ton more flexibility in what it can do as it can utilize its text generation capability into executable logic. toolcalls mostly work for actions rather than complex and novel problem solving. You are making the agent represent a programming control flow through toolcalls while carrying the context between them in a lossy, nondeterministic, wasteful, slow and rigid way.

      It’s one thing if you want to artificially limit that agent to a very strict set of available APIs that it must use in a specific way while transferring context between them through the LLM and you don’t want to incur the cost of the extra sandbox compute. But coding harnesses have demonstrated that letting the agent write a small shell or python script can let the agents solve problems that you haven’t even really anticipated in your toolcall approach or that tool calls make prohibitively expensive or not even possible.

      But also the token cost tends to dwarf the sandbox compute cost, so why not pay the $0.05/hour to have a sandbox where the agent can run free when you are already paying orders of magnitude more for the tokens

      • firasd 57 minutes ago
        Hmm yeah but I think at some point ad-hoc code becomes a signal that something is wrong. eg. If your LLM is continuously writing python to join customers to orders at some point that's a signal that customers_aggregate('topspenders') needs to be a thing like a deterministic API call
        • drdexebtjl 49 minutes ago
          At that point you would add a `your-service-cli list-customers --order-by=spent` command, which would also be useful to humans and scripts, as opposed to an MCP tool call, which is only ergonomic to models.
          • firasd 43 minutes ago
            Right we can quibble about the wire protocol but the point remains that the arbitrary REPL becomes suboptimal as a solution when there’s not a deterministic endpoint. So ‘scripting’ is not really what we are looking for; we just want the final data output and scripting is fine when it’s a one off
            • drdexebtjl 8 minutes ago
              They’re not the same thing under a different wire protocol!

              An MCP tool call that returns the top N spenders puts the result in the agent’s context window.

              A CLI tool call on the other hand… The agent can pipe their results into other completely unrelated CLI tools. It can write a loop that calls multiple tools.

              These things are not possible with MCP but are trivial with CLIs.

    • acchow 1 hour ago
      The "CLI crowd" is also primarily using LLMs on their own computer. Where they have their CLI tools.

      This doesn't cover the case when you're talking to an LLM from web, or via Slack or Linear, etc. There, you will want MCP so the LLM can use services on your behalf as you. That's portability.

      • drdexebtjl 40 minutes ago
        Why can’t the LLM you’re talking to on the web not have access to your CLI tools?

        When you talk to an LLM on the web, the harnesses spin up a fresh environment (I would hope it’s a VM…) so that the LLM can do stuff like run arbitrary Python and Bash scripts to complete the task you asked it for.

        There’s no reason why you shouldn’t be able to customize this environment to add whatever CLI tools and credentials you need for the agent to act on your behalf.

        The UX would be exactly the same.

    • drdexebtjl 59 minutes ago
      I don’t think the “just use a CLI” crowd really are assuming you’re a developer in a coding harness.

      All of those use cases you mentioned benefit from the agent having access to a temporary virtual machine with a set of standard CLI tools and the ability to write and execute arbitrary code.

      Most already do. ChatGPT has been running Python in the cloud to answer questions before we even had functional coding harnesses.

      So why not augment their repertoire of CLI tools instead of a completely new protocol?

      • firasd 46 minutes ago
        I guess if the agent is strongly trained to reach for the container then maybe

        But let’s take my MCP clock for example if you ask ChatGPT what’s the time in Tokyo it’s not even gonna think of booting up the code interpreter. It’s gonna just do web search and give you the wrong time (I just tried it and there may be an OpenAI built in widget it pops up now—but again that’s a specific tool call with an iframe output not arbitrary code)

        • drdexebtjl 33 minutes ago
          Because there’s probably a tool call for web search, and a tool call for arbitrary code. There’s no discovery for the CLI tools it has available unless it has already chosen to run arbitrary code.

          The point is that even web search should be a CLI tool, and all ChatGPT would know to do other than talk to you is how interact with a shell.

          Then if you ask it what’s the time in Tokyo, it would likely reach for the POSIX date command, instead of web search, because both would be equally visible.

          • firasd 11 minutes ago
            The amusing thing here though is that if we do high frequency container usage like you’re suggesting eventually we’re gonna reimplement MCP right. Cause then it’s like npx thiscommand —help (aka MCP tools/list) and then OAuth and all that ..
    • kristjansson 1 hour ago
      Also:

      your messages causing your LLM (harness) to run CLIs on your computer? charming, thrilling, great fun.

      other people’s messages causing your LLM to run CLIs on your (cloud) computer? terrifying, awful, sickening, no fun at all

      • floren 13 minutes ago
        The LLM can't tell the difference between your messages and theirs, however many times you say "No mistakes"
  • cush 53 minutes ago
    But is it composable like cli? The main issue to be with MCP is the entire response ends up in the context window. Whereas a decent harness and agent is usually going to pipe together and filter many tools in one long command without spending all the extra tokens.
  • Foobar8568 21 minutes ago
    I still don't get MCP. Most likely because I didn't really check but the first feeling is creating a problem to solve a problem that doesn't exist in the first place.
    • qalmakka 13 minutes ago
      It's mostly useful to allow sandboxed AI apps to access external functionality. If an LLM has any kind of access to a CLI then it stops making sense, because LLMs are very good at CLI and almost always they use less tokens doing that. Plus, you human can easily use a cli tool, while mcp is just for agents.
    • mmasu 18 minutes ago
      In enterprise MCP allows users to access resources that could either be unsafe or impractical to consume via API or CLI. It is a powerful pattern, supported by virtually all clients (Cursor, Claude Code, Codex, whatever) and easily implemented in custom harnesses. If you don’t need it you don’t, but it has many useful applications. Stateless will make it a lot more practical to expand applications.
    • kmarc 13 minutes ago
      I my mind it's mostly corporate socio-political. Your management have no idea what a (rest) API is, but they saw MCP in countless LinkedIn slop and therefore you are allowed to work on one / use an upstream solution to connect the agents to your 23 year old monolithic unmaintained homebrew CRM that only runs because overcompensated Frank is still willing to pet it manually.
  • ameshkov 2 hours ago
    > I couldn’t find a great CLI tool for interactively probing an MCP server

    What about mcp-inspector? It’s a nice tool, can be used interactively, can be used as a CLI.

    https://github.com/modelcontextprotocol/inspector

    • simonw 1 hour ago
      The documentation for the --cli mode is a bit lacking, but I got there in the end:

        npx @modelcontextprotocol/inspector --cli \
          https://agentic-mermaid.dev/mcp \
          --method tools/call \
          --tool-name render_svg \
          --tool-args-json '{"source":"graph TD; A-->B","options":{"padding":24}}'
      
      Equivalent with my mcp-explorer tool:

        uvx mcp-explorer call \
          https://agentic-mermaid.dev/mcp render_svg \
          -a source 'graph TD; A-->B' \
          -a options '{"padding":24}'
      
      So yeah, they're pretty similar.

      Then for my list command:

        uvx mcp-explorer list https://agentic-mermaid.dev/mcp
      
      With the inspector one you would do:

        npx @modelcontextprotocol/inspector --cli \
          https://agentic-mermaid.dev/mcp \
          --method tools/list
      
      Mine returns a human-readable list (unless you add --json), the inspector one returns a big dump of raw JSON.
    • hobofan 1 hour ago
      I would generally agree, but a word of caution for anyone trying it out from this thread: Try the latest pre 2.x version. The 2.0.0 that was released last week is highly broken even for some of the most common connection scenarios.
  • luciana1u 33 minutes ago
    we invented a stateful protocol, discovered state is hard to scale, stripped it out, and arrived at "just send a POST request." the REST crowd has been smugly waiting for this moment for 20 years.
  • tosh 2 hours ago
    I'm glad MCP is getting simpler

    a few months ago I tried to implement an MCP server from scratch in python (instead of using the existing reference implementation) and I could not get it to work reliably across clients

  • CharlieDigital 2 hours ago
    Stateless MCP was already possible before this and made sense for whole classes of use cases where it helps to have a remote fleet of servers.

    Wrote about this back in March: https://chrlschn.dev/blog/2026/03/mcp-is-dead-long-live-mcp/

    MCP is going to be a foundational piece of enterprise agent infra.

    • hchja 1 hour ago
      MCP was much more important when agents weren’t able to accurately make tool calls.

      Nowadays, these agents are more capable and I think you can replace MCP (which is a pain on macOS), with simple CLI tools and expose them to agents via system prompt, skills, or other API documentation.

      • spike021 1 hour ago
        How well does that work in enterprise setups?
        • charcircuit 59 minutes ago
          Well assuming a browser is able to access whatever enterprise thing, the LLM can emulate being one using apps like curl.
  • pianopatrick 2 hours ago
    Maybe someone could set up a CLI tool for agents such that you can give them a shell but they use this CLI tool instead of raw curl.

    Like a tool where the AI can only call out to certain APIs based on a config file the agent cannot change.

    That way you can leverage all the shell knowledge agents already have while still limiting what network calls they can make, and you wouldn't have to set up a server to use an agent.

    • nickstinemates 1 hour ago
      This is basically what Swamp is[1]. You give an agent a typed interface to extend itself (or use other peoples extensions) into the systems you need to fulfill your request. Think of it like on-demand tool calls. Then it records everything that happens in the swamp. The swamp can be single machine, multi-machine, or centralized with your co-workers.

      As a result, everything compounds. The work I do doesn't need to be re-derived by the work you do. Typed models keep everything repeatable and deterministic. Huge reduction in token spend and huge increase in speed.

      1: https://swamp-club.com

    • Wuzzy 1 hour ago
      I think this exists: https://github.com/imbue-ai/latchkey (and there are other similar projects, too).
    • parf02 2 hours ago
      A proxy?
      • pianopatrick 2 hours ago
        Maybe. I'm just spitballing but as I've been thinking about this, maybe just like a set of shell scripts.

        The idea could be that the agent runs as a unix user. That user has execute access to these scripts but not read or write access.

        So the agent can only do what those scripts allow, the scripts present an API. You could let agents call the scripts with -h to get instructions, and just put some text into context saying like "to access helper scripts call ./showHelp".

  • brianjking 3 days ago
    Yeah, there's a ton of great improvements in 7-28. I'm personally excited about what you posted about, but also with [tasks](https://blog.modelcontextprotocol.io/posts/2026-07-28-releas...) being officially adopted.