Skip to main content

Overview

Let’s send your first message to the MCP Server with LangGraph! This guide walks you through authentication, making a request, and understanding the response.
Before you start: Make sure you’ve completed the Quick Start and have the services running.

Prerequisites

Verify services are running:
All services healthy? Let’s make your first request!

Step-by-Step Tutorial

1

Get an Authentication Token

In production, obtain tokens through proper authentication flows (Keycloak OAuth2, etc.). See Authentication Guide.
2

Send Your First Message

3

Understanding the Response

The agent returns a structured JSON response:
string
The agent’s response text
string
Always "assistant" for agent responses
string
LLM model used (supports fallback to alternative models)
object
Token usage statistics:
  • prompt_tokens: Input tokens
  • completion_tokens: Output tokens
  • total_tokens: Sum of both
string
OpenTelemetry trace ID for debugging. View in Jaeger UI.
boolean
Whether user was authorized (OpenFGA check passed)
4

View Trace in Jaeger

Every request is traced end-to-end:
  1. Open Jaeger UI: http://localhost:16686
  2. Select service: mcp-server-langgraph
  3. Click “Find Traces”
  4. Click on your trace to see:
    • Request flow
    • LLM call with prompt
    • Authorization check
    • Response generation
    • Timing breakdown
View distributed traces in the Jaeger UI at http://localhost:16686 to see the full request flow.

Complete Example

Here’s a full working example:

Common Use Cases

Simple Q&A

Multi-Turn Conversation

Tool Usage

Streaming Responses

Error Handling

Authentication Errors

Solution: Get a new token or check token expiration.

Authorization Errors

Solution: Check OpenFGA permissions. See Authorization Guide.

Rate Limiting

Solution: Implement exponential backoff or reduce request rate.

Server Errors

Solution: Check trace in Jaeger, verify LLM API keys and quotas.

Best Practices

Testing Your Integration

Unit Tests

Integration Tests

Next Steps

Authentication

Learn about JWT and Keycloak authentication

Authorization

Configure fine-grained permissions

API Reference

Explore all API endpoints

Multi-LLM Setup

Configure multiple LLM providers

Congratulations! You’ve sent your first request to the MCP agent. Ready to build something amazing?