Skip to main content
Glama
JOBIN456

wikipedia

by JOBIN456

🚀 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.git
cd langchain-mcp-wikipedia

2. 仮想環境を作成する

Windows:

python -m venv venv
venv\Scripts\activate

Linux/macOS:

python3 -m venv venv
source venv/bin/activate

3. 依存関係をインストールする

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エージェントアーキテクチャ

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    B
    quality
    B
    maintenance
    A 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.
    22
    285
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A 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.
  • A
    license
    A
    quality
    C
    maintenance
    Enables 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.
    2
    3
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI agents to search, read, and explore Wikipedia articles via tools like summaries, categories, and random articles, with no API keys required.
    1
    MIT

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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