SampleMCP
Allows LangChain agents to connect to MCP servers for math and weather tools, enabling multi-step reasoning and tool use.
Enables LangGraph ReAct agents to leverage MCP tools, supporting sequential tool calls and integration with language models.
Integrates OpenAI language models as the reasoning engine for agents that use MCP tools, such as arithmetic and weather queries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SampleMCPwhat's (3+5)*12?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
SampleMCP
A simple Python project demonstrating how to build and connect MCP servers using FastMCP, LangChain MCP adapters, LangGraph, and OpenAI.
Features
Math MCP server using
stdioWeather MCP server using
streamable-httpLangChain MCP client connecting to multiple MCP servers
LangGraph ReAct agent using MCP tools
Example tool calls for math and weather queries
Related MCP server: Server MCP
Project Structure
SampleMCP/
├── client.py # MCP client + LangGraph agent
├── mathserver.py # Math MCP server with add/multiply tools
├── weather.py # Weather MCP server using streamable HTTP
├── main.py # Basic sample entry point
├── pyproject.toml # Project metadata and dependencies
├── requirements.txt # Python dependencies
└── README.mdRequirements
Python 3.12+
OpenAI API key
Optional: Groq API key
Installation
Clone the repository:
git clone https://github.com/JayantPrakash/SampleMCP.git
cd SampleMCPInstall dependencies:
pip install -r requirements.txtOr using uv:
uv syncEnvironment Variables
Create a .env file in the project root:
OPENAI_API_KEY=your_openai_api_key
GROQ_API_KEY=your_groq_api_keyRunning the MCP Servers
1. Start the Weather Server
The weather server uses streamable-http.
python weather.pyBy default, it exposes the MCP endpoint at:
http://localhost:8000/mcp2. Math Server
The math server uses stdio and is started automatically by the client through:
"command": "python",
"args": ["mathserver.py"],
"transport": "stdio"Running the Client
In a separate terminal, run:
python client.pyThe client connects to:
mathserver.pythroughstdioweather.pythroughstreamable_http
It then creates a LangGraph ReAct agent and asks:
what's (3 + 5) x 12?and:
what is the weather in California?MCP Tools
Math Server
Defined in mathserver.py.
add(a: int, b: int) -> intAdds two numbers.
multiple(a: int, b: int) -> intMultiplies two numbers.
Weather Server
Defined in weather.py.
get_weather(location: str) -> strReturns a sample weather response for a given location.
Notes
mathserver.pyusestransport="stdio".weather.pyusestransport="streamable-http".In
client.py, the streamable HTTP transport is configured asstreamable_http.Make sure the weather server is running before executing
client.py.
Example Output
Math response: 96
Weather response: It's always raining in CaliforniaThis server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityCmaintenanceDemonstrates an MCP server with calculate and text_stats tools over Streamable HTTP, integrating with LangChain/LangGraph and n8n agents.Last updated
- Flicense-qualityDmaintenanceProvides math and weather tools accessible via LangGraph agent using MCP protocol with stdio and streamable HTTP transports.Last updated1
- Flicense-qualityDmaintenanceA collection of MCP servers demonstrating math operations, weather data, and LangGraph workflows.Last updated1
- Flicense-qualityCmaintenanceA calculator MCP server providing add and subtract tools, along with file resources and a code review prompt, supporting in-memory, HTTP, and STDIO transports. It also includes a LangGraph ReAct agent example that uses the tools.Last updated
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server exposing the Backtest360 engine API as tools for AI agents.
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/JayantPrakash/SampleMCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server