360 Secure SkillHub
360 安全技能中心

API Integration for RedHat MCP

核心功能:安全集成外部API,实现认证、重试、超时、错误处理及日志,生成标准化可复用客户端模块。典型场景:系统需调用第三方REST/WebSocket API、需可复用客户端、需处理限流和临时故障。输入含API规格、认证方式等参数,输出为客户端模块路径、配置契约及使用示例,保障调用安全可靠。

mzfshark
mzfshark
热度 38.53
最近更新 2026-05-11 17:45:37
分类:开发依赖:代码执行 / 读写文件 / 内部调用大模型应用场景:API 集成 / 代码生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add api-integration-redhat
Metadata
name
api-integration
description
Integrate third-party APIs with auth, retries, timeouts, and logging.
metadata
{"author":"RedHat Dev","version":"1.0.0","owner":"RedHat Dev Agent","category":"fullstack"}

SKILL: api-integration

Purpose

Integrate external APIs safely (auth, retries, timeouts, error handling, logging) and expose them via a clean internal interface.

When to Use

  • A system must call a third-party REST/WebSocket API.
  • You need a reusable client module with predictable behavior.
  • You must handle rate limits and transient failures.

Inputs

  • api_spec (required, object|string): base URL, endpoints, schemas, rate limits.
  • auth_method (optional, enum: none|api_key|oauth|jwt|hmac).
  • secrets_source (optional, string): where tokens/keys come from (env/secret manager).
  • error_policy (optional, string): retry/backoff rules and non-retryable errors.

Steps

  1. Validate API contract and identify required headers/auth.
  2. Implement a client module:
    • explicit base URL
    • request timeouts
    • retry with bounded backoff (only for safe/idempotent calls by default)
    • rate limit handling
  3. Normalize errors into a stable internal shape.
  4. Add logging hooks (request id, endpoint, status, latency; never log secrets).
  5. Add tests:
    • mocked responses for determinism
    • at least one failure-path test

Validation

  • Secrets are sourced only from configuration (not hardcoded).
  • Retry policy is explicit and bounded.
  • Errors are deterministic and observable.

Output

  • Client module path(s)
  • Config/env contract
  • Usage example (internal call pattern)

Safety Rules

  • Do not paste tokens/keys into code or logs.
  • Do not rely on “best effort” network calls without timeouts.
  • Avoid curl | sh or ad-hoc install scripts as part of integration.

Example

Integrate “VendorAPI”:

  • api_spec: { base_url: "...", endpoints: ["/v1/items"] }
  • Output: src/integrations/vendor/client.ts with retries and mocked tests.