Skip to content

krakend/mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

KrakenD MCP Server

Universal MCP server for KrakenD API Gateway configuration validation, security auditing, and intelligent configuration assistance.

License: Apache 2.0 Go Version MCP Protocol

Overview

KrakenD MCP Server is a Model Context Protocol server that provides intelligent assistance for KrakenD API Gateway configuration files. It works with any MCP-compatible AI assistant including Claude Code, VS Code, Cursor, Cline, and Zed.

Features

  • βœ… Configuration Validation - Version-aware validation with specific error messages
  • πŸ”’ Security Auditing - Comprehensive security analysis with actionable recommendations
  • 🎯 Feature Discovery - Browse 100+ KrakenD features with CE/EE compatibility
  • πŸ—οΈ Config Generation - Generate endpoints, backends, and complete configurations
  • πŸ“– Documentation Search - Full-text search through official KrakenD documentation
  • πŸ” Edition Detection - Automatic CE vs EE feature detection
  • ⚑ Flexible Configuration - Automatic detection and support for both CE and EE FC variants

Installation

Quick Start (Recommended)

Automatic installation with platform detection:

curl -sSL https://raw.githubusercontent.com/krakend/mcp-server/main/scripts/install.sh | bash

This script will:

  • βœ… Auto-detect your platform (macOS, Linux, Windows)
  • βœ… Download the correct binary
  • βœ… Verify checksums for security
  • βœ… Install to /usr/local/bin/
  • βœ… Create data directory at ~/.krakend-mcp/

Manual installation - Download pre-compiled binaries from GitHub Releases:

# macOS Apple Silicon
curl -L -o krakend-mcp-server https://github.com/krakend/mcp-server/releases/download/v0.6.1/krakend-mcp-darwin-arm64
chmod +x krakend-mcp-server
sudo mv krakend-mcp-server /usr/local/bin/

# macOS Intel
curl -L -o krakend-mcp-server https://github.com/krakend/mcp-server/releases/download/v0.6.1/krakend-mcp-darwin-amd64
chmod +x krakend-mcp-server
sudo mv krakend-mcp-server /usr/local/bin/

# Linux x64
curl -L -o krakend-mcp-server https://github.com/krakend/mcp-server/releases/download/v0.6.1/krakend-mcp-linux-amd64
chmod +x krakend-mcp-server
sudo mv krakend-mcp-server /usr/local/bin/

# Manually create data directory
mkdir -p ~/.krakend-mcp/{docs,search}

Configuration by Client

Claude Code (Recommended - Full Experience)

🌟 Best Experience: Use the KrakenD AI Assistant plugin for:

  • βœ… Automatic binary management
  • βœ… 4 proactive Skills (auto-activate)
  • βœ… 1 Architecture Agent
  • βœ… Zero configuration

Install plugin:

# In Claude Code
/plugin marketplace add krakend/claude-code-plugin
/plugin install krakend-ai-assistant

The plugin automatically downloads and configures the MCP server.


Claude Code (MCP Only - Manual Setup)

If you only want the MCP tools without Skills/Agent:

  1. Download the binary (see Quick Start above)

  2. Create or edit ~/.claude/mcp_settings.json:

{
  "mcpServers": {
    "krakend": {
      "type": "stdio",
      "command": "/usr/local/bin/krakend-mcp-server",
      "args": [],
      "description": "KrakenD configuration validation and assistance"
    }
  }
}
  1. Restart Claude Code

Tools available: All 10 MCP tools (validate, audit, generate, search docs, etc.)


Cursor

  1. Download the binary (see Quick Start above)

  2. Open Settings β†’ Features β†’ MCP Servers

  3. Add server configuration:

{
  "mcpServers": {
    "krakend": {
      "command": "/usr/local/bin/krakend-mcp-server",
      "args": []
    }
  }
}
  1. Restart Cursor

Usage: Use @krakend in chat to access KrakenD tools


VS Code (Native MCP Support)

⭐ Recommended for VS Code users - Uses built-in MCP support (GitHub Copilot Chat)

  1. Download the binary (see Quick Start above)

  2. Open Command Palette (Cmd+P on macOS, Ctrl+P on Windows/Linux)

  3. Type "Add MCP" and select the command

  4. Enter the path to the binary:

    /usr/local/bin/krakend-mcp-server
    

    Or if using local build:

    /Users/yourusername/path/to/mcp-server/build/krakend-mcp-darwin-arm64
    
  5. Server is immediately available in Copilot Chat

Usage:

  • Open GitHub Copilot Chat
  • The MCP tools are available in the chat context automatically
  • Ask questions like "validate this KrakenD config" or "search KrakenD docs for rate limiting"
  • The assistant will use the appropriate MCP tools automatically

Cline (VS Code Extension)

  1. Download the binary (see Quick Start above)

  2. Install Cline extension from VS Code Marketplace

  3. Open Cline Settings β†’ MCP Servers

  4. Add server:

{
  "krakend": {
    "command": "/usr/local/bin/krakend-mcp-server"
  }
}
  1. Restart VS Code

Usage: Cline automatically detects and uses MCP tools


Zed Editor

  1. Download the binary (see Quick Start above)

  2. Edit Zed settings (Cmd+, β†’ MCP):

{
  "mcp_servers": {
    "krakend": {
      "command": "/usr/local/bin/krakend-mcp-server"
    }
  }
}
  1. Restart Zed

Usage: Access via Zed's AI assistant


Standalone / CLI / Scripts

Use the server directly for CI/CD, scripts, or standalone tools:

# Validate config
echo '{"endpoint": "/api/users", ...}' | krakend-mcp-server validate

# Security audit
krakend-mcp-server audit --config krakend.json

# Search docs
krakend-mcp-server search "rate limiting"

# Check version
krakend-mcp-server --version

Configuration Comparison

Client Setup Difficulty Features Best For
Claude Code + Plugin ⭐ Easy (automatic) Full (MCP + Skills + Agent) Complete KrakenD assistance
VS Code (Native) ⭐⭐ Easy (Cmd+P β†’ Add MCP) MCP tools only VS Code + Copilot users
Claude Code (MCP only) ⭐⭐ Medium (manual config) MCP tools only Simple validation/generation
Cursor ⭐⭐ Medium MCP tools only Cursor users
Cline ⭐⭐ Medium MCP tools only Cline users
Zed ⭐⭐ Medium MCP tools only Zed users
Standalone CLI ⭐⭐⭐ Advanced Direct tool access CI/CD, scripts

Documentation System

KrakenD MCP Server includes an intelligent documentation search system powered by Bleve, a full-text search engine written in Go.

How It Works

Embedded Documentation (Offline-First)

  • Official KrakenD documentation is embedded directly in the binary during build
  • Pre-built search index included (~5.7MB)
  • Works completely offline - no internet required
  • Instant availability on first run

Local Documentation Updates

  • Use refresh_documentation_index tool to download latest documentation
  • Updated docs stored locally at ~/.krakend-mcp/docs/ and ~/.krakend-mcp/search/
  • Priority: Local (if exists) > Embedded (always available)
  • Manual refresh recommended every 7 days for latest features

Search Capabilities

  • Full-text search with relevance ranking
  • Context-aware results (shows surrounding text)
  • Supports complex queries (phrases, boolean operators)
  • Fast response times (milliseconds)
  • Works completely offline with embedded docs

Data Directory Structure

~/.krakend-mcp/
β”œβ”€β”€ docs/              # Downloaded documentation files
β”‚   β”œβ”€β”€ index.json     # Documentation metadata
β”‚   └── content/       # Markdown content files
└── search/            # Bleve search index
    └── *.bleve        # Index files

Storage Requirements

Binary Size:

  • MCP Server Binary: ~21 MB (includes embedded documentation and index)
  • No additional downloads required for basic functionality

Optional Local Storage (if using refresh_documentation_index):

  • Updated Documentation: ~2 MB
  • Updated Search Index: ~6 MB
  • Total Local: ~8 MB additional (stored in ~/.krakend-mcp/)

Manual Management

# Check if documentation is cached
ls ~/.krakend-mcp/docs/

# Clear cache (will re-download on next use)
rm -rf ~/.krakend-mcp/docs/ ~/.krakend-mcp/search/

# Manually refresh (via MCP tool)
# Use refresh_documentation_index tool from your MCP client

Privacy & Offline Use

  • Documentation is downloaded from official KrakenD sources only
  • No telemetry or tracking
  • After initial download, search works completely offline
  • No external requests during search operations

MCP Tools

The server exposes 10 specialized tools:

Validation & Security

Tool Description
validate_config Version-aware configuration validation with detailed error messages
audit_security Security audit with fallback (native β†’ Docker β†’ basic checks)
check_edition_compatibility Detect which KrakenD edition (CE or EE) a config requires

Feature Discovery

Tool Description
list_features Browse all KrakenD features with name, namespace, edition, and category
get_feature_config_template Get configuration templates with required/optional fields

Configuration Generation

Tool Description
generate_basic_config Generate complete KrakenD configuration from scratch
generate_endpoint_config Generate endpoint configuration with best practices
generate_backend_config Generate backend service configuration

Documentation

Tool Description
search_documentation Full-text search through KrakenD documentation (powered by Bleve)
refresh_documentation_index Update documentation cache (auto-runs if cache > 7 days old)

Usage Examples

Validate a KrakenD Configuration

# Via MCP client
validate_config --config krakend.json

# Returns:
# βœ… Configuration is valid for KrakenD v2.7
# Edition required: Community Edition (CE)

Security Audit

audit_security --config krakend.json

# Returns:
# πŸ” Security Audit Report
# ⚠️ High: Missing authentication on /api/admin endpoints
# ⚠️ Medium: CORS not configured
# βœ… Rate limiting configured correctly

Feature Discovery

# List all authentication features
list_features --category authentication

# Returns:
# - JWT Validation (CE) - Validate JWT tokens
# - API Key Auth (EE) - API key authentication
# - OAuth Client (CE) - OAuth 2.0 client flow

Generate Configuration

# Generate a new endpoint
generate_endpoint_config \
  --method GET \
  --path /api/users \
  --backend_url https://backend.example.com/users

# Returns complete endpoint config with best practices

Flexible Configuration Support

KrakenD MCP Server automatically detects and handles both CE and EE variants of Flexible Configuration:

  • CE: .tmpl files with env vars (FC_ENABLE=1)
  • EE: flexible_config.json behavioral file

No manual configuration needed - detection is automatic!

Supported Platforms

Pre-compiled binaries available for:

  • macOS (Intel & Apple Silicon)
  • Linux (x64 & ARM64)
  • Windows (x64)

Development

Prerequisites

  • Go 1.21+
  • KrakenD binary (optional, for native validation)
  • Docker (optional, for fallback validation)

Build from Source

Quick Build (with embedded docs):

git clone https://github.com/krakend/mcp-server.git
cd mcp-server
./scripts/build.sh
./build/krakend-mcp-server --version

Build Options:

./scripts/build.sh              # Build for current platform
./scripts/build.sh --all        # Build for all platforms (darwin, linux, windows)
./scripts/build.sh --platform=linux-amd64  # Build specific platform

Development Build (without embedded docs):

go build -o krakend-mcp-server
./krakend-mcp-server --version

The build script:

  1. Downloads official KrakenD documentation
  2. Indexes documentation with Bleve
  3. Embeds docs + index into binary
  4. Compiles cross-platform binaries

See CONTRIBUTING.md for development guidelines.

Version Compatibility

KrakenD Version MCP Server Version Status
2.0 - 2.7 0.6.1+ βœ… Full support
1.x - ⚠️ Limited support

Related Projects

  • KrakenD AI Assistant - Claude Code plugin with proactive Skills and Architecture Agent (uses this MCP server)
  • KrakenD - Ultra-performant open-source API Gateway

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AI Assistant       β”‚
β”‚  (Claude, Cursor,   β”‚
β”‚   Cline, etc.)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚ MCP Protocol (stdio)
           ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ KrakenD MCP Server  β”‚
β”‚                     β”‚
β”‚  β”œβ”€ Validation      β”‚
β”‚  β”œβ”€ Security Audit  β”‚
β”‚  β”œβ”€ Features        β”‚
β”‚  β”œβ”€ Generation      β”‚
β”‚  └─ Docs Search     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ KrakenD Knowledge   β”‚
β”‚                     β”‚
β”‚  β”œβ”€ Feature Catalog β”‚
β”‚  β”œβ”€ Edition Matrix  β”‚
β”‚  β”œβ”€ Documentation   β”‚
β”‚  └─ Best Practices  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Releases

New versions are automatically built and published to GitHub Releases when a new tag is pushed.

Binary naming convention: krakend-mcp-{OS}-{ARCH}

Examples:

  • krakend-mcp-darwin-arm64 (macOS Apple Silicon)
  • krakend-mcp-linux-amd64 (Linux x64)
  • krakend-mcp-windows-amd64.exe (Windows x64)

Development

Status

This project is in active development. Current status:

  • βœ… Core MCP server implementation
  • βœ… All 10 tools functional and tested
  • βœ… Cross-platform builds (macOS, Linux, Windows)
  • βœ… Embedded documentation with offline search
  • βœ… Automated testing suite with CI/CD (22% coverage, threshold: 20%)

Testing

Run the test suite:

# Run all tests
go test ./... -v

# Run tests with race detector (recommended)
go test ./... -race

# Run tests with coverage report
go test ./... -cover -coverprofile=coverage.out

# View coverage in browser
go tool cover -html=coverage.out

Current test coverage: 22% (minimum threshold: 20%)

What's tested:

  • Configuration validation logic
  • Feature namespace extraction and deduplication
  • Edition detection (CE vs EE)
  • Flexible Configuration detection
  • Documentation parsing and indexing
  • Data provider abstraction (interface pattern with mocks)

Future improvements:

  1. Integration tests for each MCP tool with real-world configs
  2. E2E tests for the complete MCP protocol flow
  3. Golden file tests for complex validation outputs
  4. Increase coverage to 50%+

Contributions welcome! See CONTRIBUTING.md for guidelines.

Building from Source

See the "Building from Source" section above for detailed build instructions.

Support

License

Apache 2.0 License - see LICENSE file for details.

Security

For security concerns, see SECURITY.md.


Made with ❀️ by KrakenD

Part of the KrakenD ecosystem - The fastest API Gateway with auto-generated documentation

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •