APIForge MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@APIForge MCP Server list my Yandex Metrika counters"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
APIForge MCP Server
MCP-сервер для интеграции API-сервисов с Hermes Agent и другими MCP-клиентами.
Зачем это нужно
Hermes Agent — это AI-агент, который работает с инструментами через MCP (Model Context Protocol). Но для работы с реальными API (Яндекс Метрика, Search Console и др.) нужен прослойка, который:
Генерирует инструменты автоматически из JSON-конфигов API
Управляет аутентификацией (API Key, OAuth 2.0)
Контролирует доступ — какие инструменты доступны агенту
Related MCP server: Enterprise MCP Gateway and Tool Registry
Архитектура
Hermes Agent (MCP Client)
│
MCP Server (Python SDK)
┌────┴────┐
│ Tools │ ← генерируются из JSON-конфигов
│ Auth │ ← API Key / OAuth 2.0
│ Access │ ← allow/deny по инструментам
└────┬────┘
│
HTTP (httpx)
│
┌────┴────┐
│ Yandex │
│ Google │
│ Custom │
└─────────┘Быстрый старт
# Установка
cd mcp-server
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
# Запуск (STDIO — для Hermes)
python -m apiforge_mcp.server
# Запуск (HTTP/SSE — удалённый доступ)
APIFORGE_TRANSPORT=sse python -m apiforge_mcp.serverКонфигурация
Конфиги API
Файлы в configs/ определяют доступные API и их параметры:
// configs/yandex_metrika.json
{
"base_url": "https://api-metrika.yandex.net",
"auth": { "type": "oauth" },
"resources": {
"counters_list": {
"path": "/management/v1/counters",
"method": "GET",
"description": "List all counters"
},
"counter_stat": {
"path": "/stat/v1/data",
"method": "GET",
"description": "Get statistics",
"parameters": {
"id": { "type": "integer", "required": true, "description": "Counter ID" },
"metrics": { "type": "string", "required": true, "description": "Metrics" }
}
}
}
}Добавление нового API: просто кладёте JSON-файл в configs/. Инструменты генерируются автоматически.
Контроль доступа
// configs/access.json
{
"default_role": "readonly",
"tools": {
"allow": ["*"],
"deny": ["secret_*"]
},
"service_tools": {
"yandex_metrika": {
"allow": ["yandex_metrika_*"],
"deny": []
}
}
}Уровни контроля:
Global — правила для всех инструментов
Service — правила для конкретного API
Tool — конкретный инструмент
Приоритет: Tool > Service > Global. Deny всегда побеждает Allow.
Переменные окружения
# Аутентификация
YANDEX_METRIKA_API_KEY=your_api_key
YANDEX_METRIKA_AUTH_PROVIDER=api_key # или oauth
# Контроль доступа
APIFORGE_DEFAULT_ROLE=readonly # readonly | readwrite | admin
YANDEX_METRIKA_ROLE=readwrite # роль для конкретного сервиса
# Сервер
APIFORGE_TRANSPORT=stdio # stdio | sse
APIFORGE_HOST=127.0.0.1 # для SSE
APIFORGE_PORT=8080 # для SSE
APIFORGE_CONFIGS_DIR=./configs # путь к конфигамИнтеграция с Hermes Agent
STDIO (локальный запуск)
# ~/.hermes/config.yaml
mcp_servers:
apiforge:
command: python
args: ["-m", "apiforge_mcp.server"]
env:
YANDEX_METRIKA_API_KEY: ${YANDEX_METRIKA_API_KEY}
APIFORGE_DEFAULT_ROLE: readonlyHTTP/SSE (удалённый доступ)
# ~/.hermes/config.yaml
mcp_servers:
apiforge:
url: http://your-server:8080/sse
headers:
Authorization: Bearer ${MCP_TOKEN}MCP Примитивы
Tools (инструменты)
Инструменты генерируются автоматически из конфигов:
Инструмент | Описание | Метод |
| Список счетчиков | GET |
| Статистика | GET |
| Цели | GET |
| Хосты | GET |
| Запросы | GET |
| Лог аудита | - |
| Список сервисов | - |
Resources (документация для ИИ)
Ресурс | Описание |
| Полное руководство по использованию |
| Документация по конкретному сервису |
| Документация по контролю доступа |
| Документация по аутентификации |
ИИ может читать эти ресурсы через resources/read для получения контекста.
Prompts (шаблоны для ИИ)
Промпт | Когда использовать |
| Запрос аналитических данных |
| Изучение доступных API |
| Диагностика проблем |
ИИ может загружать эти промпты через prompts/get для получения инструкций.
Тестирование
# Все тесты
pytest tests/ -v
# Линтер
ruff check src/ tests/Структура проекта
mcp-server/
├── configs/
│ ├── access.json # Правила доступа
│ ├── yandex_metrika.json # API Яндекс Метрики
│ └── yandex_search_console.json
├── src/apiforge_mcp/
│ ├── server.py # MCP сервер + динамическая генерация
│ ├── auth/
│ │ ├── manager.py # Менеджер аутентификации
│ │ ├── api_key.py # API Key провайдер
│ │ └── oauth.py # OAuth 2.0 провайдер
│ ├── access/
│ │ └── policy.py # Контроль доступа (roles + tools)
│ └── tools/
│ └── registry.py # Реестр инструментов
├── tests/
│ └── test_server.py # 32 теста
├── docs/
│ ├── adr/ # Architecture Decision Records
│ └── AI_REFERENCE.md # Справочник для ИИ
├── README.md # Основная документация
├── ARCHITECTURE.md # Архитектурные решения
├── CHANGELOG.md # История изменений
├── CONTRIBUTING.md # Как вносить вклад
├── SECURITY.md # Политика безопасности
├── RUNBOOK.md # Операционные процедуры
└── pyproject.tomlКлючевые решения
Динамическая генерация — инструменты создаются из JSON, не хардкодятся
APIForge как transport core — HTTP-запросы через httpx с retry
Многоуровневый контроль доступа — glob-паттерны на 3 уровнях
Асинхронность — все запросы async/await для производительности
Аудит — логирование всех вызовов и отказов
Available Tools
7 toolsget_audit_logC
Get the access audit log showing recent API calls and denials.
Inputs: limit. Returns: result
list_servicesA
List all configured API services and their available resources.
Inputs: no named parameters. Returns: result
yandex_metrika_counters_listA
List all Yandex Metrika counters
Inputs: no named parameters. Returns: result
yandex_metrika_counter_statC
Get statistics for a counter
Inputs: no named parameters. Returns: result
yandex_metrika_goalsC
List goals for a counter
Inputs: no named parameters. Returns: result
yandex_webmaster_hostsA
List all verified hosts
Inputs: no named parameters. Returns: result
yandex_webmaster_search_queriesC
Get search queries for a host
Inputs: no named parameters. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: audit log, service listing, Yandex Metrika operations (list counters, get stats, list goals), and Yandex Webmaster operations (list hosts, get search queries). No overlapping functionality.
Naming conventions are inconsistent. Generic tools use verb_noun (get_audit_log, list_services) but Yandex tools use a reversed pattern (yandex_metrika_counters_list, yandex_metrika_counter_stat) with mixed singular/plural forms. Two distinct styles coexist.
With 7 tools, the count is appropriate for a focused server that combines generic API management with specific Yandex services. It's slightly limited but not excessive.
The tool surface is incomplete for the stated domain. Generic tools only provide audit and listing, missing CRUD operations. Yandex Metrika and Webmaster tools offer read-only operations (list, get stats, list goals) but lack create, update, delete, and other management actions.
Related MCP Connectors
Zero-setup MCP gateway securely connecting AI to your tools with authentication and workflows
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP gateway: one connection for your AI apps, with tool policies, PII redaction and audit logs.
The OpenRouter for tools. One MCP connection gives any AI agent 254 hosted tools, pay per call.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceDynamically converts any REST API into MCP tools by registering web API configurations at runtime. Supports multiple authentication methods and automatically generates MCP-compatible tools for AI assistants to interact with external web services.48MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to discover and execute tools via a secure MCP server with JWT authentication, RBAC, rate limiting, and audit logging.1MIT
- FlicenseNot gradedqualityDmaintenanceDynamically exposes any OpenAPI/Swagger API as tools for AI assistants, automatically generating MCP tools from OpenAPI specs with authentication support.-
- AlicenseNot gradedqualityCmaintenanceProvides a unified MCP gateway enabling AI agents to securely access multiple tool servers (knowledge base, database, repo, etc.) with dynamic tool selection and OAuth2/RBAC security.1MIT