AgentLayer MCP Server
Provides real-time AI infrastructure data including LLM costs, model benchmarks, API deprecations, quality scores, and agent spend tracking. Supports authentication, rate limiting, x402 micropayments, and Stripe billing.
README
AgentLayer MCP Server
A Model Context Protocol (MCP) server providing real-time AI infrastructure data via TypeScript + Hono on Cloudflare Workers.
Overview
AgentLayer MCP Server exposes 5 endpoints for AI agent consumption:
| Endpoint | Description |
|---|---|
/llm-costs |
Real-time LLM pricing data across providers |
/model-benchmarks |
Model performance benchmarks and comparisons |
/api-deprecations |
Track deprecated API versions and migration paths |
/quality-scores |
AI model quality scores with sentiment analysis |
/agent-spend |
Agent API spend tracking with x402 micropayment support |
Features
- Authentication: API key auth on all endpoints
- Rate Limiting: Configurable per-API-key limits
- Usage Logging: Full request/response logging
- Error Handling: Comprehensive error handling with meaningful responses
- x402 Micropayments: Native support for x402 payment protocol
- Stripe Billing: Subscription tiers (Starter $99/mo, Pro $299/mo, Scale $499/mo)
- Sentiment Analysis: Automated Reddit/HN scraping for model sentiment scores
Tech Stack
- Runtime: Cloudflare Workers
- Framework: Hono (lightweight, fast)
- Language: TypeScript
- Database: Neon Postgres (serverless)
- Payments: Stripe + x402 protocol
- Data Ingestion: Firecrawl API
Quick Start
Prerequisites
- Node.js 20+
- Cloudflare account
- Neon database
- Stripe account
- Firecrawl API key
Installation
npm install
Environment Setup
Copy .env.example to .env and configure:
cp .env.example .env
Required variables:
NEON_DATABASE_URL- Neon Postgres connection stringFIRECRAWL_API_KEY- Firecrawl API keySTRIPE_SECRET_KEY- Stripe secret keySTRIPE_STARTER_PRICE_ID- Stripe price ID for Starter tierSTRIPE_PRO_MONTHLY_PRICE_ID- Stripe price ID for Pro tierSTRIPE_SCALE_MONTHLY_PRICE_ID- Stripe price ID for Scale tier
Database Setup
# Apply schema to Neon
npx tsx scripts/setup-neon-db.ts
# Verify tables created
npx tsx scripts/verify-db.ts
Development
npm run dev
Deploy
npm run deploy
API Documentation
Authentication
All endpoints require an API key via header or query parameter:
X-API-Key: your-api-key
# or
?api_key=your-api-key
Endpoints
GET /llm-costs
Returns LLM pricing data.
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/llm-costs
GET /model-benchmarks
Returns model benchmark results.
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/model-benchmarks
GET /api-deprecations
Returns deprecated API versions.
curl -H "X-API-Key: your-key" https://your-worker.workers.dev/api-deprecations
GET/POST /quality-scores
Quality scores with optional sentiment refresh.
# 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
Log agent API spend with x402 micropayment support.
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-spend
GET /agent-spend
Retrieve agent spend records.
curl -H "X-API-Key: your-key" "https://your-worker.workers.dev/agent-spend?agent_id=agent-123"
MCP Hub Submission
This server implements the Model Context Protocol for AI agent integration. Submit to MCP Hub with:
- Server Name: agentlayer-mcp-server
- Description: Real-time AI infrastructure data (costs, benchmarks, deprecations, quality scores, spend tracking)
- Transport: HTTP with API key auth
- Repository: https://github.com/[org]/agentlayer-mcp-server
Architecture
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 Firecrawl
CI/CD
GitHub Actions workflow (.github/workflows/deploy.yml):
- Runs on push to
main - Type checks with TypeScript
- Deploys to Cloudflare Workers
Required GitHub secrets:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDNEON_DATABASE_URLFIRECRAWL_API_KEYSTRIPE_SECRET_KEYSTRIPE_STARTER_PRICE_IDSTRIPE_PRO_MONTHLY_PRICE_IDSTRIPE_SCALE_MONTHLY_PRICE_ID
License
MIT
Support
For issues and feature requests, please use the GitHub issue tracker.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。