Revolution in MCP: How Code Changes the Game with AI Agents
Anthropic just dropped a bombshell announcement about a new approach to working with Model Context Protocol (MCP). And you know what? This really changes everything.
The Problem We've All Been Ignoring
Remember when MCP launched in November 2024 and everyone was like "wow, now we can connect an agent to a thousand tools"? Well, here's the catch. When you actually have a thousand tools, the context window turns into a junkyard of descriptions, and every intermediate result devours tokens like there's no tomorrow.
Imagine: you ask an agent to "download my meeting transcript from Google Drive and attach it to the Salesforce lead." Seems like a simple task, right? Now look at what's happening under the hood:
- The agent loads ALL tool descriptions (hello, 150k tokens)
- Downloads the transcript (another 50k tokens goes into context)
- Copies the same transcript into the Salesforce call (again 50k tokens)
Total: 250k tokens for a task that essentially requires two API calls. It's like driving a tank to buy bread.
The Solution: Let the Agent Write Code
And here's where Anthropic says: "What if instead of direct tool calls we let the agent write code?"
Brilliant, right! Instead of loading all tool definitions into context, we create a file structure:
servers/
├── google-drive/
│ ├── getDocument.ts
│ └── index.ts
├── salesforce/
│ ├── updateRecord.ts
│ └── index.ts
└── ...
Now the agent can:
- Explore the filesystem and load only the tools it needs
- Process data right in the execution environment
- Use loops, conditionals, and the full power of programming
The same transcript task now looks like this:
import * as gdrive from './servers/google-drive';
import * as salesforce from './servers/salesforce';
const transcript = (await gdrive.getDocument({ documentId: 'abc123' })).content;
await salesforce.updateRecord({
objectType: 'SalesMeeting',
recordId: '00Q5f000001abcXYZ',
data: { Notes: transcript }
});
Result: 2,000 tokens instead of 250,000. That's 98.7% savings!
Why This Is Awesome
1. Progressive Disclosure
The agent loads only the tools it needs right now. Like in an IDE - you don't need to keep all of npm in your head, just knowing it exists is enough.
2. In-Place Data Filtering
Working with a 10,000-row spreadsheet? No need to drag everything into context:
const allRows = await gdrive.getSheet({ sheetId: 'abc123' });
const pendingOrders = allRows.filter(row => row["Status"] === 'pending');
console.log(`Found ${pendingOrders.length} pending orders`);
console.log(pendingOrders.slice(0, 5)); // Show only first 5
3. Proper Control Flow
Need to wait for a deployment notification? Write a regular loop:
let found = false;
while (!found) {
const messages = await slack.getChannelHistory({ channel: 'C123456' });
found = messages.some(m => m.text.includes('deployment complete'));
if (!found) await new Promise(r => setTimeout(r, 5000));
}
console.log('Deployment complete!');
4. Privacy Out of the Box
Intermediate data stays in the execution environment. The model only sees what you explicitly log. You can even automatically tokenize PII - the agent will see [EMAIL_1] instead of real addresses.
5. Code Reusability
The agent can save its functions as "skills":
// ./skills/save-sheet-as-csv.ts
export async function saveSheetAsCsv(sheetId: string) {
const data = await gdrive.getSheet({ sheetId });
const csv = data.map(row => row.join(',')).join('\n');
await fs.writeFile(`./workspace/sheet-${sheetId}.csv`, csv);
return `./workspace/sheet-${sheetId}.csv`;
}
Where to Get Ready-Made MCP Servers?
Okay, theory is cool, but where's the practice? FastMCP.me has already gathered a collection of ready-to-use MCP servers for various tasks:
- Integrations with popular services (Google Drive, Slack, Notion, GitHub)
- Tools for working with data and APIs
- Utilities for automating routine tasks
- Specialized servers for development
You'll also find code examples, documentation, and best practices for configuration. The community is actively building new servers, so the list keeps growing.
What's Next?
Cloudflare already calls this approach "Code Mode" and is actively implementing it. The MCP community is exploding - thousands of servers, SDKs for all languages, and this is just the beginning.
Yes, there are nuances with security (you need a proper sandbox for executing agent code) and infrastructure. But the efficiency gains are worth it.
Conclusion
MCP + Code Execution = this isn't just token optimization. It's a fundamental shift in how we think about AI agents. Instead of "dumb" tool calls, we get full-fledged programming with loops, conditionals, and code reuse.
Agents are becoming real developers who can:
- Explore available APIs through the filesystem
- Write and debug code
- Create reusable functions
- Efficiently work with large data
The future is here, and it's writing code.
P.S. If you haven't tried MCP yet - now's the time to start. Head over to FastMCP.me, pick the servers you need, and experiment. The revolution won't wait!