Building with MCP and the Claude API

By Anthropic

Share:

Key Concepts

  • Model Context Protocol (MCP): A universal standard protocol designed to provide external context and enable models like Claude to interact with the outside world, taking actions on behalf of users.
  • Tool Use: The ability of large language models (LLMs) to leverage external tools and data sources to perform tasks beyond their inherent knowledge cutoff.
  • Open Standards: A philosophy promoting widespread adoption and ecosystem building by making specifications publicly available and collaboratively developed.
  • Remote MCP Support: An advancement allowing MCP servers to be hosted externally, simplifying setup and access for end-users and providers.
  • MCP Registry: A central directory of authorized MCP servers, making it easier for users to discover and integrate external functionalities.
  • Context 7: An MCP server example that pulls and keeps documentation (e.g., Next.js, API docs) up-to-date, addressing LLM knowledge cutoffs.
  • llms.txt format: A standard for making raw text documentation accessible to LLMs.
  • Playwright MCP Server: An MCP server that enables Claude to interact with web browsers as a user, allowing it to "see" and analyze webpages for tasks like UI/UX feedback.
  • MCP Connector Feature (Claude API): A native API feature that simplifies integrating remote MCPs by handling the calling loop and result feeding, reducing developer code.
  • MCP Servers as Prompts: The concept that the design and descriptions of MCP tools significantly influence how the model interacts with them, akin to prompt engineering.
  • Context Management: The challenge of efficiently providing relevant information to LLMs without overwhelming or confusing them, especially with multiple tools.
  • Knowledge Graph: An MCP server example designed to give Claude the ability to form connections between memories, leading to emergent "investigative journalist" behavior.

Introduction to the Model Context Protocol (MCP)

The Model Context Protocol (MCP) is presented as a fundamental mechanism for providing external context to large language models (LLMs) like Claude. While LLMs inherently understand conversational history, MCP extends their capabilities by allowing them to access information and take actions outside their immediate "box." This includes interacting with the internet, booking flights via travel agencies, or connecting to various applications and data sources. Alex describes MCP as a "universal connector" between applications and the model, enabling Claude to tie into "everything else that it might need access to."

Rationale Behind Building and Open Sourcing MCP

Why it was Built: Anthropic observed a recurring problem: the need to re-implement similar tool-use capabilities across different contexts (e.g., a coding editor assistant, Claude.ai, other services). To address this inefficiency, MCP was developed as a "single unified protocol" to implement functionalities once and deploy them everywhere, following a "build it once and configure everywhere" philosophy. This ensures consistent functionality, such as web search, across various Claude-powered applications.

Why it was Open Sourced: Anthropic chose to open source MCP to leverage the value of open standards, fostering a wide network of engineers, companies, and individuals to build an ecosystem around it. This approach prevents a "nightmare" scenario where companies like Asana would need to implement separate connectors for every LLM (Claude, OpenAI, Grok, Gemini). The belief was that "models having access to external context is kind of good for everyone," akin to a "rising tide floats all boats" situation. MCP, initially an internal protocol, was open-sourced because Anthropic found it valuable for standardizing model interactions, hoping the wider world would too. It experienced "stratospheric growth," becoming "the fastest-growing open source protocol, in history," demonstrating a massive unmet need. This success led Anthropic to move MCP into a proper open-source foundation, collaborating with other providers to ensure its long-term durability as an industry-defining standard.

Current State and Evolution of MCP

Michael highlighted a significant "aha moment" with the release of remote MCP support. Initially, users had to run everything locally, making setup "clunky." Remote hosting drastically reduced the setup process, allowing end-users to get started quickly.

A central registry of MCP servers has been released, hosted at the Model Context Protocol organization site. This registry, adhering to open-source ethos, also provides a standard for other organizations to extend it. This has led to "massive growth" with companies like GitHub and Asana building and deploying their own MCP endpoints. This maturation means users can now directly access official MCP sites (e.g., mcp.github.com) to extend Claude's capabilities, rather than relying on "random developer[s]" and trusting their local installations.

Notable MCP Examples and Applications

  1. Context 7: Michael highlighted Context 7 as a "really, really interesting" MCP. It addresses a major limitation of LLMs: their knowledge cutoff (usually delayed by months), which makes working with the latest software packages difficult. Context 7 pulls and keeps documentation from websites like Next.js or API sites up-to-date. Once configured, Claude gains access to the latest information, leveraging the llms.txt format, which has seen "a lot of adoption throughout the entire tech industry."
  2. Playwright MCP Server: John, as a software developer, found Playwright particularly useful. This Microsoft project allows Claude to "interact with browsers as though it was a user clicking around." While Claude can read CSS and HTML, it cannot "look at your webpage." With Playwright, Claude can visually inspect a webpage, offering advice on aesthetics or fixing alignment issues. This enables "self-improvement loops" where Claude Code can modify HTML/CSS, reload the page, and then re-evaluate the visual outcome, understanding the "effect that I didn't intend" and rolling back changes.

Using MCP with the Claude API: Developer Tips

Native MCP Connector Feature: The canonical way to use MCP is via the MCP SDK, setting up custom loops and handling connections. However, Anthropic recently released a native MCP connector feature directly into the API. This allows developers to simply specify remote MCP locations (e.g., mcp.github.com) and authorization information. The API then handles the "calling loop" of executing tools and feeding results back to the model, significantly reducing developer code. Developers can send a single API call like "give me my latest pull requests," and the API manages the underlying MCP interactions.

Tips for Developers:

  1. MCP Servers and Tools are Prompts: John emphasizes that MCP servers and tools are "at its core prompts." Just as with direct LLM prompts, "careful and precise" language is crucial when defining tool names, descriptions, and parameter names. Providing examples within descriptions or specifying the underlying model (e.g., "This tool calls the XXX diffusion model, version Y and should be prompted in this style for best results") can drastically improve Claude's interaction and output quality. For instance, a "Generate Image" tool with a detailed description about diffusion models will lead Claude to generate a "much more detailed diffusion model prompt" for better results, rather than a simple "cute puppy" request.
  2. Context Management and Tool Design: Michael warns against the "big anti-pattern" of "stuffing their MCP servers or their API requests with just tons of tools or tons of MCP servers." This not only gets expensive (generating tokens) but also "confuses the model."
    • Avoid Conflicting Tools: Connecting multiple task management MCPs (e.g., Linear and Asana) with similarly named tools (e.g., "get project status") can confuse Claude.
    • Be Deterministic: Developers should be "very, very careful and deterministic about which tools you add," ensuring their ergonomics make sense.
    • Relevance: Only include information relevant to the current user prompt, avoiding older, less pertinent conversational parts.
    • Tool Count: John adds that while there isn't a strict absolute number, each server and its function definitions consume context window tokens. Fewer, more relevant tools generally lead to better performance.
    • Abstraction in Tool Design: Unlike traditional API development, where one might have get projects, get posts, get users, an MCP server might benefit from a single, more abstract get info tool. Claude's LLM capabilities allow it to interpret the description and fill out necessary information, leading to a "much smaller set of tools" that "play nicer with other MCP servers" and are called more efficiently. This highlights that MCP design is about "higher level intent and actions than the specific technical detail."

Personal Use Cases and Emergent Properties

Internal Information Highway (Michael): Michael uses MCP to navigate Anthropic's "information highway" (Slack, docs, codebase). He connects MCP servers to these locations and asks Claude to "find information from the last week and generate a status update using the same exact format" based on past examples. He jokingly admits his Slack status updates are "all Claude-generated."

Home Automation (John): John has MCP servers running on his home network to control devices. He can ask Claude, "Hey, did I leave my door unlocked this morning?" and Claude can respond, "Yeah, your door is currently unlocked, would you like me to lock it for you?" This provides a "sneak peek into what the future world might look like."

Knowledge Graph and Emergent Behavior: John and colleagues built a knowledge graph MCP server with two simple tools: create memory and connect memory to other memory. When hooked to Claude, it exhibited "investigative journalist mode." For example, if a user says, "I play piano," and then "I like to play Rachmaninoff," Claude would internally "scribble down" observations like "User has sophisticated classical music taste" and "skilled in instruments," forming connections. This demonstrates "emergent properties" where connecting different MCP servers (e.g., Gmail with home automation) can lead Claude to solve problems in novel, unexpected ways.

MCP vs. Traditional APIs: A key difference is that MCP is less reliant on rigid contracts. If an MCP server for Gmail is updated from 15 tools to 2 tools with better descriptions, there's no need to "roll out a new version of my API" or deal with "breaking changes." The intent remains for Claude to interact with Gmail, allowing for flexible, intent-driven evolution.

The Future of MCP

Michael finds it "interesting to see the hype around MCP" for a protocol, as ideally, if successful, "we should never know that MCP is happening under the hood." It should be ubiquitous, "just making everything glued together." He sees "companies big and small come to the table" to proliferate it, aiming for it to be "everywhere the same way that, I don't know, our internet is."

John is excited for the future where developers, having built MCP servers, will start "evaluating how they work and making them better." He envisions MCP becoming a metric for vendor evaluation. For example, an engineer needing log analytics would find it "really valuable" if they could "just hook in your log analytics MCP server into my Claude and say, 'Hey, my site is down, what's going on?'" A well-designed MCP server that gives Claude the necessary tools to interact with services and find answers would be a "huge selling point." The future will see competition on "We have the best MCP server. This is gonna make your life so much easier, you should use us, because we interact with Claude in this way."


Conclusion

The Model Context Protocol (MCP) is a pivotal innovation enabling LLMs like Claude to transcend their inherent knowledge boundaries and interact dynamically with the external world. By standardizing tool integration and fostering an open-source ecosystem, Anthropic has addressed the challenge of re-implementing functionalities across diverse applications. The evolution of MCP, including remote support and a central registry, has significantly simplified its adoption. Real-world examples like Context 7 for up-to-date documentation and Playwright for browser interaction demonstrate its versatility. Developers are encouraged to treat MCP servers as prompts, meticulously designing tool descriptions and managing context to optimize model performance. The emergent properties observed in personal use cases, from automated status updates to home control and knowledge graphs, highlight MCP's potential to unlock novel, intelligent interactions. Looking ahead, MCP is poised to become an invisible, ubiquitous standard, with its quality serving as a key differentiator for vendors, driving a future where LLMs seamlessly integrate and act within our digital and physical environments.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video