</>{ }01AIconstasyncTS

Model Context Protocol (MCP)

20 June, 2025

Md. Rafidul Islam

Model Context Protocol (MCP)

Model Context Protocol (MCP) β€” A Beginner-Friendly Guide

The Model Context Protocol (MCP) is an open-source standard developed by Anthropic that enables Large Language Models (LLMs) like Claude, ChatGPT, Gemini, and others to communicate with external tools, data sources, and services. You can think of MCP as the 'USB-C of AI agents' β€” a universal connector between models and the world.

πŸ“˜ What is MCP?

MCP defines a protocol for managing how LLMs can dynamically discover, call, and interact with external capabilities β€” such as file systems, APIs, or database queries β€” using a standard structure based on JSON-RPC 2.0.

πŸ›οΈ Architecture Overview

  • Host: The LLM agent or main app (e.g. Claude app).
  • Client: The middleware that manages server discovery and communication.
  • Server: Exposes tools, resources, and prompts to the host. This can be a local server, CLI, or remote API.

βš™οΈ Core Concepts

  • Tools: Functions LLMs can call (e.g., `search(query)`).
  • Resources: Context data sent into the model (e.g., file content).
  • Prompts: Reusable structured prompt templates.

πŸ“¦ Example Tool Definition

// Example server tool definition (TypeScript)

{
  "tools": [
    {
      "name": "searchDocs",
      "description": "Searches internal documentation",
      "parameters": {
        "type": "object",
        "properties": {
          "query": {
            "type": "string",
            "description": "The search query"
          }
        },
        "required": ["query"]
      }
    }
  ]
}

πŸ” Typical Interaction Flow

1. Host β†’ Client: Request tool/resource list
2. Client β†’ Server: Discover available tools
3. Host β†’ Client β†’ Server: Call 'searchDocs' with input
4. Server β†’ Response with result
5. Client β†’ Host: Show response to model

πŸ› οΈ Real-World Use Cases

  • AI agents querying live databases via MCP servers.
  • File management tools letting LLMs read/write disk data.
  • Developers creating plug-and-play MCP servers to extend LLM capabilities.

πŸ” Security Considerations

  • Prompt injection and malicious tool calls are risks.
  • Hosts should prompt users for permission before calling dangerous tools.
  • MCP registries and sandboxes can limit what servers are trusted.

πŸ“š Supported SDKs

  • Official SDKs available in TypeScript, Python, Rust, Java, Ruby, Go, and C#
  • Start your own MCP server using npm create mcp-server

🎯 Why MCP Matters

Before MCP, every LLM tool integration required custom code. With MCP, any AI system can plug into any tool or data source that speaks the protocol β€” just like how USB simplified hardware connections.

It’s a foundational shift toward standardization in AI ecosystems.

πŸŽ“ Conclusion

MCP is the universal language that helps LLMs extend their intelligence with real-world tools and context. Whether you're building agents, plugins, or AI copilots, understanding MCP will be key to the next generation of powerful, modular AI.

Want a working code example or demo project using MCP? Just let me know, and I’ll create one for you!

Get in Touch
Copyright Β© 2025 My Portfolio. All rights reserved.