# MCP протокол

Подробное описание интеграции OneAPA с Model Context Protocol.

## Что такое MCP

**Model Context Protocol (MCP)** — открытый стандарт для взаимодействия языковых моделей с внешними инструментами и данными.

### Ключевые концепции

| Концепция    | Описание                            |
| ------------ | ----------------------------------- |
| **Server**   | Предоставляет инструменты и ресурсы |
| **Client**   | Использует инструменты сервера      |
| **Tool**     | Функция, которую может вызвать LLM  |
| **Resource** | Данные, доступные для чтения        |
| **Prompt**   | Шаблоны для LLM                     |

## OneAPA как MCP сервер

OneAPA автоматически экспортирует все инструменты агентов через MCP.

### Архитектура

```
┌─────────────────────────────────────────────────────────────────────────┐
│                        MCP Клиенты                                       │
│                                                                          │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐     │
│  │   Cursor    │  │   Claude    │  │   VS Code   │  │   Custom    │     │
│  │    IDE      │  │   Desktop   │  │   + Ext     │  │   Client    │     │
│  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘  └──────┬──────┘     │
│         │                │                │                │             │
└─────────┼────────────────┼────────────────┼────────────────┼─────────────┘
          │                │                │                │
          └────────────────┴────────────────┴────────────────┘
                                    │
                                    ▼ MCP Protocol
                           ┌─────────────────┐
                           │     OneAPA      │
                           │   MCP Server    │
                           │                 │
                           │  • tools/list   │
                           │  • tools/call   │
                           └─────────────────┘
                                    │
                                    ▼
                           ┌─────────────────┐
                           │   Инструменты   │
                           │      1С         │
                           └─────────────────┘
```

### Настройка в Cursor

Добавьте в настройки MCP:

```json
{
  "mcpServers": {
    "oneapa": {
      "url": "http://localhost:9000/mcp",
      "transport": "http"
    }
  }
}
```

### Пример использования

После настройки в Cursor доступны инструменты 1С:

```
User: Покажи остаток на счёте 40702810100000000001

Cursor → MCP → OneAPA → Инструмент "Остаток на счёте" → 1С
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onerpa.ru/ai-platforma-oneapa/integratsii/mcp-protokol.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
