SampleMCP
SampleMCP
Простой проект на Python, демонстрирующий создание и подключение MCP-серверов с использованием FastMCP, адаптеров LangChain MCP, LangGraph и OpenAI.
Возможности
Математический MCP-сервер, использующий
stdioMCP-сервер погоды, использующий
streamable-httpMCP-клиент LangChain, подключающийся к нескольким MCP-серверам
Агент LangGraph ReAct, использующий инструменты MCP
Примеры вызовов инструментов для математических запросов и запросов о погоде
Related MCP server: Server MCP
Структура проекта
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.mdТребования
Python 3.12+
API-ключ OpenAI
Опционально: API-ключ Groq
Установка
Клонируйте репозиторий:
git clone https://github.com/JayantPrakash/SampleMCP.git
cd SampleMCPУстановите зависимости:
pip install -r requirements.txtИли с помощью uv:
uv syncПеременные окружения
Создайте файл .env в корне проекта:
OPENAI_API_KEY=your_openai_api_key
GROQ_API_KEY=your_groq_api_keyЗапуск MCP-серверов
1. Запуск сервера погоды
Сервер погоды использует streamable-http.
python weather.pyПо умолчанию он предоставляет MCP-эндпоинт по адресу:
http://localhost:8000/mcp2. Математический сервер
Математический сервер использует stdio и запускается клиентом автоматически через:
"command": "python",
"args": ["mathserver.py"],
"transport": "stdio"Запуск клиента
В отдельном терминале выполните:
python client.pyКлиент подключается к:
mathserver.pyчерезstdioweather.pyчерезstreamable_http
Затем он создает агента LangGraph ReAct и задает вопросы:
what's (3 + 5) x 12?и:
what is the weather in California?Инструменты MCP
Математический сервер
Определен в mathserver.py.
add(a: int, b: int) -> intСкладывает два числа.
multiple(a: int, b: int) -> intУмножает два числа.
Сервер погоды
Определен в weather.py.
get_weather(location: str) -> strВозвращает пример ответа о погоде для указанного местоположения.
Примечания
mathserver.pyиспользуетtransport="stdio".weather.pyиспользуетtransport="streamable-http".В
client.pyтранспорт streamable HTTP настроен какstreamable_http.Убедитесь, что сервер погоды запущен перед выполнением
client.py.
Пример вывода
Math response: 96
Weather response: It's always raining in CaliforniaTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
No tool schema history has been recorded yet.
This 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 Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for langchain documentation, generated by doc2mcp.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceDemonstrates an MCP server with calculate and text_stats tools over Streamable HTTP, integrating with LangChain/LangGraph and n8n agents.-
- FlicenseNot gradedqualityDmaintenanceProvides math and weather tools accessible via LangGraph agent using MCP protocol with stdio and streamable HTTP transports.1-
- FlicenseNot gradedqualityDmaintenanceA collection of MCP servers demonstrating math operations, weather data, and LangGraph workflows.1-
- FlicenseNot gradedqualityCmaintenanceA model-agnostic MCP server exposing example tools (add1, multiply2, greet) for learning purposes, working with any LLM through stdio transport.-
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