kubearchive-mcp
A FastMCP server for querying, searching, and analyzing Kubernetes resources archived off-cluster with KubeArchive.
README
KubeArchive MCP Server
A powerful FastMCP server for interacting with KubeArchive - the utility that stores Kubernetes resources off-cluster for long-term inspection and analysis.
Overview
KubeArchive is a utility that stores Kubernetes resources off of the Kubernetes cluster, enabling users to delete those resources from the cluster without losing the information contained in those resources. This MCP server provides a comprehensive interface to query, search, and analyze your archived Kubernetes resources through natural language interactions with AI assistants.
Features
- 🔍 Search & Query: Find archived resources by namespace, kind, name, or text search
- 📊 Resource History: Track the lifecycle and changes of specific resources over time
- 📈 Statistics & Analytics: Get insights into job success rates, resource distributions, and more
- 📤 Export Capabilities: Export archived resources in YAML or JSON formats
- 🔌 Flexible Connectivity: Support for custom KubeArchive endpoints
- 🚀 FastMCP Integration: Built on FastMCP for high performance and easy integration
Installation
Using pip
pip install kubearchive-mcp
From Source
git clone https://github.com/your-org/kubearchive-mcp.git
cd kubearchive-mcp
pip install -e .
Configuration
Environment Variables
KUBEARCHIVE_ENDPOINT: KubeArchive API endpoint (default:http://localhost:8081)KUBEARCHIVE_TOKEN: Kubernetes service account token for authenticationMCP_TRANSPORT: Transport protocol -stdio,http, orsse(default:stdio)MCP_HOST: Host for HTTP/SSE transport (default:127.0.0.1)MCP_PORT: Port for HTTP/SSE transport (default:8000)MCP_PATH: Path for HTTP transport (default:/mcp)
Example Configuration
export KUBEARCHIVE_ENDPOINT="https://kubearchive.your-cluster.com"
export KUBEARCHIVE_TOKEN="your-service-account-token"
export MCP_TRANSPORT="stdio"
Usage
As a Standalone Server
# Using STDIO transport (recommended for MCP clients)
kubearchive-mcp
# Using HTTP transport
MCP_TRANSPORT=http MCP_PORT=8000 kubearchive-mcp
# With custom KubeArchive endpoint and authentication
KUBEARCHIVE_ENDPOINT="https://kubearchive.example.com" \
KUBEARCHIVE_TOKEN="your-token" \
kubearchive-mcp
With MCP Clients
Claude Desktop
Add to your Claude Desktop configuration:
{
"mcpServers": {
"kubearchive": {
"command": "kubearchive-mcp",
"env": {
"KUBEARCHIVE_ENDPOINT": "http://localhost:8081",
"KUBEARCHIVE_TOKEN": "your-service-account-token"
}
}
}
}
Other MCP Clients
Most MCP clients can connect using the STDIO transport. Refer to your client's documentation for configuration details.
Available Tools
Core Resource Management
list_archived_resources- List archived resources with filtering optionsget_archived_resource- Get detailed information about a specific resourcesearch_archived_resources- Search resources using query stringsget_resource_history- Get historical timeline of a specific resource
Export & Analysis
export_archived_resource- Export resources in YAML or JSON formatget_archived_jobs_summary- Get Job statistics and success rates
Configuration
configure_kubearchive_endpoint- Update the KubeArchive API endpointconfigure_kubearchive_token- Set the Kubernetes service account tokenconfigure_kubearchive_auth- Configure both endpoint and authenticationsetup_kubearchive_auth- Create complete Kubernetes RBAC setupgenerate_auth_setup_script- Generate shell script for authentication setupverify_kubearchive_permissions- Verify service account permissions
Available Resources
kubearchive://status- Check KubeArchive connection statuskubearchive://stats- Get basic statistics about archived resources
Natural Language Examples
This server is designed to work with natural language. Here are some example queries you can use with AI assistants:
Basic Queries
- "List all archived resources in the production namespace"
- "Show me the details of the archived resource with ID abc123"
- "Search for all failed jobs from last week"
Historical Analysis
- "Get the history of the user-service deployment in the production namespace"
- "Show me the timeline of all pods that were named batch-job-*"
Statistics & Reporting
- "Give me a summary of job success rates for the last 30 days"
- "What types of resources are most commonly archived?"
- "Show me statistics for the data-processing namespace"
Export Operations
- "Export the resource abc123 to a YAML file"
- "Save the configuration of the failed job xyz789 to /tmp/debug.yaml"
Configuration & Authentication
- "Set the KubeArchive endpoint to https://archive.my-cluster.com"
- "Configure authentication with my service account token"
- "Set up Kubernetes RBAC for kubearchive-view service account"
- "Check the current status of the KubeArchive connection"
- "Verify permissions for my service account"
API Integration
The server integrates with KubeArchive's REST API endpoints:
GET /api/v1/archived-resources- List resourcesGET /api/v1/archived-resources/{id}- Get specific resourceGET /api/v1/search- Search resources
Development
Requirements
- Python 3.10+
- FastMCP 2.0+
- Access to a running KubeArchive instance
Setting up Development Environment
# Clone the repository
git clone https://github.com/your-org/kubearchive-mcp.git
cd kubearchive-mcp
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
black .
ruff check .
mypy .
Project Structure
kubearchive_mcp/
├── __init__.py # Package initialization
├── main.py # CLI entry point
└── server.py # FastMCP server implementation
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Run the test suite (
pytest) - Run linting (
black . && ruff check . && mypy .) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Related Projects
- KubeArchive - The main KubeArchive project
- FastMCP - The FastMCP framework
- Model Context Protocol - The MCP specification
Support
Acknowledgments
- Thanks to the KubeArchive team for creating such a useful tool
- Thanks to the FastMCP team for the excellent framework
- Thanks to the broader Kubernetes community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。