Skip to main content
Glama
JOBIN456

wikipedia

by JOBIN456

🚀 FastAPI + FastMCP + LangChain Wikipedia 에이전트

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 통신

  • 🧩 추가 도구를 쉽게 지원할 수 있는 모듈식 아키텍처


🛠️ 기술 스택

기술

용도

Python

핵심 프로그래밍 언어

FastAPI

API/애플리케이션 레이어

FastMCP

MCP 서버 및 도구 구현

LangChain

LLM 및 도구 통합

LangGraph

에이전트 워크플로우

Requests

Wikipedia API 요청

Wikipedia REST API

외부 지식 소스


🔧 MCP 도구

FastMCP 서버는 두 가지 도구를 노출합니다.

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