Already have uv? Run uv self update to get the latest version.
3
Install Dependencies
Copy
Ask AI
# uv automatically creates .venv and installs all dependenciesuv sync
Or use the Makefile:
Copy
Ask AI
make install
No manual venv creation needed!uv sync automatically:
Creates .venv if it doesn’t exist
Installs all dependencies from pyproject.toml
Uses uv.lock for reproducible builds
4
Start Infrastructure
This starts OpenFGA, Jaeger, Prometheus, and Grafana:
Copy
Ask AI
docker compose up -d
Verify services are running:
Copy
Ask AI
docker compose ps
5
Setup OpenFGA
Initialize the authorization system:
Copy
Ask AI
python scripts/setup/setup_openfga.py
Save the output OPENFGA_STORE_ID and OPENFGA_MODEL_ID - you’ll need them next.
6
Configure Environment
Copy
Ask AI
cp .env.example .env
Edit .env with your values:
Copy
Ask AI
# Get free API key from https://aistudio.google.com/apikeyGOOGLE_API_KEY=your-api-key-here# From previous stepOPENFGA_STORE_ID=01HXXXXXXXXXXXXXXXXXXOPENFGA_MODEL_ID=01HYYYYYYYYYYYYYYYY# JWT secret (change in production!)JWT_SECRET_KEY=your-secret-key-change-in-production
import asynciofrom mcp import ClientSession, StdioServerParametersfrom mcp.client.stdio import stdio_clientasync def test_agent(): """Test the MCP agent with a simple query""" # Configure server server_params = StdioServerParameters( command="python", args=["-m", "mcp_server_langgraph.mcp.server_stdio"] ) # Connect to agent async with stdio_client(server_params) as (read, write): async with ClientSession(read, write) as session: # Initialize await session.initialize() # Send a message using the chat tool response = await session.call_tool( "chat", arguments={"message": "Hello! What can you help me with?"} ) print(response)## Run the testasyncio.run(test_agent())```bash```bash cURL## First, get a JWT token (in production, use proper auth)TOKEN=$(python -c "from mcp_server_langgraph.auth.middleware import AuthMiddleware; from mcp_server_langgraph.core.config import settings; auth = AuthMiddleware(secret_key=settings.jwt_secret_key); print(auth.create_token('alice'))")## Send a messagecurl -X POST http://localhost:8000/message \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ -d '{"query": "Hello! What can you help me with?"}'
# Reinstall dependencies (uv recreates .venv if needed)uv sync# Verify Python is using .venvuv run python -c "import sys; print(sys.prefix)"# Or activate .venv manually if you prefer bare commandssource .venv/bin/activate # Linux/macOS.venv\Scripts\activate # Windows
Use uv run <command> to run commands without manual activation.