WORKSHOP

J On the Beach

From Zero to Agentic Query in One Afternoon: Build a GraphQL API and Expose It to an LLM Agent via MCP

GraphQL · LLM · Java · Spring · API

In this hands-on workshop, you'll go from an empty project to a working GraphQL API that an LLM agent can discover and query on its own. No prior GraphQL experience required; basic Spring Boot knowledge is a hard requirement! We build incrementally with Spring for GraphQL: schema design, resolvers, relationships, solving the N+1 problem with DataLoaders, and adding field-level authorisation and validation so the API is safe to expose. Then comes the agentic turn. After a short primer on the Model Context Protocol (MCP), we wrap our API as an MCP server and connect a real LLM client. You'll watch an agent introspect the schema, compose its own queries, and return answers with no hand-written integration code, then add guardrails to keep it honest. You'll leave with a service you built yourself and the judgment to know when this approach is a good fit.

Key Takeaways

  • Working example of the pattern everyone is asking about right now: exposing your existing data to AI (APIs for AIs).
  • A solid working grasp of GraphQL fundamentals: schema design, resolvers, relationships, and the N+1 problem with DataLoaders.
  • Patterns to make GraphQL APIs safe to expose, using field-level authorisation and input validation.
  • A clear, practical understanding of what MCP is and why it matters for connecting APIs to AI agents.
  • The concrete pattern for exposing a GraphQL API as an MCP server so that an LLM agent can use it without hand-written integration code.
  • How to add basic agent guardrails: operation scoping and query limits.
  • The judgment to know when an agent-facing GraphQL API is the right architectural choice and when it isn't.

Target Audience

  • Java developers looking for a practical introduction to GraphQL and AI agent integration.
  • Backend and full-stack engineers interested in exposing existing services to LLMs.
  • Tech leads and architects evaluating GraphQL or agent-based integrations.
  • Developers with no prior GraphQL experience who want a hands-on, real-world example.

Requirements

  • A laptop with JDK 21 or later installed.
  • An IDE of choice (the workshop will use IntelliJ IDEA, but any Java IDE is suitable).
  • Git and Maven installed and configured.
  • An LLM client such as Claude Desktop.
  • Comfortable building and running basic Spring Boot applications.
  • Familiarity with Java, Maven, and Git workflows.
  • No prior GraphQL, AI, LLM, or MCP experience required.

Schedule

Workshop Plan

Introduction and GraphQL Fundamentals (30 min)

  • Why GraphQL and when to choose it over traditional APIs.
  • Core GraphQL concepts and terminology.
  • Designing the schema for the sample application.

Building a GraphQL API with Spring for GraphQL (80 min)

  • Creating schemas and resolvers using schema-driven development.
  • Modelling relationships between entities.
  • Solving the N+1 problem using DataLoaders.
  • Adding field-level authorisation and input validation.

Break (10 min)

Introduction to MCP and Agent Tooling (30 min)

  • Understanding the Model Context Protocol (MCP).
  • How AI agents discover and invoke tools.
  • MCP compared to traditional function calling approaches.

Exposing a GraphQL API Through MCP (80 min)

  • Wrapping the GraphQL API as an MCP server.
  • Connecting a live LLM client to the API.
  • Observing how agents introspect and query GraphQL schemas.
  • Implementing guardrails such as operation scoping and query limits.
  • Building a complete end-to-end AI-accessible API.

Wrap-up and Q&A (10 min)

  • When this architecture is the right choice.
  • Common pitfalls and limitations.
  • Next steps and further learning resources.