Skip to content

Commit 62ea45e

Browse files
committed
updates, embedding
Signed-off-by: Jason Madigan <jason@jasonmadigan.com>
1 parent 40f9684 commit 62ea45e

16 files changed

+222
-1748
lines changed

CLAUDE.md

Lines changed: 25 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ echo -e '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"202
270270

271271
## Current MCP Resources
272272

273-
The server provides 13 documentation resources:
273+
The server provides 13 documentation resources, fetched from upstream GitHub repos:
274274

275275
**Policy References:**
276276
- `kuadrant://docs/gateway-api` - Gateway API overview
@@ -279,19 +279,19 @@ The server provides 13 documentation resources:
279279
- `kuadrant://docs/tokenratelimitpolicy` - TokenRateLimitPolicy reference
280280
- `kuadrant://docs/authpolicy` - AuthPolicy reference
281281
- `kuadrant://docs/tlspolicy` - TLSPolicy reference
282-
- `kuadrant://docs/telemetrypolicy` - TelemetryPolicy reference (custom metrics labels)
282+
- `kuadrant://docs/telemetrypolicy` - TelemetryPolicy reference
283283
- `kuadrant://docs/kuadrant` - Kuadrant CR reference
284284
- `kuadrant://docs/authorino-features` - Authorino authentication/authorization features
285285

286286
**Extensions:**
287287
- `kuadrant://docs/planpolicy` - PlanPolicy extension (plan-based rate limiting)
288288

289-
**Examples & Guides:**
290-
- `kuadrant://examples/basic-setup` - Basic API setup example
291-
- `kuadrant://examples/production-setup` - Production deployment example
292-
- `kuadrant://troubleshooting` - Common issues and debugging
289+
**User Guides:**
290+
- `kuadrant://docs/secure-protect-connect` - Full walkthrough
291+
- `kuadrant://docs/simple-ratelimiting` - Simple rate limiting guide
292+
- `kuadrant://docs/auth-for-developers` - Auth for app devs and platform engineers
293293

294-
These are implemented in `resources.go` and can be updated via the documentation extraction scripts.
294+
Resources are fetched from raw.githubusercontent.com and cached for 15 minutes.
295295

296296
## Potential Enhancements
297297

@@ -317,83 +317,32 @@ Users can run directly without building:
317317
docker run -i --rm ghcr.io/jasonmadigan/kuadrant-mcp-server:latest
318318
```
319319

320-
## Updating Resource Documentation
320+
## Resource Documentation Architecture
321321

322-
Documentation is stored as markdown files in `docs/` and embedded into the binary at build time using Go's `//go:embed` directive.
322+
Documentation is fetched at runtime from upstream GitHub repos (raw.githubusercontent.com) and cached in memory for 15 minutes.
323323

324-
### Architecture
324+
### How It Works
325325

326-
```
327-
docs/ # Committed to git, embedded at build time
328-
├── gateway-api.md
329-
├── dnspolicy.md
330-
├── ratelimitpolicy.md
331-
├── authpolicy.md
332-
├── tlspolicy.md
333-
├── tokenratelimitpolicy.md
334-
├── kuadrant.md
335-
├── authorino-features.md
336-
├── telemetrypolicy.md
337-
├── planpolicy.md
338-
├── troubleshooting.md
339-
└── examples/
340-
├── basic-setup.md
341-
└── production-setup.md
342-
```
343-
344-
### Quick Update Process
345-
346-
```bash
347-
# 1. Extract latest docs from source repos
348-
./update-docs.sh
349-
350-
# 2. Review extracted content
351-
cat extracted-docs/extraction-summary.txt
352-
353-
# 3. Update markdown files in docs/ as needed
354-
# Compare with extracted-docs/ and update relevant content
355-
356-
# 4. Rebuild to embed changes
357-
go build -o kuadrant-mcp-server
358-
359-
# 5. Test
360-
echo -e '...' | ./kuadrant-mcp-server 2>/dev/null | jq '.result.resources[].uri'
361-
```
326+
1. When a resource is requested, the server fetches from the raw GitHub URL
327+
2. Content is cached in memory with a 15-minute TTL
328+
3. If fetch fails (network issues, etc.), a fallback with a link to docs.kuadrant.io is returned
329+
4. No local files to maintain - docs.kuadrant.io is the single source of truth
362330

363331
### Adding New Resources
364332

365-
1. Create markdown file in `docs/`
366-
2. Add mapping in `resources.go`:
333+
Add an entry to `resourceMapping` in `resources.go`:
334+
367335
```go
368-
"kuadrant://docs/newpolicy": {"docs/newpolicy.md", "NewPolicy Reference", "Description"},
336+
"kuadrant://docs/newpolicy": {
337+
url: "https://raw.githubusercontent.com/Kuadrant/kuadrant-operator/main/doc/reference/newpolicy.md",
338+
name: "NewPolicy Reference",
339+
description: "Description of the new policy",
340+
fallback: "# NewPolicy\n\nSee: https://docs.kuadrant.io/latest/kuadrant-operator/doc/reference/newpolicy/",
341+
},
369342
```
370-
3. Update embed directive if needed (for new subdirectories)
371-
4. Rebuild
372-
373-
### Key Files
374-
375-
- **`docs/`** - Markdown files for each resource (committed)
376-
- **`resources.go`** - Embed directive and resource mapping
377-
- **`update-docs.sh`** - Extracts docs from upstream repos
378-
- **`extracted-docs/`** - Temporary extraction output (git-ignored)
379343

380344
### Documentation Sources
381345

382-
The extraction script pulls from:
383-
1. **docs.kuadrant.io** - For mkdocs.yml configuration
384-
2. **kuadrant-operator** - Policy references and guides
385-
3. **authorino** - Authentication/authorization features
386-
387-
### Important: AuthConfig vs AuthPolicy Translation
388-
389-
When processing Authorino documentation, the `process-docs.go` script automatically translates:
390-
- `AuthConfig``AuthPolicy`
391-
- `authconfig``authpolicy`
392-
- `authconfigs``authpolicies`
393-
394-
This is because:
395-
- **AuthConfig** is used in standalone Authorino deployments
396-
- **AuthPolicy** is the Kuadrant equivalent (what users actually use)
397-
- They are functionally equivalent but AuthPolicy is the correct term in Kuadrant context
398-
399-
This translation is done automatically in the `extractKeyContent()` function in `process-docs.go`.
346+
Resources are fetched from:
347+
- **kuadrant-operator** - Policy references and user guides
348+
- **authorino** - Authentication/authorization features

README.md

Lines changed: 32 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -147,28 +147,26 @@ Or if running the binary directly:
147147

148148
## Available Resources
149149

150-
The MCP server provides comprehensive documentation and examples through resources:
151-
152-
### Documentation Resources
153-
- `kuadrant://docs/gateway-api` - Gateway API overview and Kuadrant integration
154-
- `kuadrant://docs/dnspolicy` - Complete DNSPolicy reference with examples
155-
- `kuadrant://docs/ratelimitpolicy` - RateLimitPolicy patterns and advanced usage
156-
- `kuadrant://docs/tokenratelimitpolicy` - TokenRateLimitPolicy for AI/LLM API management
157-
- `kuadrant://docs/authpolicy` - AuthPolicy authentication and authorization methods
158-
- `kuadrant://docs/tlspolicy` - TLSPolicy certificate management guide
159-
- `kuadrant://docs/telemetrypolicy` - TelemetryPolicy for custom metrics labels
160-
- `kuadrant://docs/kuadrant` - Kuadrant CR (operator configuration)
161-
- `kuadrant://docs/authorino-features` - Authorino authentication/authorization features
150+
Documentation is fetched from upstream GitHub repos (kuadrant-operator, authorino) and cached for 15 minutes. This keeps docs.kuadrant.io as the single source of truth.
151+
152+
### Policy References
153+
- `kuadrant://docs/gateway-api` - Gateway API overview
154+
- `kuadrant://docs/dnspolicy` - DNSPolicy reference
155+
- `kuadrant://docs/ratelimitpolicy` - RateLimitPolicy reference
156+
- `kuadrant://docs/tokenratelimitpolicy` - TokenRateLimitPolicy reference
157+
- `kuadrant://docs/authpolicy` - AuthPolicy reference
158+
- `kuadrant://docs/tlspolicy` - TLSPolicy reference
159+
- `kuadrant://docs/telemetrypolicy` - TelemetryPolicy reference
160+
- `kuadrant://docs/kuadrant` - Kuadrant CR reference
161+
- `kuadrant://docs/authorino-features` - Authorino features
162162

163163
### Extensions
164-
- `kuadrant://docs/planpolicy` - PlanPolicy for plan-based rate limiting (gold/silver/bronze tiers)
164+
- `kuadrant://docs/planpolicy` - PlanPolicy (plan-based rate limiting)
165165

166-
### Example Resources
167-
- `kuadrant://examples/basic-setup` - Simple API with rate limiting and API key auth
168-
- `kuadrant://examples/production-setup` - Full production setup with TLS, DNS, JWT auth
169-
170-
### Troubleshooting
171-
- `kuadrant://troubleshooting` - Common issues, debugging techniques, and solutions
166+
### User Guides
167+
- `kuadrant://docs/secure-protect-connect` - Full walkthrough
168+
- `kuadrant://docs/simple-ratelimiting` - Simple rate limiting guide
169+
- `kuadrant://docs/auth-for-developers` - Auth for app devs
172170

173171
Access these resources in Claude by asking questions like:
174172
- "Show me the Kuadrant rate limiting documentation"
@@ -829,40 +827,29 @@ rates:
829827
```
830828

831829

832-
## Updating Documentation
833-
834-
Documentation is stored as markdown files in `docs/` and embedded into the binary at build time using Go's `//go:embed` directive.
830+
## Documentation Architecture
835831

836-
### Quick Update
832+
Documentation is fetched at runtime from upstream GitHub repos and cached in memory for 15 minutes. This keeps docs.kuadrant.io as the single source of truth.
837833

838-
```bash
839-
# 1. Fetch latest docs from upstream repos
840-
./update-docs.sh
841-
842-
# 2. Review extracted content
843-
cat extracted-docs/extraction-summary.txt
834+
### How It Works
844835

845-
# 3. Update markdown files in docs/ as needed
846-
# Compare with extracted-docs/ and update
847-
848-
# 4. Rebuild to embed changes
849-
go build -o kuadrant-mcp-server
850-
```
851-
852-
### Architecture
853-
854-
- **`docs/`** - Markdown files for each resource (committed to git)
855-
- **`//go:embed`** - Files embedded into binary at build time
856-
- **Single binary** - No external files needed at runtime
836+
- Resources are fetched from `raw.githubusercontent.com` on first request
837+
- Content is cached in memory with 15-minute TTL
838+
- If fetch fails, a fallback with link to docs.kuadrant.io is returned
839+
- No local docs to maintain
857840

858841
### Adding New Resources
859842

860-
1. Create markdown file: `docs/newpolicy.md`
861-
2. Add mapping in `resources.go`:
843+
Add an entry to `resourceMapping` in `resources.go`:
844+
862845
```go
863-
"kuadrant://docs/newpolicy": {"docs/newpolicy.md", "NewPolicy Reference", "Description"},
846+
"kuadrant://docs/newpolicy": {
847+
url: "https://raw.githubusercontent.com/Kuadrant/kuadrant-operator/main/doc/reference/newpolicy.md",
848+
name: "NewPolicy Reference",
849+
description: "Description",
850+
fallback: "# NewPolicy\n\nSee: https://docs.kuadrant.io/...",
851+
},
864852
```
865-
3. Rebuild: `go build -o kuadrant-mcp-server`
866853

867854
## Releases and Versioning
868855

docs/authorino-features.md

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)