# Tri-stack MCP: Gateway + EDT-MCP + http1c

When you need **hosted context + local IDE depth + optional RAG**, run three MCP servers side by side. Gateway stays the primary orchestrator; secondary servers fill gaps without replacing native tools.

## When to use which server

| Need | Primary | Secondary |
|------|---------|-----------|
| Profiles, policy, billing, Agent Result Loop | **1C MCP Gateway** | — |
| BSL search, go-to-definition, unified context, patch proposals | **Gateway native tools** | EDT-MCP for LSP-grade navigation in EDT workspace |
| Full metadata BM cascade, YAXUnit, Designer CLI from IDE | Gateway write tools + loop | **EDT-MCP** on `:8765` |
| Dense embeddings / rcore RAG over large corpora | Gateway FTS5 hybrid search | **http1c** on `:8888` (optional) |

Gateway does **not** proxy EDT-MCP or http1c — configure them as separate MCP entries in your IDE.

## Example `~/.cursor/mcp.json`

```json
{
  "mcpServers": {
    "onec-gateway": {
      "url": "https://mwi.yatsuk.pro/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_MCP_TOKEN"
      }
    },
    "edt-mcp": {
      "url": "http://127.0.0.1:8765/mcp"
    },
    "http1c": {
      "url": "http://127.0.0.1:8888/mcp"
    }
  }
}
```

For local Gateway development:

```json
"onec-gateway-local": {
  "command": "node",
  "args": ["--import", "tsx", "apps/gateway/src/server.ts"],
  "cwd": "/var/www/mwi.yatsuk.pro",
  "env": {
    "ONEC_MCP_DATA_DIR": "/var/www/mwi.yatsuk.pro/.data",
    "ONEC_BSL_LS_DISABLE": "0"
  }
}
```

## Recommended agent workflow

1. **Gateway** — `discover_1c_context`, `get_unified_context_for_task`, read/write tools with approvals.
2. **EDT-MCP** — only when the task needs EDT-native operations (YAXUnit, full metadata tree in IDE export).
3. **http1c** — optional rerank / embedding search when FTS5 hybrid is not enough.

Avoid duplicating the same tool call on all three servers — pick one source of truth per step.

## Security notes

- Gateway enforces scopes, approvals, and redaction on HTTP MCP.
- Local EDT-MCP/http1c run with your OS user — do not expose their ports publicly.
- Production write paths must still go through Gateway policy even if EDT-MCP can edit files locally.

## Related

- [SEMANTIC_CONTEXT.md](./SEMANTIC_CONTEXT.md) — native read tools
- [EDT_MCP_BRIDGE.md](./EDT_MCP_BRIDGE.md) — EDT-MCP as secondary MCP
- [MCP_CONNECTION.md](./MCP_CONNECTION.md) — Gateway transport setup
