AI Engineer Europe 2026
MCP = Mega Context Problem - Matt Carey
Read the talk
MCP = Mega Context Problem
Making every API available to agents requires more than publishing tools: capabilities need progressive discovery, and generated programs need controlled execution.
From a talk by Matt Carey
Before you start: Familiarity with API calls, language-model tool calling and basic TypeScript will help you follow the demonstrations.
How do you make every API a tool for agents?
An API already lets software interact with the world. How do you give an agent that same reach? Matt Carey, who works on MCP and agents at Cloudflare, starts with function calling: the model produces a call, the application executes it, and the result returns to the model so it can answer the user. The weather example on screen shows that whole round trip.
Initially, each agent bundled its own integrations. If one developer wrote tools for Gmail, the next developer building a different agent had to repeat that work. Remote MCP offered a shared surface: the service provider could implement standardized tools once, alongside its existing API, CLI or GraphQL interface, and multiple agents could consume them. With eight tools, that arrangement looked manageable.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Full coverage fills the context window
Keep adding tools, however, and the interface itself becomes the problem. Before the agent has done any useful work, descriptions and parameter schemas consume its context. Carey reports that Cloudflare’s OpenAPI specification occupied 2.3 million tokens, and converting its endpoints into conventional tools still required roughly 1.1 million tokens. Exposing the entire API by loading one tool per endpoint was therefore impractical.
Cloudflare’s first response was to split the API into product-specific MCP servers. That reduced the context needed for any one integration, but transferred the selection problem to the user and left gaps in coverage. Carey gives a product-suite example with six exposed tools for roughly 30 API endpoints. A user could connect the right server and still lack the operation they needed.
Cloudflare quickly accumulated 16 MCP servers while its API had roughly 2,500 endpoints, approaching 2,600 at the time of the talk. More servers did not solve the underlying mismatch: users wanted access to a service, while the integration required them to choose subsets of that service in advance.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Discover capabilities when they are needed
The missing mechanism is progressive discovery. MCP is a protocol; it does not require a client to dump every capability into the model’s context at once. Different discovery strategies can operate over it. The same principle applies to prompts, resources and skills: availability does not have to mean eager loading.
A CLI already provides a discovery tree. In Carey’s Wrangler demonstration, the agent can inspect the top-level commands, select d1, find the database-listing operation, and consult --help for parameters. The corresponding shell sequence is small:
bash
wrangler
wrangler d1
wrangler d1 list --help
wrangler d1 list
Each step reveals enough information to choose the next one. Carey says this mostly works and points to OpenClaw as a popular example of CLI use. The requirement is shell access: an agent needs somewhere to run those commands.
Tool search provides a more structured alternative. For a request to create a Worker, Carey’s Claude Code example uses keyword matching to retrieve candidate tools. The model then selects the creation operation, but the other retrieved definitions remain in context. His illustrative retrieval size is eight tools, possibly six as implementations change. In Carey’s tool-search example, about 2,100 tokens enter context while only about 500 belong to the tool being used. Search still works quite well; it narrows the catalog without necessarily narrowing it to exactly one operation.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Let the model write against types
Cloudflare’s third approach, introduced in Code Mode: the better way to use MCP, lets the agent write code against an API. TypeScript types provide a concise description of inputs and outputs. Generate those types from an OpenAPI specification, give the relevant definitions to the model, and the model can compose operations into a program rather than select only an individual tool call.
The first demonstration is a request to list Workers. The model generates code against Cloudflare’s generated typed SDK; running that code returns the Workers on the account. Carey then moves to a workflow spanning multiple operations: deploy a Hello World Worker, protect it with Cloudflare Access, and apply a policy allowing only him to enter. Access is the application access-control service enforcing that policy.
The attraction is that the model supplies the composition. API authors maintain a specification, and generated types describe what the model can call. Better models can produce better programs, while a more accurate OpenAPI specification improves the contract those programs target. The specification remains the source of truth, rather than a separately maintained collection of agent-specific wrappers.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Generated code creates an execution problem
The approach did not immediately become standard in clients—here, “client” means the agent consuming MCP capabilities. Carey describes limited adoption in the months following the proposal. The obstacle was not simply generating code; it was accepting responsibility for running that code on a user’s behalf.
Unreviewed programs can read filesystem secrets, send those secrets in network requests, loop forever, exhaust resources or run a crypto miner. Giving an agent credentials makes it useful, but also makes the execution boundary consequential. A model’s ability to produce syntactically valid code does not establish what that code should be allowed to do.
Existing approaches make different compromises:
- Restricted languages: JSON-based DSLs and integration interpreters expose selected operations without accepting arbitrary programs.
- VM sandboxes: separate machines provide an execution environment with a larger infrastructure footprint.
- Code review: inspect programs before allowing them to run.
Carey introduces Cloudflare’s runtime primitive as another option for this problem, while explicitly expecting other implementations to emerge.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Program the execution boundary
A dynamic Worker can be created from a string of source code and run in a V8 isolate. In the demonstration, the generated program executes on the backend, not in the browser displaying the slides. Carey then probes the environment: with Node compatibility enabled, printing process.env reveals no secrets in this example, while a Cloudflare global is visible. Turning Node compatibility off makes process.env unavailable and the probe errors.
These are configurable execution environments, lighter than the conventional VM sandbox Carey discussed earlier. He describes the hosted service as capable of handling billions of requests. That is a capacity claim about the platform, separate from what the small live demonstration establishes.
The next program attempts to call an external API. Initially, the runtime rejects internet access through global functions. Carey changes a server-side Boolean and permits the request; he then explains that a more selective function can restrict access to particular domains, which is the approach used by Cloudflare MCP.
| Control in the demonstration | Observed behavior |
|---|---|
| Node compatibility enabled | process.env is accessible; no secrets appear |
| Node compatibility disabled | The environment probe errors |
| Internet access disabled | The external request is rejected |
| Internet access enabled | The external request is permitted |
The mechanism is explicit authority: the host decides which environment and network capabilities the generated program receives. The empty environment in this example should not be treated as a universal runtime default.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
API coverage and permission are separate
The next slide embeds an MCP client connected to the Cloudflare MCP server. Asking a question opens an authentication screen. After authorization, Carey has read-only access to his Cloudflare infrastructure through the API surface. The displayed account IDs identify accounts; Carey notes that they are not secrets.
The client lists a Worker. Carey then describes the broader range of operations the integration can expose: deploying Workers, adding Access, inspecting DNS and, prospectively, sending email. Its reach spans more than 2,000 API endpoints, but that does not grant the current session write permission. Coverage determines which operations can be represented; authorization determines which operations this user can execute. The live session remains read-only.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Code is a compact plan
The landscape now contains several ways for agents to act: CLIs running locally or in VMs, tool search, remote isolated execution, and interfaces represented as JSON. Code offers a common advantage across those arrangements. A single tool accepting a program can carry a plan with more degrees of freedom than an individual function call. The model can express iteration and composition inside that program instead of negotiating every step separately through the tool interface.
Carey expects demand for these programs to produce more isolated runtimes. He names workerd, Deno and Pydantic Monty, then demonstrates the alternatives. The workerd example spawns a dynamic Worker and computes a Fibonacci sequence. A small TypeScript computation captures the kind of workload being sent into that environment:
typescript
function fibonacci(count: number): number[] {
const values: number[] = [];
let current = 0;
let next = 1;
for (let i = 0; i < count; i++) {
values.push(current);
[current, next] = [next, current + next];
}
return values;
}
console.log(fibonacci(10));
The host’s job is to execute the supplied computation under its chosen restrictions; the sequence calculation does not require broad filesystem or network access.
The Deno example uses deno run, although Carey says he does not understand the checking shown in that example. Monty is introduced as an interpreter for untrusted Python. Its demonstration pauses while Python downloads, then completes and returns to the terminal prompt. The examples illustrate several routes to running generated programs, without establishing equivalent security policies across the runtimes.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
The API must survive the program
Accepting user-written programs recalls an older computing arrangement. Carey compares it to submitting punch cards to a computer operator: users provide instructions, and someone else’s infrastructure executes them. His forecast is that AI users will increasingly interact with services this way, whether the entry point is MCP, Bash or a CLI.
That changes the pressure on the service itself. A generated program can place API requests inside a loop, and multiple sandboxes can run those loops concurrently. Isolating each program does not protect the destination API from their combined traffic. Rate limiting must protect the service from concurrent generated workloads, not merely from one unusually active tool call.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
From generated actions to saved scripts
On the client side, users experience outcomes rather than protocol machinery: their agent either retrieves Gmail messages or fails to do so; worse, it might delete the inbox. Yet much of the implementation effort has gone into stateful connections and resumability. Carey says that complexity pushed developers toward stripped-down clients built around bare-bones SDK behavior, leaving less room for distinctive user interfaces.
He expects programmatic tool calling to become a client capability as well as a server capability. Remote clients can execute generated code through primitives such as workerd, Deno or Monty. His aside about simply using eval locally is a joke, not a safety recommendation; local execution still needs an authority boundary.
Once an action exists as code, the client can save it. Instead of asking the model to regenerate the same workflow every time, a user could retain a small script and rerun it. Carey’s example is a web-scraping automation:
- The user asks for a recurring scraping task without needing to know how scraping works.
- The agent generates a script that runs daily or every two days.
- When the brittle scraping logic breaks, the agent repairs the script and saves the replacement.
This is a proposed client experience: model reasoning creates and repairs the automation, while routine runs reuse the saved program.
Easier client development also suggests more agents deployed in the cloud. Carey contrasts a hypothetical world with one million agents against one with 100 agents per person. Maintaining a permanent sandbox for every agent becomes a different proposition at that scale. He expects more stateless agent loops, with state available when needed rather than an unavoidable property of every running client.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
MCP as part of the API framework
The final architectural prediction concerns the server SDK. Carey expects MCP to become middleware built into API frameworks: enabling it would feel like setting mcp: true. He predicts native integration in major TypeScript full-stack frameworks by the end of the talk’s year, 2026. The prerequisite is a lightweight SDK that expresses the protocol without imposing a large bundle or infrastructure burden.
In his hypothetical Next.js application, a thousand API operations could be exposed over MCP while clients use programmatic tool calling to work with them. The framework flag is a roadmap illustration, not a demonstrated configuration option. Carey identifies making the SDK small enough to fit application bundles as the remaining blocker to that experience.
For an implementation pointer, Carey closes with Code Mode: give agents an entire API in 1,000 tokens. The companion post’s approximately 1,000-token figure describes the discovery-and-execution tool surface, not total task context: discovery results and execution output still add tokens as the agent works. His adoption request is especially directed at providers with large APIs, including observability services whose data agents need to query.
The closing installation command is npm i agents, pointing readers toward the Cloudflare Agents SDK. For implementation today, that repository also lists @cloudflare/codemode as a separate package. The practical destination is an API that agents can discover and program against, with execution permissions and service protections strong enough to support that freedom.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Resources
From the talk
Matt Carey explains server-side API discovery and execution through two MCP tools.
Cloudflare's original explanation of generating TypeScript programs that compose MCP tool calls.
Source and connection instructions for Cloudflare's API MCP server.
SDK, examples and package documentation for building agents on Cloudflare.
Python interpreter written in Rust, with current installation instructions and embedding examples.
Updates since the talk
Current documentation for runtime-created Workers, including bindings, network access and resource controls.
Read the complete timestamped transcript
- 0:00
[upbeat music] Hello, everyone.
- 0:17
Welcome. Quiet down. Quiet down. Hey. Awesome. How is everyone? [cheers] Yeah, good? [claps]
- 0:31
Oh, thanks. Um-
- 0:32
MCP.
- 0:32
Yeah. [laughs] Wanna hear some MCP versus CLI debates? [laughs] Yeah, is that why you all came? Anyway, um, hello, my name is Matt. Uh, I work on MCP and agents at Cloudflare, and welcome to my talk.
- 0:45
It's all about how we can make every API a tool for agents. APIs exist in the wild, how can we connect them to agents and make them do things?
- 0:54
So I, I really love my job because every day I get to decide, like, uh, if an agent looked like this, would he do this, or would he do this?
- 1:01
And I think it's kind of fun. Um, and we often fluctuate between the two of them. Uh, someone does something s- that you think is slightly funny, and then six months later, we're all doing it and claiming it was the best thing in the world.
- 1:13
So yeah, it's a really good craic. But the main part of the, the role, I guess, and, like, what I end up doing day to day, is, like, how do we give agents hands?
- 1:21
How do we let them interact with the outside world? And you're probably familiar with something like this. This is tool calling, function calling. Uh, it's been around for a while now.
- 1:29
The LLM writes a function, you execute the function,
- 1:33
bash, bash, bash. The weather in London is eighteen degrees. It's not. It's, like, eight and it's freezing. Um, sad times. And then from there, we went from, uh, bundled tools to something like shared tools.
- 1:44
Like, people made tools in their agents, and the-- you probably-- this is, like, all, like, recent history, so everyone's probably aware of this. But before MCP, we had, like, uh, people would bundle all of their tools in their agents, and then they would keep them bundled in their agents.
- 1:56
And then if I was, like, trying to interact with Gmail or something, I would make loads of tools for Gmail, bundle them with my agents, and that would be it, and the next person would have to do exactly the same thing.
- 2:06
And then we ended up with this, like, big explosion of, uh, MCP and remote MCP about April last year. And the service providers were like, "Oh, we can, we can, like, uh, give everyone MCP tools, and then everyone can use the same standardized tools, and we just make it once, and we provide it as another surface for
- 2:23
people to consume our API." Maybe there's a CLI, there's an API, maybe there's like, I don't know, GraphQL API, um, and there's now MCP as, like, another surface. But this got a little bit fun because it was okay with, like, eight tools.
- 2:39
But then what happens if you added, like, a few more or a few more or a few more or a few more
- 2:47
or a few more? And now you s- you, you're like, "I wanna give an agent access to our whole API surface." And well, that ain't gonna, that ain't gonna happen.
- 2:56
Why is that not gonna happen? You've exploded a context window of the agent. You've, like, completely annihilated it. This is one point something million tokens. A-a-and this was the problem that we, like, came across a few, uh, well, around a year ago now.
- 3:10
We were trying to give access to the whole of the Cloudflare API to agents. You put all of the, the... You try and make naive tools out of every single API endpoint, and you fully explode a context window.
- 3:20
Our OpenAPI spec is two point three million tokens into tools. That's something like one point one million tokens, and that's, like, never gonna fly, even with, like, the biggest foundational models.
- 3:33
A-a-and in that time, we were like, "We know this is not necessarily an MCP problem, but it's how everyone else is doing it, so we-we're, we're gonna, we're gonna adapt.
- 3:43
We're gonna adapt. We're gonna improvise. Um, and we're gonna split up our API into lots of different product-based MCP servers." So you've probably seen this, like, uh, a company that publishes sixteen MCP servers potentially, and then users have to, uh, interact with the one that they want to use when they want to use it.
- 3:59
Um, there's much less context, but the user has to select, and most of the time there's kind of incomplete coverage. So, like,
- 4:07
uh, for instance, like, uh, one of our a- one of our product suites, we might have, like, six tools in our MCP server, but the total API maybe has, like, thirty endpoints.
- 4:16
Like, you've completely missed some coverage there. A-and this is not, like, fulfilling the goal of, like, how do we make every API a tool for agents? It's actually kind, kind of annoying.
- 4:27
Uh, so, so I think we did it all a little bit wrong. Um, well, in Cloudflare, we had sixteen servers very, very quickly. We were hovering around two and a half thousand endpoints.
- 4:37
I think we're actually at, like, two thousand six hundred API endpoints now. Um, but w-we, we basically couldn't split up all of these into all of our servers, and the users had to pick the ones that we wanted.
- 4:46
What we really needed was progressive discovery of tools. Who's heard of progressive discovery? Anyone heard? Yeah. Cool. And that brings us to the crux of the debates that everyone has on the online.
- 4:57
Um, and that is, like, how do we do progressive discovery? And, and, like, is MCP dead? Like, is MC- was MCP, like, a really bad idea? Um, uh, and I'm gonna say, like, I, I don't think it was.
- 5:07
MCP is a protocol. All of these can be exposed over MCP. We just shouldn't be dumping loads of tools into context. That's, like, the main thing. We shouldn't be dumping tools in context.
- 5:16
Um, and all capabilities, like, i-in the future, we might have prompts and resources more. Skills are basically resources. Um, and we just shouldn't be, like, loading all of those at once.
- 5:25
So there's, like, sort of three ways you can get around that problem. Uh, there's a CLI, which, uh, people really like. Uh, there's tool search, or there's a third one that we're gonna come to a little bit later.
- 5:36
Um, but, like, how does, how would a CLI work for agents? So this is a, a sandbox in the background, and if I use our, our CLI, and I do something like, uh, I just call Wrangler, we get a bunch of commands.
- 5:51
The agent can, like, read these commands, parse these commands, and be like, "Oh, I want to interact with the database. Let's, let's do wrangler d one, and maybe we wanna list."
- 6:01
List our databases, whatever. And then after some period of time, and some interactive process apparently, uh, we get, uh, we get, like, the databases I have on my account.
- 6:12
And, like, an agent can kind of do this, um, mostly. Uh, and it, and it can call dash dash help to get, like, uh, introspection on, like, which parameters it needs, and th-this, this mostly works, this mostly works.
- 6:25
Uh, it's used very popular by things like OpenCloude, and, like, people generally really like CLIs. But you need shell access. This is, like, the main thing. This is, I guess, the crux of this.
- 6:33
Like, you have to have shell access, and that's kind of annoying. So for things like Claude Code, they wanted a bit more of a structured way of doing things, so they have, uh, like, tool search.
- 6:41
They have a, a search tool which loads the tools that they need when they need them into context. So say I want to, like, create a worker.
- 6:50
Uh, what it would do is you, it would take the user, the user question, it would do some sort of keyword matching, and then it would add K equals, say, eight tools to context.
- 7:00
And then at some point, the LLM's gonna look at, oh, actually workers create, this is the one we need, and so we're gonna use that one. But the rest of them stay in context.
- 7:07
Maybe n- it's not eight, maybe it's six. They change, it changes, but, um, yeah. You end up with like two, two thousand one hundred tokens, and only five hundred of them are being used.
- 7:14
But, like, it works. It, it, it's, it works quite well. Um, you only load the tools that are relevant. Uh, and then this last thing is a blog post that, uh, Cloudflare published in the summer of, well, last summer.
- 7:27
And it's like, how can we, instead of doing, like, a, um, a static search tool, or instead of, like, enforcing an agent to need a CLI, how can we do something where we just let the agent write code, and we let the agent write code against our API?
- 7:42
And it turns out that TypeScript is actually, well, types are a very concise way of representing inputs and outputs, um, in, in a way that an agent can reason about.
- 7:52
So say you have all of these endpoints. You have, like, a getWorker scripts or a createAWorker or something like that. We generate these types, uh, and then we let the model, given these types, write some code against these types.
- 8:06
So here we're doing Code Mode List Workers. I hope you guys can see that. Uh, and we're gonna try and list some workers. So this might be, like, a user request to list workers.
- 8:13
The model generates this code, um, against a typed SDK that we generate from our API. You can generate them from OpenAPI specs. Uh, and then we can run that, and we can, like, list the workers that we have on our account.
- 8:26
And we could deploy a worker. That would be fun. Hello, world. And we could put it behind one of the hardest things to do at Cloudflare, which is so weird because it's such a powerful product, but we can add access, which is, like, our, our managed IDP.
- 8:39
And now this worker's secure behind access. Kinda cool. With, like, a access policy to only allow me into it and all of this other good stuff. Super, super easy.
- 8:47
And an agent can generate all of this code given our types. So this feels like a step in the right direction. Just let the model write code. We benefit from the model getting fa- better.
- 8:57
We benefit from, I don't know, or, like, our improving our OpenAPI spec. It's like that should be the source of truth.
- 9:06
But we had this, like, kind of weird thing where we thought this was awesome, and we were pretty stoked about it. Uh, but the clients didn't implement it.
- 9:14
And then w- and when I mean clients, I've gone into, like, MCP terms now. So the client is the agent. So we'll be referring to the agent as a client from now on.
- 9:22
Um, but it, so the clients didn't really implement it. And we're, like, a little bit confused about why this is the case. Like, this was sort of n- eight, nine months ago now, and it's a better way of interacting with, uh, with, with APIs.
- 9:36
Just let the model write code against the API, but they didn't implement it. And why not?
- 9:40
Uh, and that's because, like, running untrusted code is mega, mega scary. Like, i-if I had said to you a few years ago, "Oh, we're just gonna let a language model write some code that we're gonna gen- we're gonna execute for our users without looking at it, without reading it, without seeing what it does, that might have potentially,
- 9:58
like, secrets access." Ideally, it has some secrets access. You'd be like, "That's crazy. That's a CVE, right? Our C-- It's a CVE." Like, it's a vulnerability. That's a problem. [laughs]
- 10:07
Like, and now we're proposing you to do this. So it is quite scary. Well, lo-loads of things can go wrong. Uh, we could, it could read a file system, read some secrets that you don't want it to read.
- 10:17
It could exfiltrate those secrets into a network request, run infinite loops, consume all your resources, do, like, really scary stuff. Run a crypto miner, you know? That would be, that would be bad.
- 10:27
Um, and in the past, people have tried loads of things to let people run code-like solutions. So if anyone's ever written a DSL, um, some sort of, like, JSON spec about how to, uh, and to interpret that as code, that is basically this.
- 10:40
Uh, if you ever used one of those integration softwares where you have to do that, that is this. They just don't trust you to write code on their servers.
- 10:47
VMs also. People spinning up sandboxes to run code. Big sandboxes, big VMs. That is this. And also code review.
- 10:56
But it's kinda lucky 'cause we have a, a pretty cool primitive that solves this, and there will be other primitives that solve this. I just think this is the first, and so it's worth, like, uh, worth shouting about really.
- 11:07
Um, and this is, like, how do you run untrusted code in a way that's super safe for you and your infrastructure?
- 11:15
And it's kinda like this. So we can execute a worker from a string, and a worker is just a, like a little, is like an isolate, um, in V8.
- 11:24
There's many blogs about how all this works. I'm not gonna go into it super deeply. I'm just gonna show you what it can do. Uh, so for instance, we have this, like, um, this piece of code that was generated, and we're gonna run this piece of code that was generated, and this ran on the back end.
- 11:39
It didn't run in my browser. It ran in a dynamic worker that's fully isolated. And how, how, I guess how can I prove that to you? Um, if we do this one, we are trying to get some secrets here, process.env.
- 11:51
And if, if we print them, there are no secrets. And we also have this weird Cloudflare global. Ooh, interesting. Um,
- 12:00
if we turn, that was with node compat on. If we turn node compatibility off, we don't even have, we don't even have a process.env there, and it all errors out.
- 12:07
So- We can like influ- we have this like programmable sandbox. It's not quite a sandbox. It's like a very lightweight thing that you can r- put load code into it and then run it.
- 12:18
And I'll show some other options later. Like, it's not just us that has this, but we have one that we host for you and goes to like Cloudflare level scale.
- 12:24
If you wanna do billions of requests, knock yourself out.
- 12:28
And now, like here's one where, um, the agent's written some code that accesses like an external API. And if we run this one, it's like, "This worker is not permitted to access the internet via global functions."
- 12:39
Well, maybe we want it to access the internet, and now we can give it access. So it's a programmable sandbox with g- with programmable guardrails, and all we're doing here is like flicking a Boolean i- in the server.
- 12:50
That's, that's like all that's happening here. But you can provide like a more in-depth function to be like, "Only access things to these domains," and that's what we do on the Cloudflare MCP.
- 13:01
Um, if we go next. Oh, speaking of the Cloudflare MCP, this is where I really hope the demo works. [laughs] Um, so this is an MCP client, uh, in this slide.
- 13:13
And if we ask it a question, we're gonna get some- we're gonna get like a auth screen pop up.
- 13:21
And then hopefully all this works. Oh, insane.
- 13:30
So now we have like complete ... Well, we have read-only access to the whole of the Cloudflare API. All of my Cloudflare infrastructure, I have read-only access to. Um,
- 13:39
which is pretty cool. Uh, these are account IDs. Don't worry about them. They're not secrets in, uh, in Cloudflare world.
- 13:46
Uh, cool. So, so we just listed a worker, but you could do many more things here, like you can deploy workers from your command line, you can do what we did earlier and add access to something.
- 13:56
You could introspect your DNS. You could send emails soon. Um, you can do loads and loads of other stuff, like it's very, very cool, uh, what you can do here.
- 14:05
But you have access to the whole of the Cloudflare API, all 2,000 and something endpoints.
- 14:13
And I guess, like, this kind of brings up the question like, uh, like where, where are we going with letting agents access external tools? Like what does this look like?
- 14:22
Like you have people installing CLIs for everything and running it on their own, running it on their own machine. Maybe running it on a VM. That's kind of cool.
- 14:29
Um, you have us being like, "Oh, you could just run untrusted code in this like other, in this other place that's like really isolated." You have people doing tool search.
- 14:40
You have people rendering UI as JSON. I don't know. Um,
- 14:48
a- and I guess like my, my main thought is that, like we're gonna have so many isolated environments on the, on the web, and there's gonna be loads of infrastructure primitives that allow you to run this type of untrusted code on the web.
- 15:00
Because code is actually a very compact, compact plan. Instead of doing tool calls, you can have one tool called code, where the model generates the code of your choice, and then you run it.
- 15:12
And that code has so many more degrees of freedom than like an individual tool call. So it makes sense to me that as the models get smarter, this is what, this is what we will do.
- 15:20
And people will adapt their infrastructure primitives to do this, so there'll be so many more of this. And you see this starting with like Pydantic Monty, uh, Deno also, and like, uh, we also have it with Workerdee, uh, the dynamic workers that I showed earlier.
- 15:32
Like people, more people are gonna build these primitives because they're gonna become more and more useful. So like w- just like a little explanation. Um, this is Workerdee, uh, r- like spawning a dynamic worker in this sandbox and running some code to get a fib sequence.
- 15:47
You can do the same thing with Deno, with Deno run, with some
- 15:52
ch- questionable checking. I have no idea what that does. [laughs] And then you can also kinda do the same thing with Pydantic, uh, Monty, their new, their new, uh, code interpreter for running untrusted Python.
- 16:03
Because it's Python, we have to download Python.
- 16:06
Sucks. [laughs] This, this might never work. I actually have no idea.
- 16:12
Oh, there we go. Great. Uh, so maybe you can see like where we're trying to go with this. That there was, there was a previous time where no one would ever run untrusted code.
- 16:21
That was a CDE, like you would just immediately like you have to like stop allowing that. Uh, and then it seems like LLMs is actually really good for them to run unch- uh, for them to write code that you can run.
- 16:33
And so now we're building the primitives to actually enable us to do that, and it feels like we missed out on this whole part of the, the, the tech scene that like we've never tried before.
- 16:41
Like in the 1950s, when you wanted to run something on a computer in your local town, you printed out some punch cards, and you stamped them, and you gave them to the guy, and that was kinda like running untrusted code, right?
- 16:51
Like that was kind of it. And then when we went to the cloud, we got away from that, and now I think we're gonna go much more back to that, where L- your users can write code 'cause your users are AI, and AI is very good at writing code.
- 17:05
And that is how they're gonna interact with your platform, whether through MCP, whether even through like Bash and CLI, like I don't mind. Um, I think they're just gonna write code against your services.
- 17:14
And your services have to be ready for this. Like your APIs have to be ready to take a beating because they have to have good rate limiting. 'Cause I can run this in a for loop on multiple sandboxes at once and just hammer your API.
- 17:26
Like you have to have some way of protecting against that. Like this is the new world that we're, that we're now gonna be living in.
- 17:34
And that's like on the server side, on the, on the services side. Now, what's gonna happen on the client side? So I think that's almost even more interesting because that's the user-facing side of things.
- 17:45
Like the user's not gonna see the server. The user doesn't care. The user just, "Why, why is my agent not getting my Gmail emails?" Or, "Why has it deleted my whole inbox box?"
- 17:53
They're not gonna like... They're not gonna see that. But on the client side, like there's a lot of innovation that's gonna happen here, and I think we've stalled a little bit recently because actually building an MCP client in particular got really, really hard.
- 18:06
Like to, to, to actually build a client that was performative, that worked, you needed to manage stateful connections. You needed to manage resumability between those connections. Um, there's, uh- There's plenty of other reasons why building an MCP client was hard, but, like, it was a pain, an absolute pain.
- 18:22
And so people had, like, the most stripped-down clients they possibly could. They mostly offloaded to the MCP SDKs, which are quite bare bones. And n-no one was building these, like, more, um, unique UI experiences on top of that.
- 18:36
And I think that, that is gonna come, like, very, very soon. So the, the most, the most obvious thing is we're gonna have programmatic tool calling in the clients.
- 18:43
The, the previous slide we just did showing those, um, showing those sandboxes with Workerdee, Deno, and, uh, Pynantic, that is, like, just running untrusted code in a client. People are gonna do that.
- 18:52
If your client is remote, you're gonna do it like that. If your client is locally, well, just YOLO it, whatever. Just eval it, you know? And it's gonna be fine.
- 18:59
But more people are gonna do this programmatic tool calling. It's gonna happen. And because you're generating code, people are gonna save this code, and they're gonna save it in these, like, mini scripts.
- 19:10
And users might be able to decide, "Oh, this action that I just did, that the LLM generated for me, I wanna keep that for later." And then it will be a much faster.
- 19:19
So you can see things for things like, um, cron jobs. A user might set up some web scraping job, like, without any knowledge of how web scraping works,
- 19:28
and then it generates a script, and that script is ran, like, every day, every two days. And whenever it breaks, because web scraping's, like, pretty brittle, the agent will fix it and resave the script.
- 19:38
Like, this stuff is ha- is gonna happen, and I think, like, these saved mini scripts, they only work when you embrace, like, programmatic tool calling, but they really do work.
- 19:46
And then, and then the, the last thing, um, is we're probably gonna have many, many more clients. Because they've been so hard to make up until now, and it is gonna get easier, uh, there's actually only ...
- 19:56
There's not, there's not a huge amount of really well-used, um, MCP clients.
- 20:02
That's gonna change. And with that change, like, more people are gonna be able to make them. More people are gonna deploy agents to the cloud that end up being an MCP client.
- 20:11
And I think more people are gonna try and do this, like, stateless agent loop thing. Like, it, it was fine to have sandboxes for every agent, like, running Claude code locally if, if there were a, a million agents in this world.
- 20:24
I think when there are, like, 100 agents for each person ... Oh, hello. Let's not do that. Uh, that's gonna be, that's gonna start getting really tough, and you're gonna have to, like, embrace a cloud-native way of doing things, which means that, um, state has to be something you can turn on or off.
- 20:40
And this is, I think ... We're, we're nearing the end, but this is my last thing. It's like, um, I work a lot on MCP servers and on the SDK, and this is where I think that bit's going.
- 20:51
I think we're going to see MCP as a middleware, um, in an m- when you build an MCP server. When you build an API, when you build an API service, it will be a flag that you can flag on in your favorite framework.
- 21:02
The, the SDK itself is getting super, super lightweight, and I think by the end of this year will be, like, natively in every single, at least TypeScript, big, uh, full stack framework.
- 21:14
It will just be there natively. Because it will be so small, it will literally just express the protocol in itself, and it will be silly for them not to have it.
- 21:21
They'll just have a native integration, and they'll be able to do MCP is true on all of your APIs. And because all of the clients will be doing programmatic tool calling, you can express, like, your thousand APIs from one Next.js app and just do MCP equals true and expose it over, and them as tools over MCP as
- 21:38
well. And I think that, I think that will happen. Um, I've been thinking that's gonna happen for a while, but I think we're pretty, really close there. And the last blocker is, like, fixing the SDK really [laughs] so that it's capable of doing that.
- 21:50
It's capable of fitting in every single front e- every single bundle, really. And that's the plan. Um,
- 21:58
you can find out more at the ... We have a Code Mode blog post that came out pretty recently. It's how we gave agents an entire API in 1,000 tokens.
- 22:06
If you have a big API, you should probably do this. A-a- and you observability providers, please just do this, 'cause it's really, really good for people to access your data.
- 22:14
Um, and thank you. Um, try out npm i agents. Thank you very much. [audience applauding] [upbeat music]