Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问许可证需确认审计异常

cc-gateway-ai-proxycc 网关 aiAgent

Agent Skill

cc-gateway-ai-proxy 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

10,753

周安装

435

GitHub Stars

39

下载量

3,376
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:cc-gateway-ai-proxy(cc 网关 aiAgent)
来源仓库:https://github.com/aradotso/trending-skills
仓库路径:skills/cc-gateway-ai-proxy
安装命令:
npx skills add https://github.com/aradotso/trending-skills --skill cc-gateway-ai-proxy
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/aradotso/trending-skills --skill cc-gateway-ai-proxy

简介

cc-gateway-ai-proxy 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中围绕仓库状态、代码变更或协作事项进行整理。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装,需结合原始 README 核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

CC Gateway — AI API Identity Gateway

Skill by ara.so — Daily 2026 Skills collection.

CC Gateway is a TypeScript reverse proxy that sits between Claude Code clients and the Anthropic API. It normalizes 40+ device fingerprint dimensions (device ID, email, environment, RAM, headers, and system prompt content) to a single canonical identity, manages OAuth token refresh centrally, and prevents telemetry leakage from multi-machine setups.

Architecture Overview

Client (Claude Code + env vars + Clash)
  └─► CC Gateway (rewrite + auth inject + SSE passthrough)
        └─► api.anthropic.com (single canonical identity)

Gateway also contacts:
  platform.claude.com (OAuth token refresh only)

Three-layer defense:

LayerMechanism
Env varsRoute CC traffic to gateway, disable side channels
Clash rulesBlock any direct Anthropic connections at network level
GatewayRewrite all 40+ fingerprint dimensions in-flight

Installation

Prerequisites

  • Node.js 18+ or Docker
  • A machine that has previously logged into Claude Code (for OAuth token extraction)

Clone and Install

git clone https://github.com/motiful/cc-gateway.git
cd cc-gateway
npm install

Generate Identity and Tokens

# Create a stable canonical identity (device_id, email, env profile)
npm run generate-identity

# Create a bearer token for a specific client machine
npm run generate-token my-laptop
npm run generate-token work-desktop

Extract OAuth Token (from a logged-in machine)

# macOS — copies refresh_token from Keychain
bash scripts/extract-token.sh

Configure

cp config.example.yaml config.yaml

Edit config.yaml:

# config.yaml
identity:
  device_id: "GENERATED_DEVICE_ID"          # from generate-identity
  email: "canonical@example.com"
  platform: "darwin"
  arch: "arm64"
  node_version: "20.11.0"
  shell: "/bin/zsh"
  home: "/Users/canonical"
  working_directory: "/Users/canonical/projects"
  memory_gb: 16                              # canonical RAM value

oauth:
  refresh_token: "EXTRACTED_REFRESH_TOKEN"  # from extract-token.sh

clients:
  - name: my-laptop
    token: "GENERATED_CLIENT_TOKEN"
  - name: work-desktop
    token: "ANOTHER_CLIENT_TOKEN"

server:
  port: 8443
  tls: false                                 # true for production with certs

Starting the Gateway

# Development (no TLS, hot reload)
npm run dev

# Production build
npm run build && npm start

# Docker Compose (recommended for production)
docker-compose up -d

Docker Compose Example

# docker-compose.yml
version: "3.8"
services:
  cc-gateway:
    build: .
    ports:
      - "8443:8443"
    volumes:
      - ./config.yaml:/app/config.yaml:ro
    restart: unless-stopped
    environment:
      - NODE_ENV=production

Verification

# Health check
curl http://localhost:8443/_health

# Show before/after rewrite diff (requires client token)
curl -H "Authorization: Bearer YOUR_CLIENT_TOKEN" \
     http://localhost:8443/_verify

Client Machine Setup

On each machine running Claude Code, set these environment variables:

# ~/.bashrc or ~/.zshrc

# Route all Claude Code API traffic through the gateway
export ANTHROPIC_BASE_URL="https://gateway.your-domain.com:8443"

# Disable side-channel telemetry (Datadog, GrowthBook, version checks)
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1

# Skip browser OAuth — gateway handles authentication
export CLAUDE_CODE_OAUTH_TOKEN="gateway-managed"

# Authenticate to the gateway with the per-machine token
export ANTHROPIC_CUSTOM_HEADERS="Proxy-Authorization: Bearer YOUR_CLIENT_TOKEN"

Or use the interactive setup script:

bash scripts/client-setup.sh

Then just run claude — no login prompt required.

Clash Rules (Network-Level Blocking)

Add to your Clash configuration to block any direct Anthropic connections:

# clash-rules.yaml excerpt
rules:
  - DOMAIN,gateway.your-domain.com,DIRECT      # Allow your gateway
  - DOMAIN-SUFFIX,anthropic.com,REJECT          # Block direct API calls
  - DOMAIN-SUFFIX,claude.com,REJECT             # Block direct OAuth
  - DOMAIN-SUFFIX,claude.ai,REJECT              # Block Claude web
  - DOMAIN-SUFFIX,datadoghq.com,REJECT          # Block Datadog telemetry
  - DOMAIN-SUFFIX,statsig.com,REJECT            # Block feature flags

See clash-rules.yaml in the repo for the full template.

What Gets Rewritten

LayerFieldTransformation
Identitydevice_id→ canonical ID from config
Identityemail→ canonical email
Environmentenv object (40+ fields)→ entire object replaced
ProcessconstrainedMemory (physical RAM)→ canonical value
Processrss, heapTotal, heapUsed→ randomized in realistic range
HeadersUser-Agent→ canonical CC version string
HeadersAuthorization→ real OAuth token (injected)
Headersx-anthropic-billing-header→ canonical fingerprint
Prompt textPlatform, Shell, OS Version→ canonical values
Prompt text/Users/xxx/, /home/xxx/→ canonical home prefix
Leak fieldsbaseUrl→ stripped
Leak fieldsgateway provider field→ stripped

TypeScript Usage Examples

Custom Rewriter Extension

// src/rewriters/custom-field-rewriter.ts
import { RequestRewriter } from '../types';

export const customFieldRewriter: RequestRewriter = {
  name: 'custom-field-rewriter',

  rewriteBody(body: Record<string, unknown>, config: CanonicalConfig): Record<string, unknown> {
    // Strip any custom analytics fields your org adds
    const { __analytics, __session_debug, ...cleaned } = body as any;

    // Normalize any additional identity fields
    if (cleaned.metadata?.user_id) {
      cleaned.metadata.user_id = config.identity.device_id;
    }

    return cleaned;
  },

  rewriteHeaders(headers: Record<string, string>, config: CanonicalConfig): Record<string, string> {
    return {
      ...headers,
      'x-custom-client': 'canonical',
    };
  }
};

Programmatic Gateway Start

// scripts/start-with-monitoring.ts
import { createGateway } from '../src/gateway';
import { loadConfig } from '../src/config';

async function main() {
  const config = await loadConfig('./config.yaml');

  const gateway = await createGateway(config);

  gateway.on('request', ({ clientId, path }) => {
    console.log(`[${new Date().toISOString()}] ${clientId} → ${path}`);
  });

  gateway.on('rewrite', ({ field, before, after }) => {
    console.log(`Rewrote ${field}: ${before} → ${after}`);
  });

  gateway.on('tokenRefresh', ({ expiresAt }) => {
    console.log(`OAuth token refreshed, expires: ${expiresAt}`);
  });

  await gateway.listen(config.server.port);
  console.log(`Gateway running on port ${config.server.port}`);
}

main().catch(console.error);

Token Generation (Programmatic)

// scripts/provision-client.ts
import { generateClientToken, addClientToConfig } from '../src/auth';

async function provisionNewMachine(machineName: string) {
  const token = await generateClientToken(machineName);

  await addClientToConfig('./config.yaml', {
    name: machineName,
    token,
    created_at: new Date().toISOString(),
  });

  console.log(`Client token for ${machineName}:`);
  console.log(token);
  console.log('\nAdd to client machine:');
  console.log(`export ANTHROPIC_CUSTOM_HEADERS="Proxy-Authorization: Bearer ${token}"`);
}

provisionNewMachine(process.argv[2] ?? 'new-machine');

Key npm Scripts

CommandPurpose
npm run devStart with hot reload (development)
npm run buildCompile TypeScript to dist/
npm startRun compiled production build
npm testRun rewriter test suite (13 tests)
npm run generate-identityCreate canonical device profile
npm run generate-token <name>Create per-client bearer token

Common Patterns

Multiple Machines, One Identity

# On gateway server — generate once
npm run generate-identity
# → device_id: abc-123, email: canonical@proxy.local

# Provision each machine
npm run generate-token laptop-home    # → token-aaa
npm run generate-token laptop-work    # → token-bbb
npm run generate-token desktop        # → token-ccc

# All three machines present as the same device to Anthropic

Rotating the Canonical Identity

# Generate a new identity (e.g., after a suspected flag)
npm run generate-identity --force

# Update config.yaml with new device_id
# Restart gateway — all clients immediately use new identity
docker-compose restart cc-gateway

Checking for New Telemetry Fields After CC Updates

# After a Claude Code update, use _verify to diff
curl -H "Authorization: Bearer $TOKEN" \
     http://localhost:8443/_verify | jq '.unrewritten_fields'

# Monitor Clash logs for new endpoints
# Any REJECT hits on new domains = new hardcoded endpoints

Troubleshooting

claude still prompts for browser login

  • Ensure CLAUDE_CODE_OAUTH_TOKEN=gateway-managed is exported
  • Verify ANTHROPIC_BASE_URL points to your running gateway
  • Check gateway logs: docker-compose logs -f cc-gateway

401 Unauthorized from gateway

  • Confirm ANTHROPIC_CUSTOM_HEADERS contains Proxy-Authorization: Bearer <token>
  • Verify the token in config.yaml matches the one set in env var
  • Run curl -H "Authorization: Bearer $TOKEN" http://localhost:8443/_health

OAuth token expired

# Re-extract from a logged-in machine
bash scripts/extract-token.sh
# Paste new refresh_token into config.yaml
docker-compose restart cc-gateway

MCP servers bypassing gateway

MCP uses mcp-proxy.anthropic.com which ignores ANTHROPIC_BASE_URL. Add to Clash:

- DOMAIN,mcp-proxy.anthropic.com,REJECT

Requests reaching Anthropic directly (Clash not blocking)

  • Check Clash is running: clash -v
  • Verify rules are loaded: look for REJECT entries in Clash dashboard
  • Test: curl https://api.anthropic.com — should fail if Clash is active

Gateway rewrite not applying to a new field

After a Claude Code update, new telemetry fields may not be covered. Check /_verify for unrewritten_fields, then open an issue or add a custom rewriter (see Custom Rewriter Extension above).

Caveats

  • MCP servers — hardcoded endpoint, use Clash to block if not needed
  • CC updates — monitor Clash REJECT logs after every Claude Code update for new endpoints
  • Refresh token lifetime — if the OAuth refresh token expires, re-run extract-token.sh
  • ToS — do not use for account sharing; intended for managing your own devices under one subscription
  • Alpha — test with a non-primary account before production use

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.5%
按下载量换算1,131

Claude

30.69%
按下载量换算1,036

Cursor

16.82%
按下载量换算568

Gemini CLI

10.2%
按下载量换算344

安全审计

Gen Agent Trust Hub

未通过

Socket

可疑

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills