- Explore MCP Servers
- mcp_server_example
Mcp Server Example
What is Mcp Server Example
mcp_server_example is a project that showcases the creation of a custom MCP client-server solution. It utilizes the Pydantic AI Framework for the client and interacts with the Brave Search MCP Server and a custom Send_Email server, all powered by the Gemini-2.0-Flash LLM.
Use cases
Use cases for mcp_server_example include developing personalized AI applications, creating custom search solutions, and automating email notifications based on search results.
How to use
To use mcp_server_example, clone the repository, create a Python virtual environment, activate it, and ensure you have the necessary prerequisites such as Python 3.12, Node.js 22.14.0, and API keys for Gemini and Brave Search.
Key features
Key features of mcp_server_example include full flexibility in client-server integration, the use of advanced AI frameworks, and the ability to send emails through a custom server. It eliminates reliance on pre-built solutions.
Where to use
mcp_server_example can be used in various fields such as AI development, custom software solutions, and applications requiring integration with search engines and email services.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Overview
What is Mcp Server Example
mcp_server_example is a project that showcases the creation of a custom MCP client-server solution. It utilizes the Pydantic AI Framework for the client and interacts with the Brave Search MCP Server and a custom Send_Email server, all powered by the Gemini-2.0-Flash LLM.
Use cases
Use cases for mcp_server_example include developing personalized AI applications, creating custom search solutions, and automating email notifications based on search results.
How to use
To use mcp_server_example, clone the repository, create a Python virtual environment, activate it, and ensure you have the necessary prerequisites such as Python 3.12, Node.js 22.14.0, and API keys for Gemini and Brave Search.
Key features
Key features of mcp_server_example include full flexibility in client-server integration, the use of advanced AI frameworks, and the ability to send emails through a custom server. It eliminates reliance on pre-built solutions.
Where to use
mcp_server_example can be used in various fields such as AI development, custom software solutions, and applications requiring integration with search engines and email services.
Clients Supporting MCP
The following are the main client software that supports the Model Context Protocol. Click the link to visit the official website for more information.
Content
mcp_server_example
This project demonstrates the implementation of building a custom MCP client-server solution, the client is developed using the Pydantic AI Framework, and it interacts with Brave Search MCP Server and a custom Send_Email server, all powered by the Gemini-2.0-Flash LLM. This approach eliminates the need for pre-built solutions like Claude Desktop, offering full flexibility and control over the client-server integration.
Demo Video
Watch the demo video here: Demo Video
Prerequisites
To set up and run the custom MCP server, ensure you have the following:
-
Python 3.12: Download and install the latest version from the official Python website.
-
Node.js 22.14.0: Install this version from the Node.js official site.
-
Gemini API Key: Sign up for a free API key at the Google AI Studio.
-
Brave Search API Key: Obtain a free API key by visiting the Brave Search API page and registering for an account.
-
Gmail App Password: Generate a 16-character app password for your Gmail account by following these steps:
- Navigate to Google Account Security Settings.
- Under “Signing in to Google,” select “App passwords.”
- Choose the app and device for which you need the password, then click “Generate.”
- Copy the generated 16-character password for use in your application.
Setup Instructions
1) Clone the project
Clone the repository to your local machine:
git clone <repository_url>
cd mcp_server_example
2) Create a virtual environment
Create a Python virtual environment for the project:
python -m venv venv
3) Activate the virtual environment
Activate the virtual environment:
-
On Windows:
.\venv\Scripts\ctivate -
On MacOS/Linux:
source venv/bin/activate
4) Install the requirements for the MCP server
Navigate to the mcp_server directory and install the necessary dependencies:
cd mcp_server
pip install -r requirements.txt
5) Install the requirements for the MCP client
Next, navigate to the mcp_client directory and install the necessary dependencies:
cd mcp_client
pip install -r requirements.txt
6) Populate .env files
You need to configure the environment variables for both the server and client. Create .env files in both mcp_server and mcp_client directories and populate them with the following keys:
GEMINI_API_KEY— Free API key from Google AI Studio.BRAVE_API_KEY— Free API key from Brave Search.GMAIL_APP_PASSWORD— Generated app password (not your Gmail password).SENDER_EMAIL- Email address of the sender(the account for which you created the gmail_app_password).
7) Install the Brave Search MCP server
Install the MCP server. This will be called by the mcp_client using STDIO
npm install -g @modelcontextprotocol/server-brave-search
8) Run the server
Start the MCP server by running the following command in the mcp_server directory. This will be called by the mcp_client using SSE
cd mcp_server
python main.py
9) Run the client
Once the server is running, start the MCP client:
cd mcp_client
python main.py
10) Sample Prompts which invokes both the tools
VERY IMPORTANT NOTE: Conversational Memory is not yet implemented and the context is not passed between messages, so if you want to invoke multiple tools, make sure to provide full context in the same message.
-
find the most bizarre food combinations that actually taste good and email them with the subject ‘Food Fusion Fiasco!’ Add a fun note: ‘Time to spice up your taste buds!’" to <email_id>
-
Find the funniest quotes from comedians and email with the subject ‘Comedy Gold!’ Add a personal note: ‘Get ready to laugh out loud!’ to <email_id>.
-
Search for the weirdest facts about space and email with the subject ‘Cosmic Curiosities!’ Add a fun note: ‘Prepare to have your mind blown!’ to <email_id>.
-
Find the top 5 unusual travel destinations and email them with the subject ‘Offbeat Adventures!’ Add a fun note: ‘Time to start planning your next getaway!’ to <email_id>
Dev Tools Supporting MCP
The following are the main code editors that support the Model Context Protocol. Click the link to visit the official website for more information.










