AgentLayer MCP Server
AgentLayer MCP 服务器
一个通过 TypeScript + Hono 在 Cloudflare Workers 上运行的模型上下文协议 (MCP) 服务器,提供实时 AI 基础设施数据。
概述
AgentLayer MCP 服务器为 AI 智能体提供了 5 个端点:
端点 | 描述 |
| 各提供商的实时 LLM 定价数据 |
| 模型性能基准测试与对比 |
| 跟踪已弃用的 API 版本及迁移路径 |
| 包含情感分析的 AI 模型质量评分 |
| 支持 x402 微支付的智能体 API 支出跟踪 |
Related MCP server: x402-api
功能特性
身份验证:所有端点均需 API 密钥验证
速率限制:可针对每个 API 密钥配置限制
使用日志:完整的请求/响应日志记录
错误处理:全面的错误处理,提供有意义的响应
x402 微支付:原生支持 x402 支付协议
Stripe 计费:订阅层级(入门版 $99/月,专业版 $299/月,规模版 $499/月)
情感分析:自动抓取 Reddit/HN 以获取模型情感评分
技术栈
运行时:Cloudflare Workers
框架:Hono(轻量、快速)
语言:TypeScript
数据库:Neon Postgres (无服务器)
支付:Stripe + x402 协议
数据摄取:Firecrawl API
快速入门
前置条件
Node.js 20+
Cloudflare 账户
Neon 数据库
Stripe 账户
Firecrawl API 密钥
安装
npm install环境配置
将 .env.example 复制为 .env 并进行配置:
cp .env.example .env必需变量:
NEON_DATABASE_URL- Neon Postgres 连接字符串FIRECRAWL_API_KEY- Firecrawl API 密钥STRIPE_SECRET_KEY- Stripe 密钥STRIPE_STARTER_PRICE_ID- 入门版的 Stripe 价格 IDSTRIPE_PRO_MONTHLY_PRICE_ID- 专业版的 Stripe 价格 IDSTRIPE_SCALE_MONTHLY_PRICE_ID- 规模版的 Stripe 价格 ID
数据库设置
# Apply schema to Neon
npx tsx scripts/setup-neon-db.ts
# Verify tables created
npx tsx scripts/verify-db.ts开发
npm run dev部署
npm run deployAPI 文档
身份验证
所有端点都需要通过 Header 或查询参数提供 API 密钥:
X-API-Key: your-api-key
# or
?api_key=your-api-key端点
GET /llm-costs
返回 LLM 定价数据。
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/llm-costsGET /model-benchmarks
返回模型基准测试结果。
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/model-benchmarksGET /api-deprecations
返回已弃用的 API 版本。
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/api-deprecationsGET/POST /quality-scores
获取质量评分,支持可选的情感数据刷新。
# Get scores
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/v1/quality-scores
# Trigger sentiment refresh
curl -H "X-API-Key: your-key" "https://your-worker.workers.dev/v1/quality-scores?refresh=true"POST /agent-spend
记录智能体 API 支出,支持 x402 微支付。
curl -X POST -H "X-API-Key: your-key" \
-H "Content-Type: application/json" \
-d '{"agent_id":"agent-123","model":"gpt-4","tokens_used":1500,"cost":0.045,"payment_receipt":"x402-receipt"}' \
https://your-worker.workers.dev/agent-spendGET /agent-spend
检索智能体支出记录。
curl -H "X-API-Key: your-key" "https://your-worker.workers.dev/agent-spend?agent_id=agent-123"MCP Hub 提交
此服务器实现了用于 AI 智能体集成的模型上下文协议。提交至 MCP Hub 时请使用:
服务器名称:agentlayer-mcp-server
描述:实时 AI 基础设施数据(成本、基准测试、弃用情况、质量评分、支出跟踪)
传输方式:带 API 密钥验证的 HTTP
架构
src/
├── index.ts # Main Hono app with all endpoints
├── routes/
│ └── v1-quality-scores.ts # Quality scores route with sentiment refresh
└── scrapers/
└── reddit-hn-sentiment.ts # Reddit/HN sentiment scraper via FirecrawlCI/CD
GitHub Actions 工作流 (.github/workflows/deploy.yml):
在推送到
main分支时运行使用 TypeScript 进行类型检查
部署到 Cloudflare Workers
必需的 GitHub Secrets:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDNEON_DATABASE_URLFIRECRAWL_API_KEYSTRIPE_SECRET_KEYSTRIPE_STARTER_PRICE_IDSTRIPE_PRO_MONTHLY_PRICE_IDSTRIPE_SCALE_MONTHLY_PRICE_ID
许可证
MIT
支持
如有问题或功能需求,请使用 GitHub 问题跟踪器。
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 Servers
- AlicenseAqualityDmaintenanceProvides access to real-time LLM pricing, speed metrics, and performance benchmarks for over 300 models from Artificial Analysis. It enables users to list, filter, and compare models based on costs, tokens per second, and intelligence indices.2378MIT
- AlicenseAqualityDmaintenanceMCP server for pay-per-call DeFi and crypto data via x402 micropayments on Base. 8 endpoints: token prices, TVL, funding rates, token security, gas tracker, whale monitoring, wallet profiling, and yield scanning.846MIT
- AlicenseAqualityFmaintenanceUnified AI compute API gateway for agents. Access 30+ services and 95+ models across 8 backends (Groq, Together AI, DeepInfra, Fireworks, Replicate, RunPod) with native x402 USDC payments, Stripe, and crypto top-up.5502MIT
- AlicenseAqualityCmaintenanceProvides AI agents with real-time AI ecosystem data (news, status, pricing, latency) and premium tools paid via USDC on Base, compatible with any MCP client.242561MIT
Related MCP Connectors
52 paid x402 API endpoints for AI agents — crypto, data, DeFi, market intelligence.
Pay-per-call x402 gateway: agent tools, OpenAI-compatible LLM, market data, RPC, security audits.
Live status, API pricing and rate limits for ChatGPT, Claude, Gemini, Cursor and 42+ AI tools.
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/ToddFisher42/agentlayer-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server