๐Ÿง  Model Context Protocol (MCP)

๐Ÿง  Model Context Protocol (MCP)

Demo of implementation of MCP using Langchain MCP Adapters and Ollama

Ginga1402

Research & Data
Visit Server

README

๐Ÿง  Model Context Protocol (MCP)

An open-source standard to seamlessly connect Large Language Models (LLMs) with the external world โ€” databases, APIs, services, and more.


๐ŸŒ What is MCP?

Model Context Protocol (MCP) is a new open-source protocol designed to empower LLMs by enabling them to interface with external tools, services, and data sources. Acting as a translator layer, MCP allows models to interact with APIs, databases, and other services in a standardized, extensible, and scalable way.


๐Ÿšจ The Problem

LLMs alone can't execute real-world tasks โ€” they only generate text. To build powerful AI assistants, we need to integrate them with tools like:

  • Email services
  • Search APIs
  • Databases
  • Custom scripts

But integrating multiple tools is hard. APIs vary widely, maintenance is a headache, and scalability is painful.


โœ… MCP as a Solution

MCP provides a standardized interface that abstracts away the complexities of tool integration. Similar to how REST standardized web services, MCP standardizes how LLMs talk to tools โ€” making integration cleaner, easier, and future-proof.


๐Ÿ”ฎ Why MCP?

MCP helps you build agents and complex workflows on top of LLMs. LLMs frequently need to integrate with data and tools, and MCP provides:

  1. A growing list of pre-built integrations that your LLM can directly plug into
  2. The flexibility to switch between LLM providers and vendors
  3. Best practices for securing your data within your infrastructure

๐Ÿงฉ Architecture & Components

Component Description
MCP Client The LLM-facing component. Can reside in chat apps, dev tools, or assistants.
MCP Server Built by service providers. Translates service functionality (e.g., database queries, API calls) into a format LLMs can understand.
MCP Protocol The two-way transport layer enabling secure, structured communication between client and server.
Service The actual tool or external resource being accessed (e.g., Weather API, SQL DB).

๐Ÿ” How It Works (Flow Example)

<img src="https://github.com/user-attachments/assets/fffe5e30-be96-4f33-bf01-640d107c1d6d" width="400" />

  1. User sends query via an MCP host (e.g., chat app).
  2. MCP Client identifies the need for an external tool.
  3. MCP Server advertises available tools.
  4. LLM decides which tool(s) to use and instructs the client.
  5. Client sends request to relevant MCP Server.
  6. Server connects to the external service and retrieves data.
  7. Response flows back to the LLM for final output generation.

โœจ Key Benefits

  • โœ… Simplified Tool Integration
  • ๐Ÿš€ Extended LLM Capabilities
  • ๐Ÿ› ๏ธ Scalable, Maintainable Architecture
  • ๐Ÿค Standardized Communication Layer
  • ๐Ÿ’ก Fosters Innovation for AI App Developers

๐Ÿ› ๏ธ Tech Stack Used

  • Python - Python forms the backbone of CodeBuddy, providing robust support for integration with various libraries and frameworks.
  • Langchain - LangChain is a framework designed to simplify the creation of applications using large language models.
  • Ollama - It provides a simple API for creating, running, and managing models, as well as a library of pre-built models that can be easily used in a variety of applications.
  • langchain-mcp-adapters - This library provides a lightweight wrapper that makes Anthropic Model Context Protocol (MCP) tools compatible with LangChain and LangGraph.

๐Ÿงฉ Files Overview

File Description
client.py A basic MCP client interacting only with a single mathserver.
mathserver.py An MCP server that exposes simple math operations (e.g., addition, multiplication).
weatherserver.py An MCP server simulating weather data responses.
multiclient.py A multi-client setup where the MCP client can connect to both the math and weather servers.

๐Ÿ”„ How It Works

  1. The client.py script simulates an AI assistant (or LLM) interacting with the Math MCP Server only.

  2. The multiclient.py script demonstrates a more advanced use-case where the MCP client discovers and uses tools from multiple servers (Math + Weather).

  3. mathserver.py and weatherserver.py expose capabilities that can be consumed by MCP clients.

๐Ÿš€ Running the Demo

  1. Start the Servers:

    python mathserver.py
    python weatherserver.py
    
    
  2. Run Single-Client Demo:

    python client.py
    
    
  3. Run Multi-Client Demo:

    python multiclient.py
    
    

๐Ÿš€ Get Involved

Contributions are welcome! If you have suggestions or would like to enhance this project, please fork the repository and submit a pull request.

Interested in contributing to MCP? Stay tuned for:

  • Contribution guidelines
  • Roadmap
  • Issue templates

Feel free to โญ๏ธ the repo and join the discussion!


License

This project is licensed under the MIT License. See the LICENSE file for more details.

Recommended Servers

Crypto Price & Market Analysis MCP Server

Crypto Price & Market Analysis MCP Server

A Model Context Protocol (MCP) server that provides comprehensive cryptocurrency analysis using the CoinCap API. This server offers real-time price data, market analysis, and historical trends through an easy-to-use interface.

Featured
TypeScript
MCP PubMed Search

MCP PubMed Search

Server to search PubMed (PubMed is a free, online database that allows users to search for biomedical and life sciences literature). I have created on a day MCP came out but was on vacation, I saw someone post similar server in your DB, but figured to post mine.

Featured
Python
dbt Semantic Layer MCP Server

dbt Semantic Layer MCP Server

A server that enables querying the dbt Semantic Layer through natural language conversations with Claude Desktop and other AI assistants, allowing users to discover metrics, create queries, analyze data, and visualize results.

Featured
TypeScript
mixpanel

mixpanel

Connect to your Mixpanel data. Query events, retention, and funnel data from Mixpanel analytics.

Featured
TypeScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python
Nefino MCP Server

Nefino MCP Server

Provides large language models with access to news and information about renewable energy projects in Germany, allowing filtering by location, topic (solar, wind, hydrogen), and date range.

Official
Python
Vectorize

Vectorize

Vectorize MCP server for advanced retrieval, Private Deep Research, Anything-to-Markdown file extraction and text chunking.

Official
JavaScript
Mathematica Documentation MCP server

Mathematica Documentation MCP server

A server that provides access to Mathematica documentation through FastMCP, enabling users to retrieve function documentation and list package symbols from Wolfram Mathematica.

Local
Python
kb-mcp-server

kb-mcp-server

An MCP server aimed to be portable, local, easy and convenient to support semantic/graph based retrieval of txtai "all in one" embeddings database. Any txtai embeddings db in tar.gz form can be loaded

Local
Python
Research MCP Server

Research MCP Server

The server functions as an MCP server to interact with Notion for retrieving and creating survey data, integrating with the Claude Desktop Client for conducting and reviewing surveys.

Local
Python