Skip to main content
Glama
MCP-Gemini-FileSearch

MCP-Gemini-FileSearch

by amsminn

MCP-Gemini-FileSearch

Google Gemini File Search API를 MCP(Model Context Protocol) 서버로 래핑한 도구입니다. ChatGPT, Claude Desktop 등 MCP 호환 클라이언트에서 문서 기반 RAG 검색을 사용할 수 있습니다.

Feature

  • Gemini File Search API MCP 래퍼 - MCP 호환 LLM 클라이언트에서 사용 가능

  • 파일 업로드 - 로컬 파일 & URL 자동 다운로드 지원

  • 자연어 검색 - 문서 내용 기반 RAG 검색

  • 인용 검증 - 특정 페이지 본문 조회 (get_passages)

  • 메타데이터 관리 - 제목, 저자, 연도, DOI, 태그, 출처 URL

  • 필터링 검색 - 연도 범위, 저자, 태그별 검색

Related MCP server: gemini-file-search-rag-mcp

Usage Example

Quick Start

1. API 키 발급

무료 API 키 받기: Google AI Studio에서 무료로 Gemini API 키를 발급받을 수 있습니다.

2. MCP 설정

Claude Desktop이나 다른 MCP 호환 클라이언트의 설정 파일에 다음을 추가하세요:

{
  "mcpServers": {
    "gemini-filesearch": {
      "command": "npx",
      "args": ["-y", "mcp-gemini-filesearch"],
      "env": {
        "GEMINI_API_KEY": "AIzaSyXXXXXXXXXXXXXXXX",
        "GEMINI_FILESTORE_NAME": "select-your-store-name"
      }
    }
  }
}

중요:

  • GEMINI_API_KEY: Google AI Studio에서 발급받은 무료 API 키를 입력하세요

  • GEMINI_FILESTORE_NAME: 원하는 스토어 이름을 지정하세요 (예: "my-research", "논문모음", "technical-docs")

    • 같은 이름을 사용하면 이전에 업로드한 문서들을 계속 사용할 수 있습니다

    • 다른 이름을 사용하면 새로운 독립된 문서 저장소가 만들어집니다

Internal Tool Usage Example

create_file_store

{
  "display_name": "My Research Store"
}

add_document

Local file:

{
  "source": "/path/to/document.pdf",
  "metadata": {
    "title": "Attention Is All You Need",
    "authors": ["Vaswani", "Shazeer", "Parmar"],
    "year": 2017,
    "tags": ["transformer", "attention"]
  }
}

URL:

{
  "source": "https://arxiv.org/pdf/1706.03762.pdf",
  "metadata": {
    "title": "Attention Is All You Need",
    "year": 2017
  }
}
{
  "query": "What are the limitations of self-attention?",
  "top_k": 5
}
{
  "query": "neural network architectures",
  "top_k": 10,
  "filters": {
    "year_min": 2015,
    "year_max": 2023,
    "tags": ["transformer"]
  }
}

get_passages

retrival specific page

{
  "doc_id": "gemfile_abc123xyz",
  "page_spans": [
    { "start": 3, "end": 4 },
    { "start": 7, "end": 7 }
  ]
}

list_documents

{
  "page": 1,
  "page_size": 20,
  "filters": {
    "year_min": 2015,
    "tags": ["transformer"]
  }
}

delete_document

{
  "doc_id": "gemfile_abc123xyz"
}

Exception

  • FILE_TOO_LARGE: 파일 크기 초과

  • INVALID_FILE_TYPE: 지원하지 않는 형식

  • RATE_LIMITED: API 요청 제한 (자동 재시도)

Develop

npm install
npm run build
npm test
npm run lint

Project Structure

mcp-gemini-filesearch/
├── bin/cli.js           # CLI 진입점
├── src/
│   ├── server.ts        # MCP 서버
│   ├── tools/           # MCP 도구
│   └── lib/             # 핵심 라이브러리
├── tests/unit/          # 단위 테스트
├── manifest.json        # MCP 메타데이터
└── package.json

Requirement

  • Node.js ≥ 20

  • TypeScript 5.7

  • Model Context Protocol (MCP) 1.0

  • Google Gemini File Search API

  • Zod 3.23 (Validation)

  • Jest 29 (Unit Test)

라이선스

MIT License

참고

Available Tools

6 tools
add_documentA

Upload and index a document from local path or URL. Supports automatic URL download and SHA-256 deduplication.

Inputs: source (required), metadata.

create_file_storeA

Create a new Gemini File Search Store. You must create a File Store before uploading documents. The Store ID can be reused across sessions to maintain document collections.

Inputs: display_name.

delete_documentB

Remove a document from the file store by its document identifier.

Inputs: doc_id (required).

get_passagesA

Retrieve full text content of specific page ranges from a document for citation verification.

Inputs: doc_id (required), page_spans (required).

list_documentsA

List all indexed documents with pagination and optional filters. Returns document metadata including title, authors, year, and tags.

Inputs: page, filters, page_size.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables querying enterprise documents (DOCX, PDF, PPTX) using natural language, with hybrid search and MCP integration for Claude Desktop and other agents.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Enables document Q&A with grounded citations using the official Gemini File Search API. Upload documents, create stores, and ask questions that return exact passage citations.
      7
      10 npm
      2
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables semantic search across personal PDF paper collections with page-level citations, allowing users to query their library from any MCP-capable client.
      9
      -