ReActMCP Web Search

by mshojaei77

Integrations

  • Loads environment variables from a .env file for configuration, specifically used to store and access the EXA_API_KEY required for web searches

  • Integrates with the exa_py GitHub client to perform web searches via the Exa API

  • Formats web search results in Markdown to easily incorporate titles, URLs, and summaries into AI assistant responses

ReActMCP 웹 검색

ReActMCP 웹 검색은 웹 검색 기능을 AI 어시스턴트 프레임워크에 통합하는 MCP(모델 컨텍스트 프로토콜) 서버입니다. Exa API를 활용하여 기본 및 고급 웹 검색을 수행하고, 제목, URL, 게시일, 콘텐츠 요약을 포함한 마크다운 형식의 실시간 결과를 반환합니다.

이 저장소는 다양한 MCP 도구와 서버를 연결하여 AI 도우미에게 광범위한 기능을 제공하는 광범위한 ReActMCP 프로젝트의 일부입니다.


목차


특징

  • 기본 웹 검색 : Exa API를 사용하여 간단한 검색을 수행합니다.
  • 고급 웹 검색 : 도메인 제한, 텍스트 포함 요구 사항, 날짜 필터와 같은 추가 필터링 옵션을 사용하세요.
  • 마크다운 출력 : 검색 결과를 마크다운으로 포맷하여 제목, URL, 요약을 쉽게 통합합니다.
  • MCP 통합 : 다양한 도구에 대한 AI 지원을 위해 이 도구를 MCP 서버 생태계에 쉽게 추가하세요.

요구 사항

  • 파이썬 3.8 이상
  • 파이썬-dotenv
  • exa_py (Exa API 클라이언트)
  • MCP 프레임워크에 필요할 수 있는 기타 종속성

설치

  1. 저장소 복제지엑스피1
  2. 가상 환경 만들기(선택 사항이지만 권장됨)
    python -m venv venv source venv/bin/activate # On Windows use: venv\Scripts\activate
  3. 종속성 설치
    pip install -r requirements.txt

구성

환경 변수

프로젝트 루트 디렉토리에 다음 변수 이상을 포함하는 .env 파일을 만듭니다.

EXA_API_KEY=your_exa_api_key_here OPENAI_API_KEY=...

이 키는 Exa API가 웹 검색을 수행하는 데 필요합니다.

MCP 구성

MCP 구성 파일 mcp_config.json MCP 서버에서 사용할 수 있는 설정과 도구를 정의합니다. 구성 예시는 다음과 같습니다.

{ "websearch": { "script": "web_search.py", "encoding_error_handler": "ignore", "description": "Web search capability using Exa API that provides real-time internet search results. Supports both basic and advanced search with filtering options including domain restrictions, text inclusion requirements, and date filtering. Returns formatted results with titles, URLs, publication dates, and content summaries.", "required_env_vars": ["EXA_API_KEY"], "active": true }, "settings": { "model": "gpt-4o", "system_prompt_path": "system_prompt.txt" } }

기본 결과 수 등의 매개변수를 수정하거나 새로운 MCP 도구를 추가하여 이 구성을 개인화하거나 확장할 수 있습니다.

시스템 프롬프트

system_prompt.txt 파일은 AI 비서의 동작과 어조를 설정합니다. 이 파일은 이모티콘을 포함하여 친절하고, 매력적이며, 유익한 답변을 제공하도록 안내합니다. 예시 프롬프트는 다음과 같습니다.

You are a helpful, knowledgeable AI assistant with web search capabilities. Your goal is to provide accurate, comprehensive, and up-to-date information to users. Use lots of emojis and make your responses fun and engaging. ## Available Search Tools - `search_web`: Basic web search that returns results based on a query - `advanced_search_web`: Advanced search with filtering options for domains, required text, and date ranges ## Guidelines for Responding to Questions 1. For current information or facts that might have changed since your training data, use the appropriate search tool to find the most recent and relevant information. 2. Use `search_web` for general queries and `advanced_search_web` with appropriate filters for more specific needs. 3. Formulate precise search queries to maximize result relevance. 4. For recent information, use the `max_age_days` parameter in advanced search to limit results to recent publications. 5. When targeting specific sources, use the `include_domains` parameter to focus your search. 6. Cite sources by including URLs from search results. 7. For insufficient or contradictory results, acknowledge limitations and explain findings. 8. Break down complex topics into organized sections. 9. Provide balanced perspectives on controversial topics. 10. Be transparent about uncertainty rather than making up information. 11. Maintain a helpful, informative, and conversational tone. ## Response Quality Standards Your responses should be well-structured, factually accurate, and tailored to the user's level of understanding on the topic. Use the web search capabilities as your primary tools for accessing current information before responding to time-sensitive or factual queries.

원하는 보조자의 행동에 맞춰 시스템 프롬프트를 자유롭게 조정하세요.


용법

웹 검색 서버 실행

MCP 서버는 servers 디렉터리에 구현되어 있습니다. 서버를 실행하려면 다음을 실행하세요.

python servers/web_search.py

이 명령은 요청을 수신하고 다음 도구를 제공하는 MCP 서버를 시작합니다.

  • search_web : 기본적인 웹 검색을 수행합니다.
  • advanced_search_web : 필터링 옵션을 사용하여 고급 웹 검색을 수행합니다.

도구 테스트

web_search.py 내에는 검색 기능의 기본적인 사용법을 보여주는 테스트 함수 test_search() 제공됩니다(현재 주석 처리됨). 테스트 실행 블록의 주석 처리를 해제하고 Python의 asyncio 러너를 사용하여 이 테스트를 실행할 수 있습니다.

if __name__ == "__main__": import asyncio # Uncomment the following line to perform a test search # asyncio.run(test_search()) mcp.run()

이렇게 하면 샘플 쿼리에 대한 검색 결과가 인쇄되고 도구가 예상대로 작동하는지 확인하는 데 도움이 됩니다.


클로드 데스크톱 구성:

다음을 구성에 추가하여 Claude Desktop이 이 서버를 사용하도록 구성하세요.

{ "mcpServers": { "websearch": { "command": "python", "args": ["path/to/servers/exa_web_search.py"] } } }

문제 해결

  • EXA_API_KEY가 누락되었습니다. 유효한 Exa API 키로 .env 파일이 올바르게 설정되었는지 확인하세요.
  • 종속성 문제: 필요한 모든 Python 패키지가 설치되었는지 확인하세요( requirements.txt 파일 확인). 필요한 경우 패키지를 다시 설치하세요.
  • API 오류: 웹 검색 중 오류가 발생하면 네트워크 연결을 확인하고 Exa API 상태를 확인하세요.

특허

이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 라이선스 파일을 참조하세요.


기여하다

기여를 환영합니다! 제안, 버그 수정 또는 개선 사항이 있으시면 이슈를 개설하거나 풀 리퀘스트를 제출해 주세요.

ReActMCP 웹 검색으로 나만의 다용도 AI 비서를 만들어 보고, 코딩도 즐겁게 하세요! 🚀😊

스타 역사

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Exa API를 사용하여 실시간 웹 검색 기능을 AI 어시스턴트에 통합하는 MCP 서버로, 형식화된 마크다운 결과와 함께 기본 및 고급 검색 기능을 모두 제공합니다.

  1. Table of Contents
    1. Features
      1. Requirements
        1. Installation
          1. Configuration
            1. Environment Variables
            2. MCP Configuration
            3. System Prompt
          2. Usage
            1. Running the Web Search Server
            2. Testing the Tools
          3. Claude Desktop Configuration:
            1. Troubleshooting
              1. License
                1. Contributing
                  1. Star History
                    ID: 83o9on4ihz