wikipedia
🚀 FastAPI + FastMCP + LangChain агент Википедии
ИИ-агент для исследования Википедии, демонстрирующий, как FastAPI, FastMCP, LangChain и LangGraph могут работать вместе для создания модульного ИИ-приложения, использующего инструменты.
Проект предоставляет возможности Википедии через MCP (Model Context Protocol) сервер и позволяет агенту LangChain/LangGraph автоматически обнаруживать и использовать эти инструменты.
🏗️ Архитектура
┌──────────────────────┐
│ User │
│ Natural Language │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ FastAPI │
│ Application API │
└──────────┬───────────┘
│
▼
┌──────────────────────┐
│ LangChain Agent │
│ LangGraph │
└──────────┬───────────┘
│
MCP Protocol
│
▼
┌──────────────────────┐
│ FastMCP │
│ MCP Server │
└──────────┬───────────┘
│
┌──────────┴───────────┐
▼ ▼
┌──────────────┐ ┌──────────────┐
│ Wikipedia │ │ Wikipedia │
│ Search │ │ Page │
└──────────────┘ └──────────────┘Related MCP server: MCP Wikipedia Server
✨ Возможности
🤖 Исследование Википедии на основе LLM
🔌 Интеграция Model Context Protocol (MCP)
⚡ Прикладной уровень FastAPI
🧠 Интеграция агента LangChain
🔄 Агент ReAct на LangGraph
🔎 Инструмент поиска по Википедии
📄 Инструмент получения страниц Википедии
🔗 Обнаружение инструментов MCP
📡 MCP-связь на основе stdio
🧩 Модульная архитектура, которая легко поддерживает дополнительные инструменты
🛠️ Технологический стек
Технология | Назначение |
Python | Основной язык программирования |
FastAPI | Слой API/приложения |
FastMCP | Реализация MCP-сервера и инструментов |
LangChain | Интеграция LLM и инструментов |
LangGraph | Рабочий процесс агента |
Requests | Запросы к API Википедии |
Wikipedia REST API | Внешний источник знаний |
🔧 Инструменты MCP
Сервер FastMCP предоставляет два инструмента.
search_wikipedia
Ищет в Википедии по заданной теме.
@mcp.tool
def search_wikipedia(query: str):
...Пример:
Search Wikipedia for Albert EinsteinАгент может автоматически решить вызвать:
search_wikipedia("Albert Einstein")get_wikipedia_page
Получает содержимое конкретной страницы Википедии.
@mcp.tool
def get_wikipedia_page(title: str):
...Пример:
Get the Wikipedia page for Artificial IntelligenceАгент может вызвать:
get_wikipedia_page("Artificial Intelligence")🔄 Как MCP работает в этом проекте
MCP-сервер запускается с помощью:
mcp.run(transport="stdio")Клиент LangChain подключается к MCP-серверу:
client = MultiServerMCPClient(
{
"wikipedia": {
"command": "python",
"args": ["server.py"],
"transport": "stdio",
}
}
)Затем клиент обнаруживает доступные инструменты MCP:
tools = await client.get_tools()Эти инструменты передаются агенту LangGraph:
agent = create_react_agent(
model,
tools
)Затем LLM может решить, какой инструмент использовать, на основе запроса пользователя.
⚙️ Установка
1. Клонируйте репозиторий
git clone https://github.com/YOUR_USERNAME/langchain-mcp-wikipedia.gitcd langchain-mcp-wikipedia2. Создайте виртуальное окружение
Windows:
python -m venv venv
venv\Scripts\activateLinux/macOS:
python3 -m venv venv
source venv/bin/activate3. Установите зависимости
pip install -r requirements.txt🔐 Переменные окружения
Создайте файл .env:
OPENAI_API_KEY=your_openai_api_key🧠 Почему MCP?
Традиционная интеграция инструментов часто тесно связывает LLM-приложение с отдельными API.
MCP предоставляет стандартизированный способ предоставления возможностей в виде инструментов.
LLM
│
▼
LangChain / LangGraph
│
▼
MCP Client
│
▼
MCP Server
│
├── Wikipedia
├── Search
├── Database
├── APIs
└── Custom ToolsТакое разделение делает инструменты переиспользуемыми в различных ИИ-приложениях и агентах.
📌 Ключевые демонстрируемые концепции
Этот проект полезен для изучения:
Model Context Protocol (MCP)
FastMCP
MCP-серверы
MCP-клиенты
транспорт stdio
интеграция инструментов LangChain
агенты LangGraph
агенты ReAct
FastAPI
интеграция с внешними API
вызов инструментов LLM
модульная архитектура ИИ-агента
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 Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol server that retrieves information from Wikipedia to provide context to LLMs, allowing users to search articles, get summaries, full content, sections, and links from Wikipedia.22285MIT
- FlicenseNot gradedqualityDmaintenanceA production-ready server that provides Wikipedia search and content retrieval tools through the Model Context Protocol, enabling AI assistants to search for articles, list sections, and retrieve specific content.
- AlicenseAqualityCmaintenanceEnables LLMs to search for keywords and fetch full page content from Wikipedia across various languages. It provides direct access to Wikipedia information through search and fetch tools.23MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI agents to search, read, and explore Wikipedia articles via tools like summaries, categories, and random articles, with no API keys required.1MIT
Related MCP Connectors
Real-time Amazon, WIPO & PACER data for AI agents — 19 tools via the MCP protocol.
Web research for agents: quality-scored Google search, webpage extraction, and deep research.
LLM-ready web search + instant answers + URL-to-clean-text fetch for agents and RAG.
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/JOBIN456/wikipedia-mcp-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server