AI-Agentic-MCP
An MCP server exposing employee info retrieval and web search tools, designed to be consumed by a LangChain agent for decoupled tool execution.
README
AI-Agentic MCP
This repository contains an exploration of the Model Context Protocol (MCP) using LangChain and FastMCP. It demonstrates how to decouple tool implementations into an independent MCP server, which is then dynamically consumed by a LangChain agent.
Features
- FastMCP Server: A standalone server exposing tools over a streamable HTTP connection.
get_employee_infos: A mock tool for fetching employee details (name, salary, seniority).search: Web search capability utilizing theTavilySearchAPI.
- LangChain MCP Agent: A ReAct-style conversational agent powered by OpenAI's
gpt-4o-mini. The agent dynamically queries and utilizes the tools exposed by the MCP server usingMultiServerMCPClient. - Decoupled Architecture: Demonstrates building scalable AI agents where the LLM logic and tool executions can exist on different servers.
Project Structure
mcp-server.py: The FastMCP server implementation that defines and serves the tools.agent_graph.py: The interactive LangChain agent that connects to the MCP server and answers user queries via the terminal.graph.ipynb: A Jupyter Notebook for exploring and prototyping.main.py: A simple boilerplate entry point.pyproject.toml/uv.lock: Project metadata and dependencies, managed via uv.
Prerequisites
- Python 3.13 or higher.
- An OpenAI API Key.
- A Tavily API Key (required for the web search tool).
Installation
This project uses uv for dependency management.
-
Clone the repository:
git clone <your-repo-url> cd AI-Agentic-MCP-main -
Install dependencies:
uv syncAlternatively, using pip:
pip install . -
Configure Environment Variables: Create a
.envfile in the root directory and add your API keys:OPENAI_API_KEY=your_openai_api_key_here TAVILY_API_KEY=your_tavily_api_key_here
Usage
To test the multi-server architecture, you need to run the server and the agent simultaneously.
-
Start the MCP Server: In your first terminal, run:
python mcp-server.pyThe server will start listening on
http://localhost:24000/mcp. -
Run the Interactive Agent: In a separate terminal, launch the agent:
python agent_graph.py
You can now ask questions in the prompt (e.g., "What is the salary of Alice?" or search the web). Type exit to quit the agent.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.