Select Page

Blog

The Power of Model Context Protocol: Using Natural Language to Query GraphDB 

September 4, 2025
Reading Time: 10 min

How MCP enables you to query knowledge graphs using natural language instead of complex SPARQL syntax, demonstrated through practical examples

 

Knowledge graphs are useful for representing complex relationships between entities, but they’ve always required technical expertise. To query a graph database, you need to know SPARQL syntax, understand ontologies, and have deep technical knowledge.

Model Context Protocol (MCP) changes this. It lets you query GraphDB repositories using natural language instead of writing complex SPARQL queries. You can now ask questions in plain English and get meaningful results from your knowledge graphs, whether you’re a business analyst, researcher, or domain expert.

What is MCP and why does it matter?

MCP is an open protocol developed by Anthropic that standardizes how applications provide context to large language models (LLMs). It works like a USB-C port for AI applications. Just as USB-C provides a universal connection for devices to various peripherals, the protocol creates a consistent interface for connecting AI models to different data sources and tools. It offers a growing list of pre-built integrations and a standardized way to build custom ones. The protocol is open for anyone to implement and gives you the flexibility to change between different applications while keeping your context.

GraphDB runs an MCP server that enables compatible clients to perform semantic and structured queries against RDF repositories. The system uses Server-Sent Events for streaming communication, with a gateway facilitating connections between clients and the secured GraphDB server. This setup allows the protocol to maintain its structured message format while providing the streaming capabilities needed for complex graph queries.

When you use this combination, you can query complex knowledge graphs using natural language instead of learning SPARQL syntax. The protocol handles the complexity of translating your questions into appropriate graph operations while providing advanced search capabilities like similarity matching and semantic understanding. You also get access to complete relationship networks and metadata without needing to understand complex ontological structures.

MCP works with many modern development environments and AI tools like:

  • Windsurf: Advanced AI-powered development environment
  • Claude Desktop: Direct integration with Anthropic’s Claude AI
  • LM Studio: Local AI model management and deployment
  • Ollama: Streamlined local AI model operations
  • Visual Studio Code: Through extensions and integrations
  • Cursor: AI-first code editor with natural language capabilities

This broad compatibility means that you can use MCP to explore GraphDB repositories regardless of your preferred development environment.

From natural language to graph insights

Let’s explore how MCP transforms the GraphDB experience through practical examples using two different repositories: a Star Wars universe knowledge base and a corporate employee database (ACME Corp).

Star Wars universe exploration

Natural query: “What characters from the original trilogy have red eyes?”

Traditional SPARQL approach:

PREFIX voc: 
PREFIX rdfs: 

SELECT ?character ?name ?eyeColor ?film_count WHERE {
    ?character a voc:Character ;
               rdfs:label ?name ;
               voc:eyeColor "red" ;
               voc:film ?film .
    
    {
        SELECT ?character (COUNT(?film) as ?film_count) WHERE {
            ?character voc:film ?film .
            ?film a voc:Film .
        }
        GROUP BY ?character
    }
}
ORDER BY DESC(?film_count)
LIMIT 10

MCP-powered result: Through similarity search, MCP intelligently identifies that R2-D2 is the primary character with red eyes, appearing in 7 films including the original trilogy. The system provides rich context about the character, including multilingual labels, physical descriptions, and complete filmography. It also understands related concepts, so searching for “mechanical characters” would return R2-D2, C-3PO, and other droids without needing to specify exact attributes.

Corporate data exploration

Let’s look at a different scenario that focuses on how MCP expands the scope and depth of search results.

Natural query: “Find me software engineers who work at ACME”

MCP-powered result: Instead of writing complex queries to navigate job titles, roles, departments, and employee relationships, MCP understands your intent and returns comprehensive results. It finds direct matches with “Software Engineer” job titles and identifies related roles like Sales Engineers, Senior Software Developers, and Software Architects. The system also maps career progressions for employees who started as Junior Developers and advanced, while providing contextual information including department assignments, role histories, and biographical data.

Advanced search capabilities

MCP provides four different search mechanisms, each designed for specific types of queries and discovery patterns. These methods work together to help you find information whether you know exactly what you’re looking for or need to explore related concepts.

  • Full-text search (fts_search) is perfect for finding entities based on text content:
Query: "Luke Skywalker"
Returns: Complete character profile with relationships, films, physical attributes, and multilingual descriptions
  • Similarity search (similarity_search) uses semantic understanding to find related content:
Query: "Characters with mechanical parts"
Returns: R2-D2, C-3PO, Darth Vader (with cybernetic limbs), and other characters with artificial components
  • IRI discovery (iri_discovery_search) finds specific entities by name:
Query: "Jedi masters"
Returns: Yoda, Obi-Wan Kenobi, Mace Windu, and other Force-sensitive characters
  • Autocomplete search (autocomplete_iri_discovery_search) provides intelligent suggestions:
Query: "Ana..."
Returns: Anakin Skywalker, with suggestions for related characters

Example scenario: building a high-performance development team

Let’s look at a business scenario that shows how MCP’s similarity search works in practice.

Business context: The CTO of ACME Corp needs to assemble a specialized team for a critical new project — developing a next-generation real-time rendering engine. The project requires a unique combination of software architecture expertise and proven leadership experience.

Traditional approach problems:

  • HR databases only search by exact job titles
  • LinkedIn searches miss internal candidates
  • Manual resume reviews are time-intensive
  • Risk of overlooking qualified candidates with non-standard career paths

MCP Similarity Search in Action

Natural language query: “I need to find employees who have experience with software architecture and leadership roles for a new project team”

MCP’s intelligent response: The similarity search doesn’t just look for exact matches. It understands the semantic relationships between concepts like “software architecture,” “leadership,” “team building,” and “technical management.” The system analyzes employee biographies, career progressions, and role descriptions to find candidates who match the underlying requirements rather than just keywords.

Here are the top candidates it identified:

  1. Jesse V. Taylor, Development Manager
    • Why MCP selected them: Biography mentions “solid foundation in software architecture and product management” and “instrumental role in advancing projects”
    • Career journey: Software Architect → Product Manager → Development Manager, with key projects including Render Rocket Ultra and Plugin Pandemonium Marketplace
  2. Deborah Y. Brooks, Former Development Manager
    • Why MCP selected them: “seamlessly transitioned through key roles” and “technology leader”
    • Career progression: Team Lead → Software Architect → Product Manager → Development Manager, with over 8+ years of proven growth
  3. Laura Y. Rogers, Veteran Development Manager
    • Why MCP selected them: “strategic vision and technical expertise” with “various pivotal roles”
    • Experience: 15 years across Team Lead, Software Architect, Product Manager, and Development Manager roles, being “integral to the development of innovative products”

How semantic search outperforms keyword matching

Instead of just matching keywords, MCP understood the deeper connections between concepts. When it analyzed “Team Lead” roles, it recognized these indicate leadership experience. It connected “Software Architect” directly to the technical requirement. The system also identified that career progression demonstrates growth potential, and product management experience suggests strategic thinking ability.

As a result, MCP discovered hidden talent within the organization. The search revealed candidates like Linda F. Nguyen, whose biographies showed relevant experience despite not having explicit keywords in their job titles. This context-aware matching means the system can identify employees who “transitioned through key roles” and have “dedicated years” of experience, demonstrating both technical growth and organizational commitment.

The business impact is significant. This approach saves time — a 15-minute search replaces days of manual candidate review. Quality improves because you find 20+ qualified candidates with detailed justification for each selection. Risk decreases through a comprehensive view of each candidate’s technical journey and leadership evolution. Most importantly, it enables innovation by discovering internal talent that might otherwise be overlooked.

Expanding the search with follow-up queries

Once you have initial results, MCP allows you to refine and expand your search with additional natural language queries that build on the existing context

  • “Which of these candidates have worked on rendering or graphics projects?”
  • “Who has experience mentoring junior developers?”
  • “Show me candidates who have successfully led cross-functional teams”

This approach transforms talent discovery from a keyword-matching exercise into semantic search that understands context, relationships, and the nuanced requirements of complex business needs.

The technical foundation: how MCP works

MCP uses GraphDB’s sophisticated similarity indexing capabilities to enable semantic search that goes far beyond simple keyword matching. GraphDB offers complete flexibility to create similarity indexes with any names you choose and can maintain multiple similarity indexes per repository to serve different use cases.

You can explicitly specify which similarity index within a repository should be used for a given “siilarity_search” natural language query. This flexibility makes it possible to maintain multiple indexes with different configurations and choose the most suitable one.

The system accomplishes this through coordinated operations working behind the scenes. These processes make natural language querying possible:

  • Flexible index configuration: GraphDB administrators can create multiple similarity indexes per repository, each optimized for different types of semantic search
  • Content vectorization: All textual content in the graph is converted to semantic vectors through the configured similarity indexes
  • Relationship mapping: Graph structures are preserved and enhanced with semantic understanding
  • Query processing: Natural language queries are analyzed and converted to appropriate graph operations using the specified similarity index
  • Result synthesis: Raw graph data is transformed into human-readable insights

Getting started with MCP

MCP changes how you work with knowledge graphs by removing the technical barriers that once limited access to complex data relationships. You can start asking natural language questions immediately, whether you’re exploring employee data, research connections, or any structured information in your GraphDB repository.

The setup process is straightforward — choose an MCP client that fits your workflow, connect it to your GraphDB instance, and begin querying. As you ask questions and refine your searches, you’ll discover patterns and connections that traditional database queries might miss. The technology handles the complexity behind the scenes, letting you focus on finding insights rather than writing code. The journey starts with a single question.

Ready to explore the infinite possibilities of knowledge graphs?