Skip to content
ВозможностиДокументацияЦеныPlaygroundFAQ

Руководство по принудительному использованию агентов

Как заставить AI-агентов использовать FlowLink MCP для всех операций на серверах

Зачем нужен enforcement

MCP — это добровольный протокол. AI-агенты технически МОГУТ обойти его, выполняя прямые SSH-подключения или API-вызовы в обход FlowLink.

Без enforcement governance-слой FlowLink бесполезен — агент просто не будет его использовать.

⚠️ Реальный сценарий без enforcement:

  • Агент решает, что FlowLink слишком медленный, и подключается по SSH напрямую
  • Команда выполняется без security-сканирования
  • Нет audit-лога, нет rollback, нет уведомлений
  • Критическая ошибка в production — обнаружена постфактум

FlowLink предлагает 3 уровня enforcement:

Soft

System prompt — инструктирует агента использовать FlowLink

Medium

Credential gating — агент не имеет SSH-ключей

Hard

Network + kernel — eBPF блокирует всё кроме FlowLink

✅ Рекомендуемый подход: все 3 уровня вместе

Soft + Medium + Hard = максимальная защита. Начните с Soft, затем добавьте Medium и Hard по мере необходимости.


Принуждение через System Prompt

Самый быстрый способ enforcement — добавить правила в system prompt агента. Это работает для любого MCP-совместимого AI-агента.

💡 Совет:

Разместите правила в начале system prompt — это увеличивает вероятность их соблюдения агентом.

a) Claude Code — .claude/CLAUDE.md

Создайте файл .claude/CLAUDE.md в корневом проекте:

markdown
# Server Operations Policy

## MANDATORY: Use FlowLink MCP for ALL server interactions

You MUST use FlowLink MCP tools for ANY operation on remote servers. This is a security requirement, not a suggestion.

### Rules:
1. **NEVER** use raw SSH, direct API calls, or any other method to interact with servers
2. **ALWAYS** use `flowlink_exec` instead of SSH commands
3. **ALWAYS** use `flowlink_read` instead of `cat`, `tail`, `head` on remote files
4. **ALWAYS** use `flowlink_write` instead of `scp`, `rsync`, or file editing on remote servers
5. **ALWAYS** use `flowlink_deploy` for deployment operations (auto-rollback + audit)
6. **ALWAYS** use `flowlink_secrets` for credential access (vault protects raw secrets)
7. **ALWAYS** use `flowlink_agents` first to discover available servers
8. **ALWAYS** use `flowlink_sysinfo` for server health checks

### Workflow:
1. `flowlink_agents` → discover servers
2. `flowlink_sysinfo` → check server health
3. `flowlink_exec` → run commands (auto-scanned for risks)
4. `flowlink_read`/`flowlink_write` → file operations (auto-redacted)

### Why:
- Every command is security-scanned BEFORE execution
- All operations are audit-logged for compliance
- Dangerous commands are automatically blocked
- Secrets are redacted — no credential leakage
- Full rollback on deployment failures

### Violation:
If you cannot access a server through FlowLink MCP tools, STOP and inform the user. Do NOT attempt alternative access methods.

b) Cursor — .cursorrules

Создайте файл .cursorrules в корневом проекте:

markdown
# Server Operations Policy

## MANDATORY: Use FlowLink MCP for ALL server interactions

You MUST use FlowLink MCP tools for ANY operation on remote servers. This is a security requirement, not a suggestion.

### Rules:
1. **NEVER** use raw SSH, direct API calls, or any other method to interact with servers
2. **ALWAYS** use `flowlink_exec` instead of SSH commands
3. **ALWAYS** use `flowlink_read` instead of `cat`, `tail`, `head` on remote files
4. **ALWAYS** use `flowlink_write` instead of `scp`, `rsync`, or file editing on remote servers
5. **ALWAYS** use `flowlink_deploy` for deployment operations (auto-rollback + audit)
6. **ALWAYS** use `flowlink_secrets` for credential access (vault protects raw secrets)
7. **ALWAYS** use `flowlink_agents` first to discover available servers
8. **ALWAYS** use `flowlink_sysinfo` for server health checks

### Workflow:
1. `flowlink_agents` → discover servers
2. `flowlink_sysinfo` → check server health
3. `flowlink_exec` → run commands (auto-scanned for risks)
4. `flowlink_read`/`flowlink_write` → file operations (auto-redacted)

### Why:
- Every command is security-scanned BEFORE execution
- All operations are audit-logged for compliance
- Dangerous commands are automatically blocked
- Secrets are redacted — no credential leakage
- Full rollback on deployment failures

### Violation:
If you cannot access a server through FlowLink MCP tools, STOP and inform the user. Do NOT attempt alternative access methods.

c) Generic — любой AI-агент

Используйте этот блок как system prompt или инструкцию для любого MCP-совместимого агента:

markdown
# Server Operations Policy

## MANDATORY: Use FlowLink MCP for ALL server interactions

You MUST use FlowLink MCP tools for ANY operation on remote servers. This is a security requirement, not a suggestion.

### Rules:
1. **NEVER** use raw SSH, direct API calls, or any other method to interact with servers
2. **ALWAYS** use `flowlink_exec` instead of SSH commands
3. **ALWAYS** use `flowlink_read` instead of `cat`, `tail`, `head` on remote files
4. **ALWAYS** use `flowlink_write` instead of `scp`, `rsync`, or file editing on remote servers
5. **ALWAYS** use `flowlink_deploy` for deployment operations (auto-rollback + audit)
6. **ALWAYS** use `flowlink_secrets` for credential access (vault protects raw secrets)
7. **ALWAYS** use `flowlink_agents` first to discover available servers
8. **ALWAYS** use `flowlink_sysinfo` for server health checks

### Workflow:
1. `flowlink_agents` → discover servers
2. `flowlink_sysinfo` → check server health
3. `flowlink_exec` → run commands (auto-scanned for risks)
4. `flowlink_read`/`flowlink_write` → file operations (auto-redacted)

### Why:
- Every command is security-scanned BEFORE execution
- All operations are audit-logged for compliance
- Dangerous commands are automatically blocked
- Secrets are redacted — no credential leakage
- Full rollback on deployment failures

### Violation:
If you cannot access a server through FlowLink MCP tools, STOP and inform the user. Do NOT attempt alternative access methods.

d) Краткая версия (для агентов с ограниченным контекстом)

Если у агента ограниченный контекст, используйте сокращённую версию:

markdown
# Server Operations — MANDATORY

You MUST use FlowLink MCP tools for ALL server operations. Never use SSH, direct API calls, or any other method to interact with servers.

- `flowlink_exec` — run commands (instead of SSH)
- `flowlink_read` / `flowlink_write` — file operations (instead of cat/scp)
- `flowlink_deploy` — deployments with auto-rollback
- `flowlink_secrets` — access credentials from vault
- `flowlink_agents` / `flowlink_sysinfo` — discover and check servers

If FlowLink tools are unavailable, STOP and tell the user. Do NOT bypass.

Конфигурация для разных агентов

Каждый AI-агент имеет свой формат конфигурации. Ниже — готовые шаблоны для настройки FlowLink MCP.

Claude Code

System prompt файл:

~/.claude/CLAUDE.md

Скопируйте содержимое из раздела выше в этот файл.

MCP конфиг:

~/.claude/mcp.json
json
{
  "mcpServers": {
    "flowlink": {
      "url": "https://relay.flow-masters.ru:9081/mcp",
      "headers": {
        "Authorization": "Bearer flk_live_ВАШ_API_KEY"
      }
    }
  }
}

Cursor

Rules файл:

.cursorrules

Создайте в корневом проекте. Cursor автоматически подхватит этот файл.

MCP конфиг:

~/.cursor/mcp.json
json
{
  "mcpServers": {
    "flowlink": {
      "url": "https://relay.flow-masters.ru:9081/mcp",
      "headers": {
        "Authorization": "Bearer flk_live_ВАШ_API_KEY"
      }
    }
  }
}

GitHub Copilot

Instructions файл:

.github/copilot-instructions.md

Создайте в корневом репозитория. Copilot прочитает этот файл при работе с проектом.

markdown
# Server Operations Policy

## MANDATORY: Use FlowLink MCP for ALL server interactions

You MUST use FlowLink MCP tools for ANY operation on remote servers. This is a security requirement, not a suggestion.

### Rules:
1. **NEVER** use raw SSH or direct API calls to interact with servers
2. **ALWAYS** use `flowlink_exec` instead of SSH commands
3. **ALWAYS** use `flowlink_read` / `flowlink_write` for file operations
4. **ALWAYS** use `flowlink_deploy` for deployments (auto-rollback + audit)
5. **ALWAYS** use `flowlink_secrets` for credential access

### Violation:
If you cannot access a server through FlowLink MCP tools, STOP and inform the user.

Windsurf

Rules файл:

.windsurfrules

Создайте в корневом проекте. Windsurf автоматически применит эти правила.

markdown
# Server Operations Policy

## MANDATORY: Use FlowLink MCP for ALL server interactions

You MUST use FlowLink MCP tools for ANY operation on remote servers. This is a security requirement, not a suggestion.

### Rules:
1. **NEVER** use raw SSH or direct API calls to interact with servers
2. **ALWAYS** use `flowlink_exec` instead of SSH commands
3. **ALWAYS** use `flowlink_read` / `flowlink_write` for file operations
4. **ALWAYS** use `flowlink_deploy` for deployments (auto-rollback + audit)
5. **ALWAYS** use `flowlink_secrets` for credential access

### Violation:
If you cannot access a server through FlowLink MCP tools, STOP and inform the user.

✅ После добавления system prompt — перезапустите агент

Некоторые агенты загружают system prompt только при старте. Убедитесь, что агент перечитал правила.


Изоляция кредов

Даже с system prompt enforcement, агент может попытаться найти SSH-ключи в окружении. Credential gating — второй уровень защиты.

❌ Никогда не делайте:

  • Храните SSH-ключи в переменных окружения, доступных агенту
  • Помещайте ключи в .ssh/ директории проекта
  • Передавайте credentials через аргументы командной строки
  • Сохраняйте ключи в секретах CI/CD, видимых агенту

✅ Делайте так:

  • Удалите все SSH-ключи из контекста агента
  • Храните ключи в FlowLink Vault
  • Агент использует `flowlink_secrets` для запроса доступа к ключам
  • Агент никогда не видит raw credentials — только токены с ограниченным TTL

Пример workflow:

1. Агент хочет подключиться к серверу

2. flowlink_secrets("ssh-key:production-db")

3. FlowLink Vault возвращает временный токен (TTL 5 мин)

4. flowlink_exec(agent_id, "ls -la")

5. FlowLink использует токен для подключения — агент не видит ключ


Сетевой enforcement

Самый надёжный уровень enforcement — сетевой. Если агент физически не может подключиться к серверу напрямую, он ОБЯЗАН использовать FlowLink.

1. Private Network

Серверы не имеют публичных IP. Все подключения идут через private network.

2. FlowLink Relay

FlowLink relay — единственный bastion-хост. Агент подключается только через него.

3. eBPF Filter

eBPF connection filter блокирует все подключения кроме FlowLink на уровне ядра.

⚠️ Важно:

  • eBPF filter должен быть настроен на каждом сервере
  • Разрешите только IP FlowLink relay в правилах firewall
  • Блокируйте все входящие подключения на порты 22, 3306, 5432 и т.д.

Результат:

✅ Агент физически не может обойти FlowLink

Даже если агент решит использовать SSH напрямую — eBPF заблокирует подключение на уровне ядра Linux.


Чеклист проверки enforcement

Используйте этот чеклист, чтобы убедиться, что enforcement работает корректно:

System prompt добавлен и агент перечитал правила

Перезапустите агент после добавления system prompt

MCP-конфиг подключён и инструменты доступны

Вызовите flowlink_agents — должен вернуть список серверов

Агент не имеет SSH-ключей в окружении

Проверьте: ls ~/.ssh/ — должен быть пуст или отсутствовать

Агент использует flowlink_exec вместо SSH

Попробуйте попросить агента выполнить команду на сервере

Audit-лог фиксирует все операции

Проверьте Dashboard → Audit Log — должны быть записи

eBPF filter блокирует прямые подключения

Попробуйте SSH напрямую с машины агента — должно быть отказано

Secrets redacted в логах

Проверьте, что пароли и ключи не появляются в выводах

Deploy с rollback работает

Запустите тестовый деплой и убедитесь, что rollback срабатывает при ошибке

✅ Все пункты отмечены — enforcement работает!

Периодически повторяйте этот чеклист, особенно после обновлений агентов.