Skip to content

Commit a305357

Browse files
authored
Merge pull request #24 from krakend/docs/add-readmes-trial-license
docs: add missing READMEs and trial license info
2 parents b805a89 + 17beb41 commit a305357

File tree

5 files changed

+153
-3
lines changed

5 files changed

+153
-3
lines changed

ai_gateway/README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# KrakenD AI Gateway Examples
2+
3+
This repository contains practical examples demonstrating KrakenD's AI Gateway capabilities. Each example showcases different use cases and features for building production-ready AI gateways.
4+
5+
## Examples
6+
7+
### [LLM - Role-Based Multi-LLM Routing](./llm)
8+
9+
Demonstrates role-based routing to different AI providers (Gemini vs OpenAI) based on user authentication and JWT claims. This example shows how to build a unified API that routes requests to different LLM providers based on business logic.
10+
11+
**Key features**: JWT authentication, conditional backend routing, request/response templates, quota management per role
12+
13+
**Use case**: Organizations that need to route different user groups to different AI providers while maintaining a single API interface
14+
15+
---
16+
17+
### [RAG - Retrieval Augmented Generation](./rag)
18+
19+
Shows how to build a RAG server using KrakenD's sequential proxying capabilities. Integrates Weviate as a vector database and Gemini for both text embeddings and LLM responses.
20+
21+
**Key features**: Sequential backend calls, vector search integration, context-aware AI responses, request/response transformation
22+
23+
**Use case**: Applications that need to provide AI responses with context from a knowledge base or document repository
24+
25+
---
26+
27+
### [MCP - Model Context Protocol Server](./mcp)
28+
29+
Demonstrates KrakenD as an MCP server that aggregates multiple APIs (REST and GraphQL) to provide unified data access for AI agents. Combines country information from multiple sources with real-time weather data.
30+
31+
**Key features**: MCP protocol implementation, multi-API aggregation, data propagation between calls, JMESPath and Lua transformations
32+
33+
**Use case**: Providing AI agents with structured access to external tools and data sources through the MCP standard
34+
35+
---
36+
37+
### [LLM (Pre-2.11)](./llm.pre-2.11)
38+
39+
Legacy version of the role-based routing example for KrakenD versions before 2.11. Maintained for compatibility with older KrakenD installations.
40+
41+
**Key features**: Similar to the main LLM example but compatible with earlier KrakenD versions
42+
43+
**Use case**: Organizations running KrakenD versions prior to 2.11
44+
45+
## Common Prerequisites
46+
47+
All examples require:
48+
- Docker and Docker Compose
49+
- KrakenD Enterprise license (need a trial license? [Contact us](https://www.krakend.io/contact-sales/))
50+
51+
Some examples also require:
52+
- API keys for AI providers (Gemini, OpenAI)
53+
- Additional setup steps detailed in each example's README
54+
55+
## Getting Started
56+
57+
1. Choose an example that matches your use case
58+
2. Navigate to the example directory
59+
3. Follow the README instructions for that specific example
60+
4. Each example is self-contained and can run independently
61+
62+
## Resources
63+
64+
- [KrakenD AI Gateway Documentation](https://www.krakend.io/docs/enterprise/ai-gateway/)
65+
- [KrakenD Enterprise Documentation](https://www.krakend.io/docs/enterprise/)
66+
- [Extended Flexible Configuration](https://www.krakend.io/docs/enterprise/configuration/flexible-config/)

ai_gateway/llm.pre-2.11/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ An AI Gateway provides secure, scalable access to Large Language Models while ab
1919
### Prerequisites
2020

2121
- Docker and Docker Compose
22-
- KrakenD Enterprise license
22+
- KrakenD Enterprise license (need a trial license? [Contact us](https://www.krakend.io/contact-sales/))
2323
- API keys for Gemini and OpenAI
2424

2525
### Setup

ai_gateway/llm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ An AI Gateway provides secure, scalable access to Large Language Models while ab
2020
### Prerequisites
2121

2222
- Docker and Docker Compose
23-
- KrakenD Enterprise license
23+
- KrakenD Enterprise license (need a trial license? [Contact us](https://www.krakend.io/contact-sales/))
2424
- API keys for Gemini and OpenAI
2525

2626
### Setup

ai_gateway/mcp/README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# KrakenD AI Gateway: MCP Server Demo
2+
3+
This demo showcases KrakenD as an MCP (Model Context Protocol) server that provides unified access to multiple external APIs. It demonstrates how KrakenD can act as a tool provider for AI agents by aggregating REST and GraphQL endpoints into a single, AI-friendly interface.
4+
5+
An MCP server allows AI agents to access external tools and data sources through a standardized protocol. This example shows how KrakenD can orchestrate multiple API calls, transform data, and expose it as MCP tools.
6+
7+
## What This Demonstrates
8+
9+
**MCP Server Implementation**: KrakenD exposes an MCP endpoint that AI agents can use to retrieve comprehensive country information and weather data.
10+
11+
**Key capabilities**:
12+
- MCP server configuration with tool definitions
13+
- Sequential proxying to aggregate multiple APIs (REST + GraphQL)
14+
- Data propagation between backend calls
15+
- Response transformation using JMESPath and Lua
16+
- Unified response from heterogeneous data sources
17+
18+
## Quick Start
19+
20+
### Prerequisites
21+
22+
- Docker and Docker Compose
23+
- KrakenD Enterprise license (need a trial license? [Contact us](https://www.krakend.io/contact-sales/))
24+
25+
### Setup
26+
27+
1. Add your KrakenD Enterprise license as `LICENSE` in the root directory
28+
29+
2. Start services:
30+
```bash
31+
docker-compose up -d
32+
```
33+
34+
3. Test the MCP server by calling the endpoint:
35+
```bash
36+
curl -X POST http://localhost:8080/mcp \
37+
-H "Content-Type: application/json" \
38+
-d '{
39+
"jsonrpc": "2.0",
40+
"method": "tools/call",
41+
"params": {
42+
"name": "get_country_info",
43+
"arguments": {
44+
"country_code": "ES"
45+
}
46+
},
47+
"id": 1
48+
}'
49+
```
50+
51+
## How It Works
52+
53+
1. **MCP Tool Definition**: The `get_country_info` tool is defined with its input schema and workflow
54+
2. **Sequential Backend Calls**:
55+
- First: REST Countries API fetches geography, population, borders, and flag data
56+
- Second: GraphQL Countries API retrieves currency, languages, and emoji
57+
- Third: Open-Meteo Weather API gets current weather for the capital city
58+
3. **Data Propagation**: Capital coordinates from the first call are passed to the weather API
59+
4. **Response Aggregation**: All data is merged into a unified response using JMESPath
60+
5. **Lua Processing**: Custom Lua script flattens capital coordinates for easier access
61+
62+
## Configuration
63+
64+
The MCP server configuration is in `config/krakend/krakend.json`. Lua transformations are in `config/krakend/lua/`.
65+
66+
The MCP endpoint definition includes:
67+
- Server metadata (name, title, version, instructions)
68+
- Tool definitions with input schemas
69+
- Workflow configuration with backend orchestration
70+
71+
## Additional Features
72+
73+
**Sequential Proxying**: Demonstrates how to chain API calls and propagate data between them
74+
75+
**Multi-Protocol Aggregation**: Combines REST and GraphQL APIs in a single workflow
76+
77+
**Error Handling**: Returns error messages when tool execution fails
78+
79+
## Resources
80+
81+
- [KrakenD AI Gateway Documentation](https://www.krakend.io/docs/enterprise/ai-gateway/)
82+
- [MCP Server Configuration](https://www.krakend.io/docs/enterprise/ai-gateway/mcp/)
83+
- [Sequential Proxying](https://www.krakend.io/docs/endpoints/sequential-proxy/)
84+
- [GraphQL Integration](https://www.krakend.io/docs/backends/graphql/)

ai_gateway/rag/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This demo showcases a RAG server abstraction layer using KrakenD built-in capabi
1111
### Prerequisites
1212

1313
- Docker and Docker Compose
14-
- KrakenD Enterprise license
14+
- KrakenD Enterprise license (need a trial license? [Contact us](https://www.krakend.io/contact-sales/))
1515
- API key for Gemini
1616

1717
### Setup

0 commit comments

Comments
 (0)