Skip to main content

Overview

Run the complete MCP Server with LangGraph stack locally with Docker Compose for development and testing. Includes all services: agent, OpenFGA, OpenTelemetry, Jaeger, Prometheus, and Grafana.
Quick Setup: Get the full stack running in 2 minutes with one script.

Quick Start

One-Command Setup

This script will:
  1. Check prerequisites (Docker, Docker Compose)
  2. Create .env from template if needed
  3. Validate configuration
  4. Build and start all services
  5. Wait for health checks
  6. Display service URLs
All services running! Agent, OpenFGA, Jaeger, Prometheus, and Grafana are now available.

Manual Setup

1

Create .env file

Edit .env and add your API keys:
2

Start services

First build takes 2-3 minutes. Subsequent starts are under 30 seconds.
3

Verify health

Expected response:

Services

Agent API

Port: 8000Main MCP agent service with LangGraphhttp://localhost:8000

OpenFGA

Port: 8080 (API)Authorization service (Playground disabled)http://localhost:8080

Jaeger

Port: 16686Distributed tracing UIhttp://localhost:16686

Prometheus

Port: 9090Metrics collectionhttp://localhost:9090

Grafana

Port: 3001Visualization dashboardshttp://localhost:3001

PostgreSQL

Port: 5432OpenFGA databaseInternal use

Development Mode

Use development mode for hot reload and debugging:
Development features:
  • πŸ”„ Hot reload - Code changes restart server automatically
  • πŸ› Debug logging - LOG_LEVEL=DEBUG
  • πŸ“ Volume mounts - Local code mounted in container
  • πŸ” Debugger port - Port 5678 for debugpy

Hot Reload Example

Testing

Run Tests

Test Agent Endpoint

Configuration

Environment Variables

Configure via .env file:

Service URLs (Docker Compose)

Services communicate via Docker network:

Custom Configuration

Override settings with environment variables:

Observability

View Traces in Jaeger

1

Open Jaeger UI

2

Select Service

Choose mcp-server-langgraph from dropdown
3

Find Traces

Click β€œFind Traces” to see all requests with timing
4

Analyze

Click on trace to see:
  • LLM calls with prompts
  • Tool invocations
  • Timing breakdown
  • Error details

Prometheus Metrics

View metrics at http://localhost:9090:

Grafana Dashboards

Access at http://localhost:3001 (admin/admin): Pre-configured datasources:
  • Prometheus - Metrics
  • Jaeger - Traces
Create dashboards for:
  • Request volume and latency
  • Error rates
  • LLM token usage
  • System resources

OpenFGA Setup

Set up authorization model:

Common Commands

Troubleshooting

Check logs:
Common causes:
  • Missing API key in .env
  • Invalid API key
  • Port 8000 already in use
  • OpenFGA not ready
Solutions:
Symptom: Bind for 0.0.0.0:8000 failed: port is already allocatedSolution: Change ports in docker-compose.yml:
Symptom: Connection refused errorsCheck:
Solution: Ensure all services use networks: [observability]
Solutions:
  • Use BuildKit: DOCKER_BUILDKIT=1 docker compose build
  • Cache dependencies: Mount pip cache
  • Use lighter base images: Already using python:3.12-slim
Clean up:

Production Considerations

Docker Compose is not recommended for production. Use for development and testing only.
For production, use:
  • LangGraph Platform - Serverless, managed hosting
  • Cloud Run - Serverless GCP deployment
  • Kubernetes - Production-grade orchestration

Why Not Docker Compose in Production?

Next Steps

Setup OpenFGA

Configure authorization

Run Tests

Test your changes

Deploy to Cloud

Deploy to production

Monitoring

Set up observability

Ready to develop? Run ./scripts/setup/docker-compose-quickstart.sh to start coding!