Skip to main content

Overview

The MCP Server with LangGraph uses YAML configuration files and environment variables for flexible, declarative configuration. This reference documents all configuration files and their options.

.env.example

Complete environment variable template for service configuration

ldap_mappers.yaml

LDAP/AD attribute mapping configuration

oidc_providers.yaml

OpenID Connect provider definitions

role_mappings.yaml

Keycloak to OpenFGA role mapping rules

.env.example

Complete environment variable template for configuring the MCP Server with LangGraph.

Location

Usage

Configuration Sections

Supported Providers:
  • google: Gemini (AI Studio or Vertex AI)
  • anthropic: Claude models
  • openai: GPT-4, GPT-3.5
  • azure: Azure OpenAI
  • bedrock: AWS Bedrock
  • ollama: Local models

Security Best Practices

NEVER commit .env files to version control! Always use .env.example as a template and add .env to .gitignore.
1

Generate Strong Secrets

2

Use Secrets Management

Production deployments should use:
  • Kubernetes Secrets
  • External Secrets Operator
  • Infisical (integrated)
  • HashiCorp Vault
  • AWS Secrets Manager
3

Environment-Specific Files


config/ldap_mappers.yaml

Defines how LDAP/Active Directory attributes map to Keycloak user attributes.

Location

Used By

Structure

Maps LDAP attributes to Keycloak user attributes.
Standard Mappings:
  • mailemail
  • givenNamefirstName
  • snlastName
  • displayNamedisplayName
  • departmentdepartment
  • titletitle
  • telephoneNumberphoneNumber
  • mobilemobilePhone
  • employeeNumberemployeeNumber
  • managermanager
Synchronizes LDAP groups to Keycloak groups.
Parameters:
  • groups_dn: Base DN for group search
  • group_name_attribute: Attribute containing group name (usually cn)
  • membership_attribute: Attribute listing group members (AD: member)
  • preserve_inheritance: Maintain group hierarchy
  • mode: READ_ONLY (groups managed in LDAP only)
Controls synchronization schedule and behavior.
Sync Types:
  • Full sync: Complete LDAP directory scan
  • Changed sync: Only changed users (requires USN changed attribute)
Maps LDAP groups to Keycloak roles.
Users in the LDAP group automatically get assigned the corresponding Keycloak role.

Customization

Default configuration works with AD. Common AD attributes:
  • sAMAccountName: Username
  • userPrincipalName: UPN (email-like)
  • distinguishedName: DN
  • memberOf: Group memberships

config/oidc_providers.yaml

Defines OpenID Connect identity provider configurations for federation.

Location

Used By

Structure

Each provider has:
  • Basic settings (alias, display name, enabled)
  • OIDC endpoints and credentials
  • Attribute mappers (claims → user attributes)
Keycloak has built-in support for:
Get credentials from Google Cloud Console
For Okta, Auth0, OneLogin, or custom OIDC providers:
Maps OIDC claims to Keycloak user attributes:
Standard OIDC Claims:
  • sub: Subject (unique ID)
  • email: Email address
  • given_name: First name
  • family_name: Last name
  • preferred_username: Username
  • picture: Profile picture URL
Account Linking:
  • AUTO: Automatically link to existing Keycloak account with same email
  • PROMPT: Ask user to confirm account linking
  • DISABLED: Always create new account
Sync Mode:
  • IMPORT: Import on first login
  • FORCE: Always update from IdP
  • LEGACY: Legacy behavior

config/role_mappings.yaml

Defines how Keycloak roles, groups, and attributes map to OpenFGA tuples.

Location

Purpose

Enables flexible, declarative authorization without code changes. Automatically creates OpenFGA tuples based on Keycloak user data.

Structure

Direct 1:1 mapping from Keycloak roles to OpenFGA relations:
Creates OpenFGA tuple:
Maps Keycloak group hierarchy to organizations/teams using regex:
Example:
  • User in /acme/engineering creates:
    • user:{id}, member, organization:acme
    • user:{id}, member, team:engineering
Grants permissions based on user attributes:
Supported Operators:
  • ==: Equals
  • !=: Not equals
  • in: Value in list
  • >=: Greater than or equal
  • <=: Less than or equal
Defines role inheritance:
Roles inherit all permissions from their children. Applied after all other mappings.

Application Order

Rules are applied in this order:
1

Simple Mappings

Process all simple role mappings first
2

Group Mappings

Apply group-based mappings with regex matching
3

Conditional Mappings

Evaluate conditions and create tuples
4

Hierarchies

Apply role inheritance
5

Deduplication

Remove duplicate tuples automatically

Examples

Keycloak:
  • Role: admin (realm role)
Creates OpenFGA Tuples:

Best Practices

Version Control

  • Commit .yaml config files to git
  • NEVER commit .env files
  • Use .env.example as template
  • Document custom configurations

Secrets Management

  • Use Infisical or Vault for production
  • Rotate secrets regularly
  • Use Kubernetes Secrets for deployment
  • Audit secret access

Environment Separation

  • Separate configs per environment
  • Different secrets per environment
  • Test config changes in staging
  • Use CI/CD for config deployment

Validation

  • Validate YAML syntax
  • Test regex patterns
  • Verify OIDC endpoints
  • Check LDAP connectivity

See Also