86 lines
2.5 KiB
Markdown
86 lines
2.5 KiB
Markdown
# MCP Servers - Model Context Protocol
|
|
|
|
#sympozium #komunikacja #mcp
|
|
|
|
## Koncepcja
|
|
|
|
MCP (Model Context Protocol) to protokół umożliwiający **rozszerzanie możliwości agentów** o zewnętrzne narzędzia. Sympozium integruje MCP jako first-class citizen z pełnym lifecycle management.
|
|
|
|
## Architektura
|
|
|
|
```
|
|
MCPServer CRD → Controller
|
|
├── Managed: Deploy + Service + probe tools
|
|
└── External: Just probe tools
|
|
|
|
SympoziumInstance.mcpServers[] → reference MCPServer
|
|
↓
|
|
AgentRun → Reconciler:
|
|
1. Resolve MCPServer URLs (status.url)
|
|
2. Create MCP ConfigMap (server configs)
|
|
3. Add mcp-bridge sidecar to pod
|
|
↓
|
|
Agent Pod:
|
|
┌──────────┐ ┌──────────────┐ ┌──────────────┐
|
|
│ Agent │──│ MCP Bridge │──│ MCP Server │
|
|
│ │ │ Sidecar │ │ (remote) │
|
|
│ gh_* │ │ Translates: │ │ │
|
|
│ tools │ │ tool call → │ │ GitHub API │
|
|
│ │ │ MCP protocol│ │ │
|
|
└──────────┘ └──────────────┘ └──────────────┘
|
|
```
|
|
|
|
## Tool namespacing
|
|
|
|
Problem: wiele MCP serwerów może mieć tool o tej samej nazwie.
|
|
|
|
Rozwiązanie: **toolsPrefix** - każde narzędzie z danego serwera dostaje prefix:
|
|
|
|
```
|
|
GitHub MCP (prefix: gh) → gh_create_issue, gh_list_repos
|
|
Jira MCP (prefix: jira) → jira_create_ticket, jira_search
|
|
Slack MCP (prefix: sl) → sl_send_message, sl_list_channels
|
|
```
|
|
|
|
## Tool filtering
|
|
|
|
```yaml
|
|
toolsAllow: [create_issue] # TYLKO te narzędzia (whitelist)
|
|
toolsDeny: [delete_repo] # BLOKUJ te narzędzia (blacklist)
|
|
```
|
|
|
|
`toolsDeny` applied after `toolsAllow` - można pozwolić na all except specific.
|
|
|
|
## Auto-discovery
|
|
|
|
Controller probeuje MCP server po deploy:
|
|
1. Wysyła MCP tools/list request
|
|
2. Odkrywa dostępne narzędzia
|
|
3. Aplikuje allow/deny filtry
|
|
4. Zapisuje w `status.tools[]`
|
|
5. Aktualizuje `status.toolCount`
|
|
|
|
## Transport modes
|
|
|
|
### stdio → HTTP adapter
|
|
Serwer MCP używa stdio (stdin/stdout). Controller automatycznie dodaje HTTP adapter:
|
|
```
|
|
Container: my-mcp-server --stdio
|
|
↓
|
|
HTTP adapter: wraps stdio → HTTP endpoint
|
|
↓
|
|
mcp-bridge sidecar connects via HTTP
|
|
```
|
|
|
|
### HTTP (native)
|
|
Serwer MCP natywnie serwuje HTTP:
|
|
```
|
|
Container: my-mcp-server --port 8080
|
|
↓
|
|
mcp-bridge sidecar connects directly
|
|
```
|
|
|
|
---
|
|
|
|
Powiązane: [[MCPServer]] | [[SympoziumInstance]] | [[Przepływ danych i IPC]]
|