FastMCP Provider

FastMCP is a provider that enables direct tool execution through the Model Context Protocol (MCP). It provides a streamlined way to execute tools without complex workflow orchestration.

When to Use FastMCP

Use FastMCP when you:

  • Have MCP-compatible tools you want to execute
  • Need direct tool execution without AI workflow generation
  • Want to leverage the standardized MCP protocol
  • Are building integrations with existing MCP servers

Quick Start

1. Install Kubiya CLI

# Install Kubiya CLI
curl -fsSL https://raw.githubusercontent.com/kubiyabot/cli/main/install.sh | bash

# Set your API key
export KUBIYA_API_KEY="your-api-key"

2. Start MCP Server

# Start the Kubiya MCP server
kubiya mcp serve

3. Connect to MCP Server

# Test connection
kubiya mcp serve --test

# Or use with Claude Desktop
# Add to ~/.config/Claude/claude_desktop_config.json:
{
  "mcpServers": {
    "kubiya": {
      "command": "kubiya",
      "args": ["mcp", "serve"]
    }
  }
}

Available MCP Tools

The Kubiya MCP server provides 21+ enterprise-grade tools:

Core Execution Tools

execute_tool

Execute any containerized tool

kubectl get pods

execute_whitelisted_tool

Execute pre-approved tools

helm list

create_on_demand_tool

Build custom tools on-the-fly

python analyze_logs.py

execute_workflow

Run complete workflows

deploy-to-staging

Platform Management Tools

list_runners

List execution infrastructure

Show available runners

check_runner_health

Monitor system health

Health check all runners

find_available_runner

Auto-select optimal runners

Find best runner for task

list_agents

Discover AI agents

Show all agents

Knowledge & Security Tools

search_kb

Search organizational knowledge

Find documentation

list_kb

Browse documentation

Show knowledge base

list_secrets

View available credentials

Show secrets

list_integrations

See available integrations

Show integrations

Configuration

Basic Configuration

{
  "enable_runners": true,
  "allow_platform_apis": false,
  "enable_opa_policies": false,
  "verbose_logging": false
}

Enterprise Configuration

{
  "enable_runners": true,
  "allow_platform_apis": true,
  "enable_opa_policies": true,
  "verbose_logging": true,
  "whitelisted_tools": [
    {
      "name": "kubectl",
      "description": "Kubernetes CLI tool",
      "type": "docker",
      "image": "kubiya/kubectl-light:latest"
    }
  ]
}

Environment Variables

# Core configuration
export KUBIYA_API_KEY="your-api-key"
export KUBIYA_MCP_ENABLE_RUNNERS=true
export KUBIYA_MCP_ALLOW_PLATFORM_APIS=false

# Security
export KUBIYA_OPA_ENFORCE=true
export KUBIYA_MCP_REQUIRE_AUTH=true

# Logging
export LOG_LEVEL=INFO
export KUBIYA_MCP_VERBOSE=true

Usage Examples

Basic Tool Execution

# Ask your AI assistant:
"Use Kubiya to check the health of our Kubernetes cluster"

# The MCP server will execute:
# - kubectl get nodes
# - kubectl get pods --all-namespaces
# - kubectl top nodes

Infrastructure Operations

# Deploy application
"Deploy version 2.1.0 to staging using Kubiya"

# Database backup
"Create a backup of the production database"

# Log analysis
"Analyze the application logs for errors in the last hour"

Custom Tool Creation

# Create custom monitoring tool
"Create a tool that monitors disk space and sends alerts"

# Data processing
"Build a tool that processes CSV files and generates reports"

Integration Patterns

Claude Desktop Integration

{
  "mcpServers": {
    "kubiya": {
      "command": "kubiya",
      "args": ["mcp", "serve"],
      "env": {
        "KUBIYA_API_KEY": "your-api-key"
      }
    }
  }
}

Cursor IDE Integration

{
  "mcp.servers": {
    "kubiya": {
      "command": "kubiya",
      "args": ["mcp", "serve"],
      "env": {
        "KUBIYA_API_KEY": "your-api-key"
      }
    }
  }
}

Direct MCP Protocol

import asyncio
from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import StdioServerTransport

async def use_kubiya_mcp():
    server_params = StdioServerParameters(
        command="kubiya",
        args=["mcp", "serve"],
        env={"KUBIYA_API_KEY": "your-key"}
    )
    
    async with StdioServerTransport(server_params) as (read, write):
        async with ClientSession(read, write) as session:
            await session.initialize()
            
            # Execute a tool
            result = await session.call_tool(
                "execute_tool",
                {
                    "tool_name": "kubectl",
                    "args": {"command": "get pods"},
                    "runner": "auto"
                }
            )
            print(result.content)

asyncio.run(use_kubiya_mcp())

Security Features

OPA Policy Enforcement

# Enable policy enforcement
kubiya mcp serve --enable-opa-policies

Tool Whitelisting

{
  "whitelisted_tools": [
    {
      "name": "kubectl",
      "description": "Kubernetes commands",
      "type": "docker",
      "image": "kubiya/kubectl-light:latest"
    }
  ]
}

Authentication

# Require authentication
kubiya mcp serve --require-auth --session-timeout 3600

Monitoring and Logging

Debug Mode

# Enable verbose logging
kubiya mcp serve --verbose

# Or via environment
export LOG_LEVEL=DEBUG
kubiya mcp serve

Health Checks

# Test MCP server health
kubiya mcp serve --test

# Check runner health
kubiya runner health

Best Practices

  1. Security First

    • Always use API keys via environment variables
    • Enable OPA policies for production
    • Use tool whitelisting for restricted environments
  2. Performance

    • Use appropriate runners for different workloads
    • Monitor resource usage
    • Set reasonable timeouts
  3. Reliability

    • Implement proper error handling
    • Use health checks
    • Monitor execution logs

Troubleshooting

Common Issues

  1. Connection Failed

    # Check MCP server status
    kubiya mcp serve --test
    
    # Verify API key
    echo $KUBIYA_API_KEY
    
  2. Tool Execution Failed

    # Check runner availability
    kubiya runner list
    
    # Test with simple command
    kubiya tool execute --name "echo" --args "hello world"
    
  3. Permission Denied

    # Check tool whitelist
    kubiya mcp serve --list-tools
    
    # Verify API key permissions
    kubiya auth verify
    

Next Steps