Skip to main content
Glama

Description

This boilerplate shows how to build a GraphRAG MCP server on Neo4j 5.22, using movie recommendation as the example. Movies, directors and genres are stored as a graph, and their embeddings from embeddinggemma live in the same database, so vector search and graph traversal run in a single query without a separate vector store. When a user asks for a movie in Korean, Gemma2 cleans up the request with query rewriting, vector search finds the closest matches, and the graph connects them to other films by the same director and to films that share the same topics. This gives the answer context that vector search alone cannot provide. Both HyDE and HyPE are included for the search step, so the two can be tested side by side.

Related MCP server: Kakao Map MCP Server

Graph

(:Person)-[:DIRECTED]->(:Movie)-[:HAS_GENRE]->(:Genre)
(:Question)-[:ABOUT]->(:Movie)
(:Movie)-[:HAS_KEYWORD]->(:Keyword)

Genres are separate nodes, so movies that share a genre are linked through the same node.

Keywords work the same way. Gemma2 picks 3-5 topic keywords for each movie, and movies that share two or more keywords are listed as similar movies. Keywords used by more than 20 movies, such as action or crime, are skipped because they work like genres. Chappie, for example, is linked to I, Robot through "robot" and "artificial intelligence", while the same director's District 9 is not.

  • HyDE : writes a fake plot for the request and compares it with movie plots

  • HyPE : compares the request with questions generated for each movie in advance (used by the MCP server)

HyDE matches plot against plot. HyPE matches question against question.

With 300 movies, HyPE put the right movies higher for requests about a subject or setting, such as a magic school or a prison escape. HyDE did better when the request reads like a plot, such as being stranded alone in space, but it needs one more Gemma2 call per request. The better choice depends on the data and on what users tend to ask, so test both before extending this.

Structure

app.js                      MCP server
lib/                        Neo4j driver, Ollama client, .env loader
services/
  recommend-hype.js
  recommend-hyde.js
ingest/
  hype.js                   builds the graph with plot and question indexes and keywords (HyPE)
  hyde.js                   builds the graph with the plot index and keywords (HyDE)
data/
  movies.csv
  questions.json            cached HyPE questions
  keywords.json             cached keywords

Run

ollama pull gemma2
ollama pull embeddinggemma
npm install
node ingest/hype.js
npm run inspect

Requires Neo4j 5.11+ and Ollama. Connection settings are in .env.

MCP

claude mcp add movie-rag -- node /path/to/GraphRAG-MCP-Boilerplate/app.js

The MCP server returns the matched movies with their directors' other works, similar movies and plots, and the client model such as Claude picks three and writes the recommendation. It uses HyPE by default. To use HyDE, import recommendHyde from services/recommend-hyde.js in app.js and call it instead of recommendHype.

Running ingest/hyde.js removes the question nodes' links, so run ingest/hype.js again before using the MCP server.

Example

Result

Note

  • The dataset ends in 2017.

  • Other works by the same director are listed because they share the director, not because their stories are similar.

  • The earlier version, without keywords and with Gemma2 writing the answer, is on the basic branch.

Available Tools

1 tool
recommend_movies영화 추천B

사용자가 원하는 분위기, 상황, 주제를 자연어로 받아 Neo4j 영화 그래프에서 영화 후보를 찾고, 같은 감독의 다른 작품과 주제가 비슷한 영화를 함께 돌려준다. 이 결과에서 3편을 골라 추천한다.

Inputs: query (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 1 tool

    Disambiguation4/5

    With only one tool there is no risk of misselection between tools. However, the single tool internally bundles several behaviors (natural-language candidate search, same-director lookup, thematic similarity, and final top-3 selection), so an agent cannot target a specific sub-capability.

    Naming Consistency5/5

    The sole tool name 'recommend_movies' follows a clear verb_noun snake_case convention and is descriptive of its action. There is no second name to conflict with, so consistency is trivially satisfied.

    Tool Count2/5

    A single monolithic tool that performs graph search, similarity traversal, ranking, and recommendation in one call is too coarse for the apparent scope. Splitting into search/related/recommend operations would give the agent meaningful control.

    Completeness2/5

    The surface offers only end-to-end recommendation; there is no way to look up a specific movie, list a director's filmography, filter by genre/theme, or inspect why a candidate was retrieved. Agents will hit dead ends when they need details or refinement beyond the initial three picks.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables local-first semantic search and retrieval of Korean Bible verses using FAISS embeddings and full-text indexes. Supports exploration of biblical entities including people, places, and events with Korean-to-English query handling.
      -
    • A
      license
      A
      quality
      D
      maintenance
      Provides location-based place recommendations in South Korea using the Kakao Map API, optimized for Korean language queries. Supports recommending various places like restaurants, shops, public facilities, and tourist attractions based on user queries.
      1
      16
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Automatically discovers vector indexes in a Neo4j database and exposes each as a semantic search tool with metadata pre-filtering, enabling natural language queries with dynamic filter support.
      2
      MIT