Model Context Protocol Server And Tools
MCP server: Model Context Protocol Server And Tools
Installation
npx model-context-protocol-server-and-toolsAsk AI about Model Context Protocol Server And Tools
Powered by Claude · Grounded in docs
I know everything about Model Context Protocol Server And Tools. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
Model Context Protocol Server and Tools
This repository contains implementations of Model Context Protocol (MCP) servers and client applications that demonstrate how to use MCP for AI agent interactions.
Part 1: Math Tools Integration (client.py and mathserver.py)
This part of the codebase demonstrates how to create a simple MCP server that provides math operations and a client that utilizes these operations through a language model.
mathserver.py
A simple MCP server that provides basic mathematical operations:
add: Adds two integers togethersubtract: Subtracts the second integer from the firstmultiply: Multiplies two integers togetherdivide: Divides the first integer by the second, returns a float
The server uses FastMCP to easily expose these operations as tools that can be called by MCP clients.
client.py
A demonstration client that:
- Sets up a connection to the math server using
MultiServerMCPClient - Uses the Groq API with the "qwen-qwq-32b" model
- Creates a ReAct agent using LangGraph
- Executes a simple math problem "(88*(2+3))/5" by having the language model use the math tools
How to Run
- Make sure you have all dependencies installed:
pip install -r requirements.txt - Set your Groq API key in a
.envfile:GROQ_API_KEY=your-api-key - Run the client:
python client.py
The client will automatically start the math server as a subprocess, communicate with it using stdio transport, and solve the math problem.
Part 2: Advanced MCP Integration (app.py and mcpconfig.json)
This part demonstrates a more advanced usage of MCP with multiple external tool servers and an interactive chat interface.
mcpconfig.json
Configuration file that defines external MCP servers:
playwright: For web automation tasksairbnb: For Airbnb-related operationsduckduckgo-search: For web search functionality
Each server is configured with the command and arguments needed to start it.
app.py
An interactive chat application that:
- Connects to all the servers defined in
mcpconfig.json - Sets up a chat interface using the Groq "qwen-qwq-32b" model
- Creates an
MCPAgentthat can use all available tools from the configured servers - Provides a memory-enabled conversation that maintains chat history
- Allows users to interact with the agent in a continuous conversation
Features:
- Persistent conversation history (memory)
- Commands to exit the chat (
exit,quit) - Command to clear conversation history (
clear) - Error handling for agent operations
How to Run
- Make sure you have all dependencies installed:
pip install -r requirements.txt - Set your Groq API key in a
.envfile:GROQ_API_KEY=your-api-key - Run the application:
python app.py - Interact with the chat interface by typing messages
Note: When running app.py, the external MCP servers will be started automatically as configured in mcpconfig.json.
Requirements
See requirements.txt for the full list of dependencies:
- langchain-groq
- langchain-mcp-adapters
- mcp
- langgraph
- mcp-use
