Free-AI Gateway MCP Server
⚡ Free-AI Gateway
엔터프라이즈급 기능 기반 라우팅 AI 게이트웨이 모노레포로, 무료 AI API를 재사용 가능한 라이브러리, Model Context Protocol (MCP) 서버, OpenAI 호환 HTTP 프록시로 집계합니다.
📚 Free-AI Gateway가 처음이신가요? 자세한 내용은 아키텍처 및 개발자 가이드 (LEARN.md) 에서 확인하세요. 심층 분석, 튜토리얼 및 통합 패턴이 포함되어 있습니다.
📖 아키텍처 및 모노레포 개요
free-ai-gateway 는 순수 AI 오케스트레이션 인프라를 프로토콜별 전달 메커니즘(HTTP Fastify 프록시 및 MCP 서버)과 분리하는 엔터프라이즈 모노레포로 구성되어 있습니다.
flowchart TD
subgraph CoreLayer ["@free-ai-gateway/core (Standalone npm package)"]
Router["CapabilityRouter & Strategy Engine"]
Providers["19 Provider Adapters & Dynamic Registry"]
Resilience["QuotaTracker & CircuitBreaker"]
Observability["EventBus & MetricsTracker"]
Transport["HttpClient with Exponential Backoff"]
end
subgraph Consumers ["Consumer Applications"]
GatewayApp["apps/gateway (@free-ai-gateway/gateway)<br/>Fastify HTTP OpenAI Proxy"]
McpApp["packages/mcp (@free-ai-gateway/mcp)<br/>Model Context Protocol Server"]
SkillsPkg["packages/skills (@free-ai-gateway/skills)<br/>Agentic IDE Skills & CLI"]
CliApp["packages/cli (@free-ai-gateway/cli)<br/>Terminal Assistant & Diagnostics"]
ClientApp["Custom Node.js / TypeScript App<br/>Direct Library Import"]
end
GatewayApp -->|consumes| CoreLayer
McpApp -->|consumes| CoreLayer
SkillsPkg -->|integrates with| CoreLayer
CliApp -->|consumes| CoreLayer
ClientApp -->|consumes| CoreLayer모노레포 워크스페이스 매트릭스
패키지 / 앱 | 위치 | 목적 | 의존성 |
|
| 프로토콜 중립 기능 라우터, 복원력 엔진, 19개 제공자 어댑터. |
|
|
| AI 에이전트(Claude Desktop, Cursor)에 기능 도구를 노출하는 Model Context Protocol 서버. |
|
|
| 에이전트 IDE 스킬( | 독립 실행형 CLI 및 API |
|
| 터미널 AI 어시스턴트, 대화형 채팅 REPL, 모델 카탈로그 및 진단 도구. |
|
|
| 자동 발견 기능을 갖춘 OpenAI 호환 엔드포인트를 제공하는 고처리량 Fastify HTTP 프록시. |
|
✨ 주요 기능
🎯 기능 기반 라우팅: 필요한 것을 요청하고(
model: "auto:tool_calling+structured_output"), 라우터가 가장 빠른 정상 무료 제공자를 선택하게 합니다.📐 전략 패턴 엔진: 플러그형 로드 밸런싱 전략(
AdaptiveHealthStrategy,LowestLatencyStrategy또는 사용자 정의IRoutingStrategy).🔄 자동 장애 조치: 업스트림
429(속도 제한) 또는5xx오류 발생 시 순위가 매겨진 후보 제공자를 투명하게 순회하여 성공할 때까지 전환합니다.🛡️ 차단기: 실패하는 제공자를 감지하고 지수적 백오프를 적용하여 연쇄 실패를 방지합니다.
⏱️ 슬라이딩 윈도우 할당량 추적: RPM, TPM, RPD의 인메모리 계정 관리 및 사전 제한 보호.
🔌 동적 제공자 자동 로더:
BaseProvider를 확장하는 클래스를packages/core/src/providers/에 추가하면 새 제공자를 추가할 수 있습니다.📡 타입 이벤트 버스: 수명 주기 이벤트(
request:start,request:success,request:fallback,provider:rate_limited)를 통해 OpenTelemetry 및 Prometheus 관측 가능성 제공.🤖 Model Context Protocol (MCP) 지원: Claude Desktop, Cursor 또는 에이전트 워크플로우에서 직접 사용 가능.
🧩 지원 제공자 매트릭스 (19개 어댑터)
제공자 | 모달리티 / 기능 | 인증 | 제한 범위 |
Google AI Studio |
|
| 모델별 |
Groq |
|
| 계정 |
SambaNova Cloud |
|
| 계정 |
NVIDIA NIM |
|
| 계정 |
Cohere |
|
| 계정 |
OpenRouter |
|
| 계정 |
OpenCode Zen |
|
| 계정 |
Bazaarlink.ai |
|
| 계정 |
aimlapi.com |
|
| 계정 |
OVHcloud AI |
|
| 모델별 |
Voyage AI |
|
| 계정 |
Jina AI |
|
| 계정 |
Hugging Face |
|
| 공유 풀 |
Cloudflare Workers AI |
|
| 공유 풀 |
Google Cloud Platform |
|
| 계정 |
MyMemory |
|
| 계정 |
Unstructured.io |
|
| 계정 |
Exa AI |
|
| 계정 |
Tavily |
|
| 계정 |
🚀 빠른 시작
1. 설치
# Clone the repository
git clone https://github.com/zaber-dev/free-ai-gateway.git
cd free-ai-gateway
# Install dependencies across all monorepo workspaces
npm install2. 환경 구성
.env.example을 .env로 복사하고 활성화할 제공자의 키를 입력하세요:
cp .env.example .envPORT=3000
GROQ_API_KEY=gsk_...
GOOGLE_API_KEY=AIza...
NVIDIA_API_KEY=nvapi-...
COHERE_API_KEY=...3. 빌드 및 실행
# Compile all workspace packages
npm run build
# Run all 31 automated tests across all packages
npm test
# Start the Fastify HTTP Gateway (Dev mode)
npm run dev
# Start the Gateway in Production
npm start💻 사용 방법
옵션 A: HTTP 게이트웨이 (OpenAI 호환)
OpenAI SDK 또는 curl로 로컬 프록시를 호출하세요:
curl http://localhost:3000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{
"model": "auto:tool_calling+structured_output",
"messages": [
{ "role": "user", "content": "Extract name and age from: Alice is 30 years old." }
]
}'import OpenAI from "openai";
const client = new OpenAI({
baseURL: "http://localhost:3000/v1",
apiKey: "not-needed",
});
const completion = await client.chat.completions.create({
model: "auto:reasoning",
messages: [{ role: "user", content: "Solve: How many r's in strawberry?" }],
});
console.log(completion.choices[0].message.content);옵션 B: TypeScript 라이브러리로 @free-ai-gateway/core 포함
HTTP 서버를 시작하지 않고 애플리케이션에 기능 라우터를 직접 포함하세요:
import {
CapabilityRouter,
Registry,
QuotaTracker,
CircuitBreaker,
EventBus,
LowestLatencyStrategy,
} from "@free-ai-gateway/core";
const registry = new Registry();
const quota = new QuotaTracker();
const breaker = new CircuitBreaker();
const eventBus = new EventBus();
// Listen to lifecycle telemetry
eventBus.on("request:fallback", (evt) => {
console.warn(`[Fallback] Failed on ${evt.attemptedProvider}: ${evt.error}`);
});
const router = new CapabilityRouter(
registry,
quota,
breaker,
undefined,
eventBus,
new LowestLatencyStrategy()
);
const response = await router.route({
capabilities: ["text", "tool_calling"],
payload: {
messages: [{ role: "user", content: "Hello AI!" }],
},
});
console.log("Served by:", response.servedBy);
console.log("Data:", response.data);옵션 C: Model Context Protocol (MCP) 서버
Free-AI Gateway를 Claude Desktop 또는 Cursor에 연결하세요:
{
"mcpServers": {
"free-ai-gateway": {
"command": "node",
"args": ["/path/to/free-ai-gateway/packages/mcp/dist/index.js"],
"env": {
"GROQ_API_KEY": "gsk_...",
"GOOGLE_API_KEY": "AIza..."
}
}
}
}노출된 MCP 도구:
freeai_generate: 자동 장애 조치로 텍스트, 추론 또는 코드 생성.freeai_search: Exa / Tavily를 통한 웹 검색 쿼리.freeai_embed: Voyage, Jina, Gemini를 통해 벡터 임베딩 생성.freeai_rerank: 검색 증강 생성(RAG)을 위한 문서 재순위화.freeai_analyze_image: 다중 모드 비전 분석.
옵션 D: 에이전트 IDE 스킬 (@free-ai-gateway/skils)
IDE 또는 자율 코딩 어시스턴트에 Frre-AI Gtaeway 에이전트 스킬 설치:
# Install to Google Antigravity (.agents/skills)
npx @free-ai-gateway/skills install --target=antigravity
# Install to Cursor (.cursor/skills)
npx @free-ai-gateway/skills install --target=cursor
# Install to Claude Code (.claude/skills)
npx @free-ai-gateway/skills install --target=claude
# Install to all supported AI assistants
npx @free-ai-gateway/skills install --target=all옵션 E: 터미널 CLI 도구 (@free-ai-gateway/cli)
터미널 또는 명령줄 스크립트에서 직접 Free-AI 사용:
# One-off prompt execution with auto-routing
npx @free-ai-gateway/cli "Explain MapReduce in simple terms"
# Interactive chat REPL in terminal
npx @free-ai-gateway/cli chat --capability=reasoning
# Check model catalog across all 19 providers
npx @free-ai-gateway/cli models
# Run system diagnostics
npx @free-ai-gateway/cli doctor🏛️ 모노레포 구조
free-ai-gateway/
├── packages/
│ ├── core/ # @free-ai-gateway/core
│ │ ├── AGENTS.md # Agentic guidelines for @free-ai-gateway/core
│ │ ├── src/
│ │ │ ├── capabilities/ # Capability definitions & parsing
│ │ │ ├── config/ # providers.json, schema, config sources
│ │ │ ├── errors/ # ProviderError, NoProviderAvailableError
│ │ │ ├── observability/ # EventBus, MetricsTracker
│ │ │ ├── providers/ # 19 Provider Adapters + Registry + Loader
│ │ │ ├── resilience/ # QuotaTracker, CircuitBreaker
│ │ │ ├── router/ # CapabilityRouter & Strategy Pattern
│ │ │ ├── transport/ # HttpClient with exponential backoff
│ │ │ ├── types/ # Unified contracts & response schemas
│ │ │ └── index.ts # Public Core API
│ │ ├── tests/ # 20 Core unit tests
│ │ └── package.json
│ │
│ ├── mcp/ # @free-ai-gateway/mcp
│ │ ├── AGENTS.md # Agentic guidelines for @free-ai-gateway/mcp
│ │ ├── src/
│ │ │ ├── tools/ # generate, search, embed, rerank, analyze-image
│ │ │ ├── resources/ # capabilities, models catalog
│ │ │ ├── server.ts # FreeAiMcpServer handler
│ │ │ └── index.ts
│ │ ├── tests/ # 3 MCP server tests
│ │ └── package.json
│ │
│ ├── skills/ # @free-ai-gateway/skills
│ │ ├── AGENTS.md # Agentic guidelines for @free-ai-gateway/skills
│ │ ├── src/
│ │ │ ├── skills/ # Built-in skills (free-ai-gateway, scaffolding, mcp)
│ │ │ ├── installer.ts # Multi-target installer
│ │ │ ├── cli.ts # CLI executable (free-ai-skills)
│ │ │ └── index.ts
│ │ ├── tests/ # 4 Skills tests
│ │ └── package.json
│ │
│ └── cli/ # @free-ai-gateway/cli
│ ├── AGENTS.md # Agentic guidelines for @free-ai-gateway/cli
│ ├── src/
│ │ ├── commands/ # prompt, chat, models, doctor, skills
│ │ ├── cli.ts # Argument parsing & dispatcher
│ │ ├── bin.ts # CLI executable (free-ai, freeai)
│ │ └── index.ts
│ ├── tests/ # 4 CLI tests
│ └── package.json
│
├── apps/
│ └── gateway/ # @free-ai-gateway/gateway (HTTP App)
│ ├── AGENTS.md # Agentic guidelines for @free-ai-gateway/gateway
│ ├── src/
│ │ ├── adapters/ # OpenAI chat response normalizer
│ │ ├── api/
│ │ │ ├── routes/ # Fastify route modules & RouteLoader
│ │ │ └── server.ts # Server factory, timing hooks, 404 handler
│ │ ├── jobs/ # Background JobScheduler & reverify worker
│ │ └── index.ts
│ ├── tests/ # 5 Gateway HTTP tests
│ ├── Dockerfile # Monorepo container builder
│ └── package.json
│
├── tests/
│ └── e2e/ # 5 Cross-package E2E integration tests
│
├── AGENTS.md # Monorepo Root Agentic Guidelines
├── CLAUDE.md # Claude Code Instructions
├── .agents/ # Workspace Skills Directory
├── .github/workflows/ci.yml # Matrix CI workflow
├── docker-compose.yml
├── package.json # Root workspace definition
├── tsconfig.base.json # Shared TypeScript compiler settings
└── README.md🤝 커뮤니티 및 거버넌스
📖 아키텍처 청사진: 내부 시스템 설계 및 데이터 흐름 심층 분석.
🎓 개발자 및 학습 가이드: 튜토리얼, 프로그래밍 방식 사용법, SDK 패턴.
🗺️ 제품 로드맵: 계획된 마일스톤, 분산 상태 및 예정된 기능.
💬 지원 가이드: 문제 해결, 커뮤니티 토론 및 도움 채널.
🏛️ 프로젝트 거버넌스: 의사 결정 프로세스, 관리자 역할 및 릴리스 정책.
✍️ 기여 가이드: 새 제공자 어댑터 추가 단계별 지침.
🔒 보안 정책: 취약점 공개 지침.
📜 행동 강령: 커뮤니티 기준 및 기대 사항.
👤 저자
❤️를 담아 Md. Mahedi Zaman Zaber 가 만들고 유지 관리합니다.
📄 라이선스
이 프로젝트는 오픈 소스이며 MIT 라이선스에 따라 사용 가능합니다.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Free public MCP for AI agents — 193 tools, 44 workflows. No API key.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/zaber-dev/free-ai-gateway'
If you have feedback or need assistance with the MCP directory API, please join our Discord server