Mastering MCP to A2A: Everything a developer needs to know

Mastering MCP to A2A: Everything a developer needs to know

by

in
Table of Contents

We have all seen the frenzy of Devin AI—teams racing to spin up models, orchestrate data flows, and automate every possible touchpoint. But beyond the hype, two architectural patterns quietly power next-generation pipelines: Model Context Protocol (MCP) and Agent-to-Agent (A2A).

Below is the roadmap for our deep dive into MCP (Model Context Protocol) and A2A (Agent-to-Agent):

  • Why We Need MCP & What Problem It Solves: MCP standardizes how AI assistants connect to data sources and tools, eliminating brittle point-to-point integrations and enabling seamless context sharing across systems.

  • What Is A2A (Agent-to-Agent): A2A defines a vendor-agnostic, secure messaging protocol for agents to delegate tasks and collaborate, reusing standards like HTTP, JSON-RPC.

  • Key Differences Between MCP & A2A: While MCP focuses on connecting LLMs to external tools, A2A enables peer-to-peer agent orchestration; we’ll compare their communication patterns, security models, and use cases

  • Hands-On Walkthrough: Connecting to a Google Maps MCP Server Using Smithery: Step-by-step with the mcp-google-map server—installing via npx @smithery/cliInspecting available Google Maps tools, defining a mapRequest schema, publishing events, and consuming responses.

Why did MCP even come into the picture?

If you’ve ever tried building an app from scratch—no starter kits, no boilerplate—you know it’s a rare beast these days, with countless templates and low-code tools doing the heavy lifting for you. Even for a simple feature that involves only a handful of actions, you end up defining dozens of functions, wiring up API calls, and wrestling with sprawling context just to keep everything in sync. When an LLM is responsible for scaffolding that code, you run into even more headaches: prompt length limits, out-of-date API knowledge, and unpredictable behavior.

LLMs have been in the mainstream long enough that it’s time to agree on a clear, uniform architecture. Enter MCP: Instead of juggling thousands of variable names across multiple data structures, you define a single protocol for events and context. No more patching together mismatched structs—just a consistent, scalable way to connect your model to the tools and services you need.

Outdated Context

  • Stale API Definitions
    Over time, APIs evolve—endpoints change, parameters get deprecated, and response schemas shift. Without a centralized contract, your app’s code can keep calling methods that no longer exist or behave differently.

  • Fragmented Knowledge Sources
    When different modules or team members maintain their own partial docs or code snippets, it’s easy for some parts of the system to reference legacy behavior while others assume the latest version.

  • Hard-to-Track Dependencies
    Without a single source of truth, you’ll spend hours hunting down which version of an API a given function was written against—worse if multiple microservices rely on slightly different variants.

Context Limit by LLMs

  • Token Budget Constraints
    Large language models typically cap out around 8k–32k tokens. If your prompt needs to load dozens of function signatures, data models, and example payloads, you risk hitting that limit—and getting incomplete or truncated responses.

  • Dynamic Context Switching
    As your dialog flows between user interactions, error messages, and tooling calls, you must continuously stitch new context in while pruning older details. This overhead can lead to inconsistent behavior when the LLM “forgets” earlier conversation state.

  • Performance Degradation
    Pushing near the token ceiling may slow inference and increase latency. Every extra line of JSON schema or API spec you include in the prompt reduces headroom for meaningful instructions or real-time data.

Too Many APIs—What Is Relevant?

  • Discovery Overhead
    Modern systems expose dozens of endpoints (CRUD, batch jobs, analytics, webhooks, etc.). Manually curating which ones the LLM should know about becomes a maintenance burden.

  • Noise vs. Signal
    Feeding every available API into your prompt can drown the model in irrelevant options, causing it to suggest calls that aren’t needed or to pick the wrong endpoint for a given task.

  • Version & Permission Mismatch
    Even if you filter by endpoint name, differences in authentication schemes, rate limits, and version tags can lead to runtime errors if the model isn’t aware of the specific requirements for each API.

Mcp

What problems does MCP solve?

Clients = Your Frontend/SDKs

Examples: Cursor app, Windsurf CLI, Claude Desktop

Responsibilities:

  • Call mcp.listTools() on the MCP server

  • Pass those tool definitions into the LLM prompt (“Here’s how you call Slack.postMessage”)

  • When the model returns a tool name + params, invoke mcp.callTool(toolName, params) and surface the JSON response back to your app

Servers = Protocol Adapters/Proxies

  • Expose a JSON-RPC API (listTools, callTool) that any client can consume

  • Describe each tool with a simple JSON schema + human-readable docs so the LLM knows method names, param types, and auth rules

  • Translate between the MCP RPC calls and the provider’s native REST/gRPC endpoints, handling auth tokens, retries, and error mappings

Service Providers = Your Existing APIs

  • Slack, GitHub, Notion, custom microservices, etc.

  • No code changes needed—the MCP server wraps its APIs behind the unified protocol

  • Providers keep their own rate limits, versioning, and data models; MCP handles the integration glue

credits:builder.io

credits: builder.io

What is A2A?

A2A (Agent-to-Agent) is an open standard introduced by Google DeepMind for multi-agent communication in AI systems. It provides a lightweight, JSON-based protocol for agents to announce their “Agent Cards” (metadata describing their capabilities), subscribe to peer events, and invoke actions on one another without requiring custom glue code.

Core Components

  • Agent Card: A public metadata file listing an agent’s supported tasks, input/output schemas, and authentication requirements.

  • Discovery: Agents broadcast or query registries to find peers with compatible capabilities

  • Messaging: Uses JSON-RPC or HTTP transport with optional streaming (e.g., Server-Sent Events) to exchange requests and responses

A2A vs MCP

MCP (Model Context Protocol):
Lets a single AI model talk to external tools in a consistent way. It handles:

  1. Discovering which tools are available

  2. Invoking them via a standard JSON-RPC calls

  3. Passing in any needed data (schemas, context) and parsing their replies

A2A (Agent-to-Agent):
Lets multiple AI “agents” talk directly to each other, peer-to-peer. It handles:

  1. Announcing each agent’s capabilities

  2. Finding and authenticating a fellow agent to do a task

  3. Messaging back and forth in a secure, structured format

Protocol Mechanics

Feature MCP A2A
Transport JSON-RPC over HTTP(S) JSON-RPC over HTTP(S), optional SSE streaming
Discovery listTools() RPC call “Agent Cards” registry or peer broadcast
Invocation callTool(toolName, params) invokeAgent(method, params)
Definition Format JSON Schemas + human-readable docs Agent Card metadata: capabilities, schemas, endpoints
Security Server-managed auth (API keys, OAuth) Peer-to-peer auth (tokens, mutual TLS), ACLs
State Sharing Context payloads are passed in a prompt Streaming updates, push notifications
Typical Topology Model → MCP Server → Service Provider Agent A ↔ Agent B ↔ Agent C (mesh or registry)

Simple setup of MCP with Google Maps MCP Server Using Smithery

Prerequisites

  • Node.js & npm: Ensure you have Node.js ≥14 and npm installed.

  • Google Maps API Key: Obtain a valid key from Google Cloud Console with Geocoding and Places APIs enabled.

    Visit the Smithery registry entry for Google Maps:
    https://smithery.ai/server/@smithery-ai/google-maps

    Auto-Configure in Claude Desktop

    1. In Claude Desktop, go to Settings → MCP Servers

    2. Click Add Server and select Remote

    3. Enter the Server ID:

      bash
      @smithery-ai/google-maps

      Claude will auto-populate the RPC endpoint and tool list for you

    4. From your terminal, run:

      bash
      npx -y @smithery/cli@latest install @smithery-ai/google-maps \
        --client claude \
        --profile YOUR_GOOGLE_MAPS_API_KEY
      • --client claude tells Smithery to configure the server for Claude Desktop.

      • --profile injects your GOOGLE_MAPS_API_KEY into the local config

    5. Once the CLI install completes, you’ll see an interactive prompt like this in your terminal:

    bash
    
    ℹ To finish setup, update Claude Desktop with your server details.  
          • Server ID: @smithery-ai/google-maps  
          • RPC URL: https://…/rpc  
        Installing remote server. Please ensure you trust the server author, especially when sharing sensitive data.
        For information on Smithery's data policy, please visit: https://smithery.ai/docs/data-policy
        @smithery-ai/google-maps successfully installed for claude
        ? Would you like to restart the claude app to apply changes?
    • Claude Desktop will launch (or bring its Settings window to the front) and pre-fill the Server ID, RPC URL, and your API key.

      • Review & Save: Confirm the values match, then click Save in the MCP Servers pane.

      • Verify: You should now see Google Maps listed under your MCP servers, with all its methods available for use.

    After the prompt, you should see the server executingthe mcp functions

    When you run it, the output will appear in a standardized format containing all the required data.

    Conclusion

    By integrating MCP (Model Context Protocol) into your development workflow, you create a consistent, JSON-RPC–based interface that lets any LLM or client discover and call tools without manual prompt engineering or brittle glue code. Combined with A2A (Agent-to-Agent), you gain not only vertical power—models invoking external services seamlessly—but also horizontal agility—agents coordinating complex, multi-step workflows among themselves.

FAQ

Q1: What’s the easiest way to add a new service to MCP?

A: Write or configure an MCP server adapter for that service. Define its tool list in a JSON schema (method names, input/output types, auth), expose listTools and callTool over JSON-RPC, and point your client at its RPC URL. No client changes required.

Q2: How do I handle authentication and secrets in MCP?

A: Store API keys or OAuth tokens on the MCP server side (e.g., via environment variables or a secrets vault). The server injects them when calling the provider’s API, so clients only invoke callTool without ever seeing raw credentials.

Q3: Can I mix MCP and A2A in the same application?

A: Absolutely. Use MCP for “vertical” calls from your LLM to external tools, and A2A for “horizontal” agent hand-offs. For example, one agent may use MCP to enrich data from Slack, then delegate follow-up tasks to another agent via A2A.

Q4: How do I version MCP servers or tools without breaking clients?

A: Maintain backward-compatible JSON schemas. When you need breaking changes, publish a new tool name or a new server endpoint. Clients can list both old and new versions via listTools and choose the version they support.

Author

  • Tvisha Raji

    Driving product growth at Keploy by aligning tech teams and boosting feature adoption. With experience in GRC, product management, and data, I’m passionate about innovation, people, and meaningful conversations over coffee.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *