wikipedia
🚀 FastAPI + FastMCP + LangChain Wikipedia Agent
FastAPI、FastMCP、LangChain、LangGraph が連携して、モジュール式のツール使用型AIアプリケーションを構築する方法を示す、AI搭載のWikipediaリサーチエージェントです。
このプロジェクトは、MCP(Model Context Protocol)サーバーを通じてWikipediaの機能を公開し、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搭載のWikipediaリサーチ
🔌 Model Context Protocol(MCP)統合
⚡ FastAPIアプリケーション層
🧠 LangChainエージェント統合
🔄 LangGraph ReActエージェント
🔎 Wikipedia検索ツール
📄 Wikipediaページ取得ツール
🔗 MCPツール発見
📡 stdioベースのMCP通信
🧩 追加ツールを簡単にサポートできるモジュール式アーキテクチャ
🛠️ 技術スタック
Technology | Purpose |
Python | 中核プログラミング言語 |
FastAPI | API/アプリケーション層 |
FastMCP | MCPサーバーとツール実装 |
LangChain | LLMとツールの統合 |
LangGraph | エージェントワークフロー |
Requests | Wikipedia APIリクエスト |
Wikipedia REST API | 外部知識ソース |
🔧 MCPツール
FastMCPサーバーは2つのツールを公開します。
search_wikipedia
指定されたトピックについてWikipediaを検索します。
@mcp.tool
def search_wikipedia(query: str):
...例:
Search Wikipedia for Albert Einsteinエージェントは自動的に以下を呼び出すことを決定できます:
search_wikipedia("Albert Einstein")get_wikipedia_page
特定のWikipediaページのコンテンツを取得します。
@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この分離により、ツールはさまざまなAIアプリケーションやエージェント間で再利用可能になります。
📌 実証される主要コンセプト
このプロジェクトは以下の学習に役立ちます:
Model Context Protocol (MCP)
FastMCP
MCPサーバー
MCPクライアント
stdioトランスポート
LangChainツール統合
LangGraphエージェント
ReActエージェント
FastAPI
外部API統合
LLMツール呼び出し
モジュール式AIエージェントアーキテクチャ
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