Resources/Learn/how-to-connect-everyday-tools-with-mcp

How to Connect Everyday Tools with MCP

May 16, 2025
3
mins read
Rajdeep Borgohain
DevRel Engineer
I am AI
Get things done!
Table of contents
Subscribe to our blog
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Developers constantly juggle multiple tools, data sources, and APIs to build effective AI systems. The recently introduced Model Context Protocol (MCP) is revolutionizing how we connect LLMs with external tools and data sources. Since its introduction in November 2024 by Anthropic as an open-source protocol, MCP has gained significant traction among AI development teams. This blog explores how MCP serves as a universal connector for AI applications, dramatically simplifying integration workflows.

Introduction

The evolution of Large Language Models (LLMs) has transformed how we build AI applications, but a persistent challenge remains: efficiently connecting these models to the diverse ecosystem of tools and data sources we use daily. This technical overhead distracts from the core objective of delivering powerful AI capabilities. Learn more on the Inferless homepage.

MCP emerged as a response to this integration challenge, providing a standardized way for AI applications to connect with external data sources and tools, similar to how open protocol integration in data centers ensures interoperability in complex infrastructures.

The impact of this protocol extends beyond mere convenience. By standardizing connections between AI models and external tools, MCP enables more sophisticated AI agents capable of performing complex workflows across multiple applications.

In this blog, we'll explore what MCP is, why it matters, and how its architecture enables seamless integration between AI systems and everyday tools. Whether you're building agents, automating workflows, or simply connecting your models to external data sources, understanding MCP will significantly enhance your development capabilities.

What Is Model Context Protocol (MCP)?

MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, just as USB-C provides a standardized way to connect devices to various peripherals, MCP provides a standardized way to connect AI models to different data sources and tools. This protocol enables seamless integration between LLM applications and external data sources and tools through a unified interface.

MCP operates on a fundamental principle: instead of building custom integrations for each tool or data source, developers can implement a single protocol that handles all connections, which requires understanding API protocol types.This dramatically simplifies the architecture of AI systems that need to access multiple external resources. The protocol itself defines standard formats for communication, authentication, and data exchange, ensuring consistency across different integrations.

Why Use MCP?

Implementing MCP in your machine learning workflows offers several compelling advantages:

  1. Simplified Integration: MCP provides a standardized method to connect AI models with various data sources and tools, reducing the need for custom integrations.Example: Instead of writing separate code to connect your AI to Google Calendar, Notion, and Slack, you implement MCP once and connect to all three.
  2. Enhanced Scalability: By using MCP, adding new tools becomes plug-and-play instead of requiring extensive custom work.Example: When a new tool like a document processor comes along, you just need an MCP server for it, no need to rebuild your entire system.
  3. Improved Security: MCP incorporates standardized access controls and security practices, minimizing vulnerabilities associated with multiple custom integrations.Example: Using MCP's built-in authentication mechanisms, organizations can ensure secure data exchanges between AI models and sensitive internal systems.
  4. Enables Complex AI Workflows: MCP enables AI agents to perform complex, multi-step tasks by integrating various tools and data sources seamlessly.Example: A single natural language request like "Schedule a team meeting next week" can trigger an agent that checks everyone's calendar availability, finds an appropriate meeting room, and creates a calendar event with video conferencing links.
  5. Real-world Applications: Organizations have utilized MCP-powered agents for tasks such as natural language analytics and automated documentation generation, demonstrating its practical benefits.
  6. Example: Teams at organizations like Runbear have implemented MCP-powered agents for tasks ranging from natural language analytics with BigQuery to automated documentation generation from Slack conversations.

MCP Architecture & Core Components

MCP facilitate seamless integration between LLMs and external tools, systems, and data sources. It addresses the complexity of connecting AI applications to various external resources by providing a standardized, model-agnostic interface.

Core Architecture

MCP adopts a modular client-server architecture, comprising three primary components:

  • Host: The AI application (e.g., Claude, ChatGPT, IDE plugins) that initiates and manages connections to external resources.
  • Client: An intermediary within the host application that manages secure, isolated connections to individual MCP servers.
  • Server: A lightweight service that exposes specific capabilities (resources, tools, prompts) via the MCP protocol, allowing AI models to interact with external systems .

Communication between these components is facilitated using JSON-RPC 2.0 over various transports, including standard input/output (stdio) for local interactions and HTTP with Server-Sent Events (SSE) for remote connections, similar to multi-protocol integration in Solace PubSub+.

Core MCP Concepts

MCP defines several key primitives that enable structured interactions between AI models and external systems:

  • Resources: Structured data objects providing context, such as documents, database entries, or API responses.
  • Prompts: Templated messages or workflows designed to guide AI behavior in specific tasks or domains.
  • Tools: Executable functions exposed by servers, allowing AI models to perform actions like querying databases, invoking APIs, or manipulating files.

Additional utilities support configuration management, progress tracking, cancellation, error reporting, and logging, creating a comprehensive framework for AI-tool interactions, leveraging transfer protocols and transport languages for SaaS integrations.

Ecosystem of MCP Servers

One of MCP's strengths lies in its extensible ecosystem of servers, which can be developed independently by tool creators. This modularity allows for a wide range of integrations without altering the core protocol. Notable MCP servers include:

  • File Systems: Access and manipulate local or cloud-based file storage.
  • Databases: Interact with databases like PostgreSQL, SQLite, and MySQL for querying and data management.
  • Development Tools: Integrate with Git, GitHub, GitLab, and IDEs for version control and code management.
  • Productivity Applications: Connect with tools like Slack, Google Maps, and Google Drive to enhance workflow efficiency.

These servers provide AI models with the ability to perform complex tasks by leveraging existing tools and data sources, significantly expanding their capabilities.

Integrating Everyday Tools with MCP (Multi-Component Protocol)

In an MCP architecture, the AI agent (LLM) acts as a client, and each external tool is wrapped as an MCP server that the agent can query or command. A wide range of common applications have been integrated as MCP servers.

For example, there are servers for Gmail & Google Calendar (reading emails, sending invites), Google Maps (geocoding, directions, place details), Notion (querying and updating notes or to-do lists), GitHub (fetching repo data, pull requests), and hundreds of other services.

Each MCP server exposes a specific tool’s functionality (via defined actions and data schemas) in a standardized way. The AI agent doesn’t need to know how to call the Gmail API or the Google Maps HTTP endpoints, it simply asks the MCP server, which handles the details.

Tools integrations with MCP become like LEGO blocks that can be reused and recombined. One project’s Gmail server, for instance, can be plugged into another AI agent with minimal effort. MCP provides the glue layer that lets an AI easily switch out or add new capabilities without custom-coding for each service.

Hands-On Example: Building a Google Maps MCP Server

  1. First install the required python libraries:
pip install \
 langchain-mcp-adapters==0.0.9 \
 mcp==1.6.0 \
 requests==2.32.3 \
 langchain-openai==0.3.14 \
 langgraph==0.3.34 \
 inferless==0.2.13 \
 pydantic==2.10.2 \
 litellm==1.67.2

2. Start the Ollama Server and Pull the Model

Begin by launching the Ollama server and downloading the desired model.

# Start the Ollama server
ollama serve

In a separate terminal, pull the required model:

# Replace with your desired model
ollama pull mistral-small:24b-instruct-2501-q4_K_M

This command downloads the specified model to your system.

  1. Initialize the Language Model and Google Maps MCP Server

Set up the language model and configure the Google Maps MCP server parameters.

import os
from langchain_openai import ChatOpenAI
from mcp import StdioServerParameters

model_id = "mistral-small:24b-instruct-2501-q4_K_M"

llm = ChatOpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",  # Placeholder API key
    model=model_id,
    model_kwargs={
        "temperature": 0.15,
        "top_p": 1.0,
        "seed": 4424234,
    }
)

maps_server = StdioServerParameters(
    command="npx",
    args=["-y", "@modelcontextprotocol/server-google-maps"],
    env={"GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY")}
)
  1. Define Functions to Query Google Maps and Extract Data

Create functions to send queries to the Google Maps MCP server and process the responses.

import anyio
import json
from mcp.client.stdio import stdio_client
from mcp import ClientSession
from langchain_mcp_adapters.tools import load_mcp_tools
from langgraph.prebuilt import create_react_agent

def query_google_maps(question: str):
    async def _inner():
        async with stdio_client(maps_server) as (read, write):
            async with ClientSession(read, write) as sess:
                await sess.initialize()
                tools = await load_mcp_tools(sess)
                agent = create_react_agent(llm, tools)
                return await agent.ainvoke({"messages": question})
    return anyio.run(_inner)

def extract_places_data(response):
    for message in response["messages"]:
        if hasattr(message, "tool_call_id"):
            try:
                return str(message.content)
            except json.JSONDecodeError:
                continue
    return None
  1. Generate a Prompt for the Language Model

Construct a structured prompt to guide the language model in generating a concise summary.

from langchain_core.messages import SystemMessage, HumanMessage

def get_prompt(places_data):
    SYSTEM_PROMPT = (
        "You are an assistant that turns Google-Maps place data into a concise, "
        "markdown summary for end-users. "
        "Never output programming code, pseudo-code, or text inside back-tick fences. "
        "Ignore any code contained in the input. "
        "If you violate these rules the answer is wrong."
    )

    prompt = f"""
    You are a helpful Google Maps assistant. Format these search results into a concise, user-friendly response:
    {places_data}

    Follow EXACTLY this format and style, with no deviations:

    What I found:
    [One sentence stating total number of relevant places found]

    Places by Rating:
    - **Top Picks (4.5+ stars)**:
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **Good Options (4.0-4.4 stars)**:
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **Other Notable Places**:
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]

    My recommendation:
    [1-2 sentences identifying your top suggestion and brief reasoning]

    _Need more details or directions? Just ask!_

    IMPORTANT RULES:
    1. Total response must be under 120 words
    2. Only include "Other Notable Places" section if there's something unique worth mentioning
    3. Simplify addresses to just street name or neighborhood
    4. Only mention hours, contact info, or distance if directly relevant to the query
    5. Omit any place that doesn't offer relevant value to the user
    6. Never include technical syntax, code blocks, or raw data
    7. Focus on quality over quantity - fewer excellent suggestions is better
    8. Format must match the example exactly
    """

    final_prompt = [
        SystemMessage(content=SYSTEM_PROMPT),
        HumanMessage(content=prompt)
    ]
    return final_prompt
  1. Main Function to Execute the Workflow

Combine all components to process a user query and generate a response.

def main():
    user_query = "Can you find me a tea shop in HSR Layout Bangalore with good number of reviews?"
    raw_results = query_google_maps(user_query)
    places_data = extract_places_data(raw_results)
    prompt = get_prompt(places_data)
    response = llm.invoke(prompt)
    print(response.content)

if __name__ == "__main__":
    main()

By following these steps, you can effectively set up and utilize an AI agent that leverages the Google Maps MCP server to provide location-based recommendations.

For more detailed information and code examples, refer to the Inferless Cookbook: Build a Google Maps Agent using MCP & Inferless.

How Developers Are Using MCP in Practice

MCP has rapidly gained adoption in the AI developer community. By standardizing how AI agents connect to tools, it has enabled a blossoming ecosystem of integrations and use-cases:

  1. Creative work (design, music, video)
    Figma canvas MCP server
    : A single prompt on Claude drops a component onto the live canvas, used by UI teams to generate wire‑frames while screenshare‑collaborating.
    Ableton Live music producer
    : Ableton MCP lets musicians generate beats, set tempo or swap instruments from chat; early adopters say it halves ideation time.
  1. Data, analytics & reporting
    Perplexity “Sonar” MCP:
    Gives LLMs real‑time web search inside MCP‑compatible agents, so reports include up‑to‑the‑second citations.
  1. Robotics & IoT control
    Arduino rover & ROS2 robots(LinkedIn, Reddit) follows natural‑language commands by translating them on‑the‑fly into standard geometry_msgs/Twist velocity messages or direct PWM signals for servo actuation.
  1. Fin‑tech
    Stripe & PayPal billing
    at Cloudflare Demo Day, New remote MCP servers let an agent generate invoices or issue refunds straight from chat.

Deploying Ollama (Open-Source LLM Inference) with Inferless

Ollama is an open-source engine designed for running LLMs locally.   Here’s a step-by-step approach to deploying an LLM using Ollama on Inferless, facilitating integration with AI agents operating on MCP servers.

Step 1: Install Ollama on Inferless

To install Ollama within the Inferless environment, utilize the inferless-runtime-config.yaml file. For step-by-step guidance, learn how to deploy machine learning models with Inferless.

build:
  cuda_version: "12.1.1"
  python_packages:
	run:
	  - "curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz"
	  - "tar -C /usr -xzf ollama-linux-amd64.tgz"

This configuration ensures that Ollama and its dependencies are correctly set up in the Inferless runtime.

Step 2: Manage Ollama with a Python Script

Implement a Python script to manage the Ollama server lifecycle and model operations. You can refer to the ollama_manager.py script available here. This script provides functionalities to:

  • Start and stop the Ollama server
  • Check server status
  • Download and verify models
  • List available models

By encapsulating these operations, the script simplifies the integration and management of Ollama within your application.

Step 3: Integrate Ollama with Your Application

In your initialize method, you start by setting up the OllamaManager to handle the lifecycle of the Ollama server and manage model downloads.

manager = OllamaManager()
manager.start_server()
models = manager.list_models()

model_id = "mistral-small:24b-instruct-2501-q4_K_M"
if not any(model['name'] == model_id for model in models):
    manager.download_model(model_id)

This ensures that the Ollama server is running and the specified model is available for use.

Next, you configure the language model using the ChatOpenAI class from the langchain_openai package.

self.llm = ChatOpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",
    model=model_id,
    model_kwargs={
        "temperature": 0.15,
        "top_p": 1.0,
        "seed": 4424234,
    }
)

This setup allows you to leverage the capabilities of the local LLM through a familiar interface provided by LangChain.

In the infer method, you handle incoming user queries and generating responses using the configured language model.

def infer(self, request: RequestObjects) -> ResponseObjects:
    user_query = request.user_query
    response = self.llm.invoke(user_query)

    generateObject = ResponseObjects(generated_result=response.content)
    return generateObject

Here, self.llm.invoke(user_query) sends the constructed prompt to the local LLM via the Ollama server, and the response is encapsulated in the ResponseObjects data model for return.

By following this guide, you can seamlessly deploy and manage large language models using Ollama within the Inferless platform, enabling efficient and scalable AI-driven applications.

MCP Best Practices

  • Minimal Permissions: Only give servers and tools the access they absolutely need. Learn how Inferless serverless GPUs can support your AI and ML inference needs.
  • Update Dependencies: Regularly check and update your software libraries for security fixes.
  • Simple Code: Keep your code clear, easy-to-read, and well-tested.
  • Consistent Formatting: Use automatic tools to check and format your code consistently.
  • Security Testing: Regularly test your application against common threats like invalid inputs or hacking attempts.
  • Clear Docs: Clearly explain what your tools do, how to use them, and any security details, as demonstrated by the Generic Integration Protocol in Oracle Intelligent Advisor.
  • Annotations as Guidance: Mark tools clearly (like read-only), but don't rely solely on these markings for security.
  • Check Incoming Data: Always carefully validate incoming MCP messages to prevent security risks.

Conclusion

The Model Context Protocol (MCP) offers a unified, standardized interface for integrating LLMs with heterogeneous tools and data sources. By abstracting tool-specific logic behind a consistent client-server architecture, MCP minimizes integration overhead, enforces consistent security boundaries, and significantly improves modularity across AI systems. Its extensible design enables rapid composition of multi-step, agent-driven workflows using pluggable components—each encapsulated as an MCP server. As adoption accelerates, MCP is emerging as a foundational interoperability layer for AI infrastructure, streamlining both prototyping and deployment of production-grade, tool-aware agents. For teams building scalable, context-rich AI systems, MCP is quickly becoming an architectural baseline.

References:

  1. https://www.anthropic.com/news/model-context-protocol
  2. https://docs.anthropic.com/en/docs/agents-and-tools/mcp
  3. https://www.datacamp.com/tutorial/mcp-model-context-protocol
  4. https://medium.com/@eduardojld/understand-mcp-with-a-useful-example-in-under-10-minutes-f13bc9d6c852
  5. https://github.com/punkpeye/awesome-mcp-servers
  6. https://blog.cloudflare.com/thirteen-new-mcp-servers-from-cloudflare/
  7. https://docs.inferless.com/cookbook/google-map-agent-using-mcp

Developers constantly juggle multiple tools, data sources, and APIs to build effective AI systems. The recently introduced Model Context Protocol (MCP) is revolutionizing how we connect LLMs with external tools and data sources. Since its introduction in November 2024 by Anthropic as an open-source protocol, MCP has gained significant traction among AI development teams. This blog explores how MCP serves as a universal connector for AI applications, dramatically simplifying integration workflows.

Introduction

The evolution of Large Language Models (LLMs) has transformed how we build AI applications, but a persistent challenge remains: efficiently connecting these models to the diverse ecosystem of tools and data sources we use daily. This technical overhead distracts from the core objective of delivering powerful AI capabilities. Learn more on the Inferless homepage.

MCP emerged as a response to this integration challenge, providing a standardized way for AI applications to connect with external data sources and tools, similar to how open protocol integration in data centers ensures interoperability in complex infrastructures.

The impact of this protocol extends beyond mere convenience. By standardizing connections between AI models and external tools, MCP enables more sophisticated AI agents capable of performing complex workflows across multiple applications.

In this blog, we'll explore what MCP is, why it matters, and how its architecture enables seamless integration between AI systems and everyday tools. Whether you're building agents, automating workflows, or simply connecting your models to external data sources, understanding MCP will significantly enhance your development capabilities.

What Is Model Context Protocol (MCP)?

MCP is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, just as USB-C provides a standardized way to connect devices to various peripherals, MCP provides a standardized way to connect AI models to different data sources and tools. This protocol enables seamless integration between LLM applications and external data sources and tools through a unified interface.

MCP operates on a fundamental principle: instead of building custom integrations for each tool or data source, developers can implement a single protocol that handles all connections, which requires understanding API protocol types.This dramatically simplifies the architecture of AI systems that need to access multiple external resources. The protocol itself defines standard formats for communication, authentication, and data exchange, ensuring consistency across different integrations.

Why Use MCP?

Implementing MCP in your machine learning workflows offers several compelling advantages:

  1. Simplified Integration: MCP provides a standardized method to connect AI models with various data sources and tools, reducing the need for custom integrations.Example: Instead of writing separate code to connect your AI to Google Calendar, Notion, and Slack, you implement MCP once and connect to all three.
  2. Enhanced Scalability: By using MCP, adding new tools becomes plug-and-play instead of requiring extensive custom work.Example: When a new tool like a document processor comes along, you just need an MCP server for it, no need to rebuild your entire system.
  3. Improved Security: MCP incorporates standardized access controls and security practices, minimizing vulnerabilities associated with multiple custom integrations.Example: Using MCP's built-in authentication mechanisms, organizations can ensure secure data exchanges between AI models and sensitive internal systems.
  4. Enables Complex AI Workflows: MCP enables AI agents to perform complex, multi-step tasks by integrating various tools and data sources seamlessly.Example: A single natural language request like "Schedule a team meeting next week" can trigger an agent that checks everyone's calendar availability, finds an appropriate meeting room, and creates a calendar event with video conferencing links.
  5. Real-world Applications: Organizations have utilized MCP-powered agents for tasks such as natural language analytics and automated documentation generation, demonstrating its practical benefits.
  6. Example: Teams at organizations like Runbear have implemented MCP-powered agents for tasks ranging from natural language analytics with BigQuery to automated documentation generation from Slack conversations.

MCP Architecture & Core Components

MCP facilitate seamless integration between LLMs and external tools, systems, and data sources. It addresses the complexity of connecting AI applications to various external resources by providing a standardized, model-agnostic interface.

Core Architecture

MCP adopts a modular client-server architecture, comprising three primary components:

  • Host: The AI application (e.g., Claude, ChatGPT, IDE plugins) that initiates and manages connections to external resources.
  • Client: An intermediary within the host application that manages secure, isolated connections to individual MCP servers.
  • Server: A lightweight service that exposes specific capabilities (resources, tools, prompts) via the MCP protocol, allowing AI models to interact with external systems .

Communication between these components is facilitated using JSON-RPC 2.0 over various transports, including standard input/output (stdio) for local interactions and HTTP with Server-Sent Events (SSE) for remote connections, similar to multi-protocol integration in Solace PubSub+.

Core MCP Concepts

MCP defines several key primitives that enable structured interactions between AI models and external systems:

  • Resources: Structured data objects providing context, such as documents, database entries, or API responses.
  • Prompts: Templated messages or workflows designed to guide AI behavior in specific tasks or domains.
  • Tools: Executable functions exposed by servers, allowing AI models to perform actions like querying databases, invoking APIs, or manipulating files.

Additional utilities support configuration management, progress tracking, cancellation, error reporting, and logging, creating a comprehensive framework for AI-tool interactions, leveraging transfer protocols and transport languages for SaaS integrations.

Ecosystem of MCP Servers

One of MCP's strengths lies in its extensible ecosystem of servers, which can be developed independently by tool creators. This modularity allows for a wide range of integrations without altering the core protocol. Notable MCP servers include:

  • File Systems: Access and manipulate local or cloud-based file storage.
  • Databases: Interact with databases like PostgreSQL, SQLite, and MySQL for querying and data management.
  • Development Tools: Integrate with Git, GitHub, GitLab, and IDEs for version control and code management.
  • Productivity Applications: Connect with tools like Slack, Google Maps, and Google Drive to enhance workflow efficiency.

These servers provide AI models with the ability to perform complex tasks by leveraging existing tools and data sources, significantly expanding their capabilities.

Integrating Everyday Tools with MCP (Multi-Component Protocol)

In an MCP architecture, the AI agent (LLM) acts as a client, and each external tool is wrapped as an MCP server that the agent can query or command. A wide range of common applications have been integrated as MCP servers.

For example, there are servers for Gmail & Google Calendar (reading emails, sending invites), Google Maps (geocoding, directions, place details), Notion (querying and updating notes or to-do lists), GitHub (fetching repo data, pull requests), and hundreds of other services.

Each MCP server exposes a specific tool’s functionality (via defined actions and data schemas) in a standardized way. The AI agent doesn’t need to know how to call the Gmail API or the Google Maps HTTP endpoints, it simply asks the MCP server, which handles the details.

Tools integrations with MCP become like LEGO blocks that can be reused and recombined. One project’s Gmail server, for instance, can be plugged into another AI agent with minimal effort. MCP provides the glue layer that lets an AI easily switch out or add new capabilities without custom-coding for each service.

Hands-On Example: Building a Google Maps MCP Server

  1. First install the required python libraries:
pip install \
 langchain-mcp-adapters==0.0.9 \
 mcp==1.6.0 \
 requests==2.32.3 \
 langchain-openai==0.3.14 \
 langgraph==0.3.34 \
 inferless==0.2.13 \
 pydantic==2.10.2 \
 litellm==1.67.2

2. Start the Ollama Server and Pull the Model

Begin by launching the Ollama server and downloading the desired model.

# Start the Ollama server
ollama serve

In a separate terminal, pull the required model:

# Replace with your desired model
ollama pull mistral-small:24b-instruct-2501-q4_K_M

This command downloads the specified model to your system.

  1. Initialize the Language Model and Google Maps MCP Server

Set up the language model and configure the Google Maps MCP server parameters.

import os
from langchain_openai import ChatOpenAI
from mcp import StdioServerParameters

model_id = "mistral-small:24b-instruct-2501-q4_K_M"

llm = ChatOpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",  # Placeholder API key
    model=model_id,
    model_kwargs={
        "temperature": 0.15,
        "top_p": 1.0,
        "seed": 4424234,
    }
)

maps_server = StdioServerParameters(
    command="npx",
    args=["-y", "@modelcontextprotocol/server-google-maps"],
    env={"GOOGLE_MAPS_API_KEY": os.getenv("GOOGLE_MAPS_API_KEY")}
)
  1. Define Functions to Query Google Maps and Extract Data

Create functions to send queries to the Google Maps MCP server and process the responses.

import anyio
import json
from mcp.client.stdio import stdio_client
from mcp import ClientSession
from langchain_mcp_adapters.tools import load_mcp_tools
from langgraph.prebuilt import create_react_agent

def query_google_maps(question: str):
    async def _inner():
        async with stdio_client(maps_server) as (read, write):
            async with ClientSession(read, write) as sess:
                await sess.initialize()
                tools = await load_mcp_tools(sess)
                agent = create_react_agent(llm, tools)
                return await agent.ainvoke({"messages": question})
    return anyio.run(_inner)

def extract_places_data(response):
    for message in response["messages"]:
        if hasattr(message, "tool_call_id"):
            try:
                return str(message.content)
            except json.JSONDecodeError:
                continue
    return None
  1. Generate a Prompt for the Language Model

Construct a structured prompt to guide the language model in generating a concise summary.

from langchain_core.messages import SystemMessage, HumanMessage

def get_prompt(places_data):
    SYSTEM_PROMPT = (
        "You are an assistant that turns Google-Maps place data into a concise, "
        "markdown summary for end-users. "
        "Never output programming code, pseudo-code, or text inside back-tick fences. "
        "Ignore any code contained in the input. "
        "If you violate these rules the answer is wrong."
    )

    prompt = f"""
    You are a helpful Google Maps assistant. Format these search results into a concise, user-friendly response:
    {places_data}

    Follow EXACTLY this format and style, with no deviations:

    What I found:
    [One sentence stating total number of relevant places found]

    Places by Rating:
    - **Top Picks (4.5+ stars)**:
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **Good Options (4.0-4.4 stars)**:
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]
    - **Other Notable Places**:
    - **[Place Name]** - [Rating]/5 - [Simple location] - [1-2 key features]

    My recommendation:
    [1-2 sentences identifying your top suggestion and brief reasoning]

    _Need more details or directions? Just ask!_

    IMPORTANT RULES:
    1. Total response must be under 120 words
    2. Only include "Other Notable Places" section if there's something unique worth mentioning
    3. Simplify addresses to just street name or neighborhood
    4. Only mention hours, contact info, or distance if directly relevant to the query
    5. Omit any place that doesn't offer relevant value to the user
    6. Never include technical syntax, code blocks, or raw data
    7. Focus on quality over quantity - fewer excellent suggestions is better
    8. Format must match the example exactly
    """

    final_prompt = [
        SystemMessage(content=SYSTEM_PROMPT),
        HumanMessage(content=prompt)
    ]
    return final_prompt
  1. Main Function to Execute the Workflow

Combine all components to process a user query and generate a response.

def main():
    user_query = "Can you find me a tea shop in HSR Layout Bangalore with good number of reviews?"
    raw_results = query_google_maps(user_query)
    places_data = extract_places_data(raw_results)
    prompt = get_prompt(places_data)
    response = llm.invoke(prompt)
    print(response.content)

if __name__ == "__main__":
    main()

By following these steps, you can effectively set up and utilize an AI agent that leverages the Google Maps MCP server to provide location-based recommendations.

For more detailed information and code examples, refer to the Inferless Cookbook: Build a Google Maps Agent using MCP & Inferless.

How Developers Are Using MCP in Practice

MCP has rapidly gained adoption in the AI developer community. By standardizing how AI agents connect to tools, it has enabled a blossoming ecosystem of integrations and use-cases:

  1. Creative work (design, music, video)
    Figma canvas MCP server
    : A single prompt on Claude drops a component onto the live canvas, used by UI teams to generate wire‑frames while screenshare‑collaborating.
    Ableton Live music producer
    : Ableton MCP lets musicians generate beats, set tempo or swap instruments from chat; early adopters say it halves ideation time.
  1. Data, analytics & reporting
    Perplexity “Sonar” MCP:
    Gives LLMs real‑time web search inside MCP‑compatible agents, so reports include up‑to‑the‑second citations.
  1. Robotics & IoT control
    Arduino rover & ROS2 robots(LinkedIn, Reddit) follows natural‑language commands by translating them on‑the‑fly into standard geometry_msgs/Twist velocity messages or direct PWM signals for servo actuation.
  1. Fin‑tech
    Stripe & PayPal billing
    at Cloudflare Demo Day, New remote MCP servers let an agent generate invoices or issue refunds straight from chat.

Deploying Ollama (Open-Source LLM Inference) with Inferless

Ollama is an open-source engine designed for running LLMs locally.   Here’s a step-by-step approach to deploying an LLM using Ollama on Inferless, facilitating integration with AI agents operating on MCP servers.

Step 1: Install Ollama on Inferless

To install Ollama within the Inferless environment, utilize the inferless-runtime-config.yaml file. For step-by-step guidance, learn how to deploy machine learning models with Inferless.

build:
  cuda_version: "12.1.1"
  python_packages:
	run:
	  - "curl -L https://ollama.com/download/ollama-linux-amd64.tgz -o ollama-linux-amd64.tgz"
	  - "tar -C /usr -xzf ollama-linux-amd64.tgz"

This configuration ensures that Ollama and its dependencies are correctly set up in the Inferless runtime.

Step 2: Manage Ollama with a Python Script

Implement a Python script to manage the Ollama server lifecycle and model operations. You can refer to the ollama_manager.py script available here. This script provides functionalities to:

  • Start and stop the Ollama server
  • Check server status
  • Download and verify models
  • List available models

By encapsulating these operations, the script simplifies the integration and management of Ollama within your application.

Step 3: Integrate Ollama with Your Application

In your initialize method, you start by setting up the OllamaManager to handle the lifecycle of the Ollama server and manage model downloads.

manager = OllamaManager()
manager.start_server()
models = manager.list_models()

model_id = "mistral-small:24b-instruct-2501-q4_K_M"
if not any(model['name'] == model_id for model in models):
    manager.download_model(model_id)

This ensures that the Ollama server is running and the specified model is available for use.

Next, you configure the language model using the ChatOpenAI class from the langchain_openai package.

self.llm = ChatOpenAI(
    base_url="http://localhost:11434/v1",
    api_key="ollama",
    model=model_id,
    model_kwargs={
        "temperature": 0.15,
        "top_p": 1.0,
        "seed": 4424234,
    }
)

This setup allows you to leverage the capabilities of the local LLM through a familiar interface provided by LangChain.

In the infer method, you handle incoming user queries and generating responses using the configured language model.

def infer(self, request: RequestObjects) -> ResponseObjects:
    user_query = request.user_query
    response = self.llm.invoke(user_query)

    generateObject = ResponseObjects(generated_result=response.content)
    return generateObject

Here, self.llm.invoke(user_query) sends the constructed prompt to the local LLM via the Ollama server, and the response is encapsulated in the ResponseObjects data model for return.

By following this guide, you can seamlessly deploy and manage large language models using Ollama within the Inferless platform, enabling efficient and scalable AI-driven applications.

MCP Best Practices

  • Minimal Permissions: Only give servers and tools the access they absolutely need. Learn how Inferless serverless GPUs can support your AI and ML inference needs.
  • Update Dependencies: Regularly check and update your software libraries for security fixes.
  • Simple Code: Keep your code clear, easy-to-read, and well-tested.
  • Consistent Formatting: Use automatic tools to check and format your code consistently.
  • Security Testing: Regularly test your application against common threats like invalid inputs or hacking attempts.
  • Clear Docs: Clearly explain what your tools do, how to use them, and any security details, as demonstrated by the Generic Integration Protocol in Oracle Intelligent Advisor.
  • Annotations as Guidance: Mark tools clearly (like read-only), but don't rely solely on these markings for security.
  • Check Incoming Data: Always carefully validate incoming MCP messages to prevent security risks.

Conclusion

The Model Context Protocol (MCP) offers a unified, standardized interface for integrating LLMs with heterogeneous tools and data sources. By abstracting tool-specific logic behind a consistent client-server architecture, MCP minimizes integration overhead, enforces consistent security boundaries, and significantly improves modularity across AI systems. Its extensible design enables rapid composition of multi-step, agent-driven workflows using pluggable components—each encapsulated as an MCP server. As adoption accelerates, MCP is emerging as a foundational interoperability layer for AI infrastructure, streamlining both prototyping and deployment of production-grade, tool-aware agents. For teams building scalable, context-rich AI systems, MCP is quickly becoming an architectural baseline.

References:

  1. https://www.anthropic.com/news/model-context-protocol
  2. https://docs.anthropic.com/en/docs/agents-and-tools/mcp
  3. https://www.datacamp.com/tutorial/mcp-model-context-protocol
  4. https://medium.com/@eduardojld/understand-mcp-with-a-useful-example-in-under-10-minutes-f13bc9d6c852
  5. https://github.com/punkpeye/awesome-mcp-servers
  6. https://blog.cloudflare.com/thirteen-new-mcp-servers-from-cloudflare/
  7. https://docs.inferless.com/cookbook/google-map-agent-using-mcp

Table of contents