BIG-IP MCP Server

BIG-IP MCP Server

Enables management of F5 BIG-IP load balancers through secure authentication and configuration queries. Supports multiple devices with token caching, allowing users to list virtual servers and device configurations through natural language.

Category
访问服务器

README

BIG-IP MCP Server

A Model Context Protocol (MCP) server for managing F5 BIG-IP devices. Built with FastMCP 2.0, this server provides tools to authenticate to BIG-IP load balancers and query virtual server configurations.

Features

  • Configuration-Based Credentials - Store BIG-IP credentials securely in a JSON config file
  • Multi-Device Support - Manage multiple BIG-IP devices from a single server
  • Token Caching - Automatically caches authentication tokens and reuses until expiry
  • Virtual Server Management - List all virtual servers with status and configuration
  • AS3 Management - Check, install, and upgrade F5 Application Services 3 Extension
  • SSL Flexibility - Support for self-signed certificates (common in lab environments)
  • Async/Await - Non-blocking I/O for responsive performance

Quick Start

  1. Install dependencies (see Installation section below)
  2. Create configuration file:
    cp bigip_config.example.json bigip_config.json
    
  3. Edit bigip_config.json with your BIG-IP device details
  4. Restart Claude Desktop to load the server
  5. Use the tools: Ask Claude to "list BIG-IP devices" or "list virtual servers on [device-name]"

Installation

Step 1: Create a Virtual Environment

Using venv (recommended for standard Python)

# Create virtual environment
python -m venv venv

# Activate on macOS/Linux
source venv/bin/activate

# Activate on Windows
venv\Scripts\activate

Using uv (recommended for modern Python projects)

# Create virtual environment with uv
uv venv

# Activate on macOS/Linux
source .venv/bin/activate

# Activate on Windows
.venv\Scripts\activate

Step 2: Install Dependencies

With virtual environment activated:

Using uv

uv pip install -r requirements.txt

Using pip

pip install -r requirements.txt

Step 3: Verification

Confirm FastMCP is installed:

fastmcp version

Note: Always activate your virtual environment before running the server or installing packages.

Running the Server

Important: Make sure your virtual environment is activated before running the server.

Method 1: Direct execution (stdio transport)

# Ensure venv is activated first
source venv/bin/activate  # or source .venv/bin/activate for uv

python server.py

Method 2: FastMCP CLI

Run with stdio transport (default for MCP):

# Ensure venv is activated first
source venv/bin/activate

fastmcp run server.py:mcp

Run with HTTP transport:

fastmcp run server.py:mcp --transport http --port 8000

Configuration

Creating Your Configuration File

  1. Copy the example configuration:

    cp bigip_config.example.json bigip_config.json
    
  2. Edit bigip_config.json with your BIG-IP devices:

    {
      "devices": {
        "prod-lb-01": {
          "ip_address": "10.1.1.10",
          "username": "admin",
          "password": "your-password",
          "verify_ssl": false,
          "description": "Production load balancer"
        },
        "lab-bigip": {
          "ip_address": "192.168.1.100",
          "username": "admin",
          "password": "admin",
          "verify_ssl": false,
          "description": "Lab environment"
        }
      }
    }
    
  3. Security Note: bigip_config.json is automatically excluded from git (.gitignore)

See CONFIGURATION.md for detailed configuration guide.

Available Tools

list_bigip_devices

List all configured BIG-IP devices from the configuration file.

Usage:

Show me the configured BIG-IP devices

Returns: List of device names, IP addresses, and descriptions

list_virtual_servers

List all virtual servers on a specific BIG-IP device.

Parameters:

  • device_name - Name of the device from config file (e.g., 'prod-lb-01')

Usage:

List virtual servers on prod-lb-01

Returns: Formatted list of virtual servers with status, destination, and configuration details

Features:

  • Reads credentials from configuration file (no passwords in chat!)
  • Automatically authenticates and caches token
  • Token reused for 19 minutes before re-authentication

manage_as3

Check, install, or upgrade F5 AS3 (Application Services 3 Extension) on BIG-IP devices.

Parameters:

  • device_name - Name of the device from config file (e.g., 'prod-lb-01')
  • action - Action to perform: "check" (default), "install", or "upgrade"
  • auto_install - Set to True to proceed with installation/upgrade (default: False)

Usage:

Check AS3 status on prod-lb-01
Install AS3 on lab-bigip
Upgrade AS3 on prod-lb-01

Returns: AS3 version information and installation/upgrade results

Features:

  • Automatically fetches latest AS3 version from GitHub
  • Downloads and uploads RPM to BIG-IP
  • Polls installation task until completion
  • Verifies installation after completion
  • Supports version comparison and upgrade recommendations
  • Two-step confirmation with auto_install parameter prevents accidental installations

Requirements:

  • AS3 installation requires admin account (not just administrator role)
  • Network access to GitHub for downloading RPM packages
  • BIG-IP 14.1+ recommended for AS3 3.50+

Resources

  • config://server - Server configuration and capabilities

Prompts

  • help_prompt() - Overview of server capabilities and usage

Usage with Claude Desktop

Add this server to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Recommended: Using the wrapper script (avoids permission issues)

{
  "mcpServers": {
    "bigip": {
      "command": "/Users/a.ganti/Documents/code/mcp-servers/big-ip/run_server.sh"
    }
  }
}

The wrapper script automatically handles virtual environment activation and works around macOS permission restrictions.

Alternative options (if you have permission issues):

<details> <summary>Option 1: Direct Python from virtual environment</summary>

{
  "mcpServers": {
    "bigip": {
      "command": "/Users/a.ganti/Documents/code/mcp-servers/big-ip/venv/bin/python",
      "args": ["/Users/a.ganti/Documents/code/mcp-servers/big-ip/server.py"]
    }
  }
}

</details>

<details> <summary>Option 2: FastMCP CLI from virtual environment</summary>

{
  "mcpServers": {
    "bigip": {
      "command": "/Users/a.ganti/Documents/code/mcp-servers/big-ip/venv/bin/fastmcp",
      "args": ["run", "/Users/a.ganti/Documents/code/mcp-servers/big-ip/server.py:mcp"]
    }
  }
}

</details>

Note: Update the paths above to match your actual installation directory. If using uv, change venv to .venv in the paths.

After updating the config, restart Claude Desktop to load the server.

Using the BIG-IP Tools

Example Interactions

List Available Devices:

Show me the configured BIG-IP devices

List Virtual Servers:

List virtual servers on prod-lb-01

Or more naturally:

Can you show me the virtual servers on the lab-bigip device?

Check Multiple Devices:

List virtual servers on prod-lb-01 and then on prod-lb-02

Check AS3 Status:

Check AS3 status on prod-lb-01

Install AS3:

Install AS3 on lab-bigip

Upgrade AS3:

Upgrade AS3 on prod-lb-01 if a newer version is available

Workflow

  1. First time: Create and configure bigip_config.json with your devices
  2. Check devices: Ask Claude to list available BIG-IP devices
  3. Query virtual servers: Specify the device name from your config
  4. Credentials: Read automatically from config file (no passwords in chat!)
  5. Subsequent requests: Authentication tokens cached for efficiency

BIG-IP Requirements

Network Access

  • The machine running this MCP server must have network access to the BIG-IP management interface (typically port 443/HTTPS)
  • Ensure firewall rules allow outbound HTTPS connections to your BIG-IP device

BIG-IP Configuration

  • BIG-IP must have iControl REST API enabled (enabled by default)
  • User account must have appropriate permissions to:
    • Authenticate via iControl REST
    • Read virtual server configurations (typically requires at least "Guest" role)

Supported Versions

  • BIG-IP version 12.0 or higher (for token-based authentication)
  • Tested with BIG-IP 13.x, 14.x, 15.x, 16.x, 17.x

SSL Certificates

  • For production BIG-IP devices with valid SSL certificates, set verify_ssl: true
  • For lab/dev environments with self-signed certificates, use verify_ssl: false (default)

Security Considerations

Credential Handling

  • Never hardcoded - Credentials are requested interactively via MCP's elicitation feature
  • Session-scoped caching - Credentials are cached only for the current MCP session
  • Token-based auth - Password is only sent during initial authentication; subsequent requests use tokens
  • Automatic expiry - Tokens expire after 19 minutes and are automatically refreshed

Best Practices

  1. Use dedicated service accounts with read-only permissions when possible
  2. Enable SSL verification (verify_ssl: true) for production environments
  3. Use the clear_bigip_credentials tool when switching between BIG-IP devices
  4. Ensure Claude Desktop has appropriate file permissions (see Troubleshooting)

Troubleshooting

Permission Errors with Virtual Environment

If you see errors like PermissionError: [Errno 1] Operation not permitted: '/path/to/venv/pyvenv.cfg':

  1. Use the wrapper script (recommended):

    {
      "mcpServers": {
        "bigip": {
          "command": "/Users/a.ganti/Documents/code/mcp-servers/big-ip/run_server.sh"
        }
      }
    }
    
  2. Grant Claude Desktop Full Disk Access:

    • Open System Settings → Privacy & Security → Full Disk Access
    • Add Claude and enable access
    • Restart Claude Desktop
  3. Or recreate the virtual environment:

    rm -rf venv
    python3 -m venv venv
    source venv/bin/activate
    pip install -r requirements.txt
    

BIG-IP Connection Issues

"Failed to connect to BIG-IP"

  • Verify network connectivity: ping <bigip-ip>
  • Verify HTTPS access: curl -k https://<bigip-ip>/mgmt/shared/authn/login
  • Check firewall rules allow outbound HTTPS (port 443)

"Authentication failed: 401"

  • Verify username and password are correct
  • Check user account is enabled in BIG-IP
  • Verify user has API access permissions

"SSL verification failed"

  • For self-signed certificates, set verify_ssl: false when prompted
  • For production, ensure BIG-IP has valid SSL certificate

"Failed to retrieve virtual servers: 403"

  • User account lacks permissions to read LTM configuration
  • Requires at least "Guest" role or custom role with ltm read permissions

Server Not Connecting

Check the Claude Desktop logs for errors. The wrapper script provides better error handling and environment isolation.

Development

Adding More Tools

To add additional BIG-IP management capabilities:

  1. Create a new async function using the @mcp.tool decorator
  2. Use ctx: Context parameter for logging and elicitation
  3. Reuse cached credentials from context state
  4. Follow the pattern in list_virtual_servers for authentication

Example:

@mcp.tool
async def list_pools(ctx: Context) -> str:
    """List all load balancing pools"""
    # Get cached credentials
    credentials = ctx.get_state("bigip_credentials")
    token = ctx.get_state("bigip_token")

    # Your implementation here
    ...

Extending Functionality

Additional F5 BIG-IP operations that could be added:

  • List pool members and their status
  • Query pool statistics
  • List iRules
  • Get SSL certificate information
  • Query virtual server statistics
  • List nodes and their availability

Documentation

  • FastMCP: https://gofastmcp.com
  • MCP Protocol: https://modelcontextprotocol.io
  • F5 BIG-IP iControl REST API: https://clouddocs.f5.com/api/icontrol-rest/
  • F5 LTM Virtual Server API: https://clouddocs.f5.com/api/icontrol-rest/APIRef_tm_ltm_virtual.html

License

This project is provided as-is for managing F5 BIG-IP devices via the MCP protocol.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选