Fix MCP transport compatibility and batch_store e2e coverage

This commit is contained in:
Agent Zero
2026-03-22 03:18:08 +00:00
parent d7140eb7f3
commit 26c96b41dd
5 changed files with 329 additions and 15 deletions

View File

@@ -9,7 +9,7 @@ OpenBrain is a Model Context Protocol (MCP) server that provides AI agents with
- 🧠 **Semantic Memory**: Store and retrieve memories using vector similarity search
- 🏠 **Local Embeddings**: No external API calls - uses ONNX runtime with all-MiniLM-L6-v2
- 🐘 **PostgreSQL + pgvector**: Production-grade vector storage with HNSW indexing
- 🔌 **MCP Protocol**: Standard Model Context Protocol over SSE transport
- 🔌 **MCP Protocol**: Streamable HTTP plus legacy HTTP+SSE compatibility
- 🔐 **Multi-Agent Support**: Isolated memory namespaces per agent
-**High Performance**: Rust implementation with async I/O
@@ -103,14 +103,53 @@ Recommended target file in A0:
## MCP Integration
Connect to the server using SSE transport:
OpenBrain exposes both MCP HTTP transports:
```
SSE Endpoint: http://localhost:3100/mcp/sse
Message Endpoint: http://localhost:3100/mcp/message
Streamable HTTP Endpoint: http://localhost:3100/mcp
Legacy SSE Endpoint: http://localhost:3100/mcp/sse
Legacy Message Endpoint: http://localhost:3100/mcp/message
Health Check: http://localhost:3100/mcp/health
```
Use the streamable HTTP endpoint for modern clients such as Codex. Keep the
legacy SSE endpoints for older MCP clients that still use the deprecated
2024-11-05 HTTP+SSE transport.
Header roles:
- `X-Agent-ID` is the memory namespace. Keep this stable if multiple clients
should share the same OpenBrain memories.
- `X-Agent-Type` is an optional client profile label for logging and config
clarity, such as `agent-zero` or `codex`.
### Example: Codex Configuration
```toml
[mcp_servers.openbrain]
url = "https://ob.ingwaz.work/mcp"
http_headers = { "X-API-Key" = "YOUR_OPENBRAIN_API_KEY", "X-Agent-ID" = "openbrain", "X-Agent-Type" = "codex" }
```
### Example: Agent Zero Configuration
```json
{
"mcpServers": {
"openbrain": {
"url": "https://ob.ingwaz.work/mcp/sse",
"headers": {
"X-API-Key": "YOUR_OPENBRAIN_API_KEY",
"X-Agent-ID": "openbrain",
"X-Agent-Type": "agent-zero"
}
}
}
}
```
Agent Zero should keep using the legacy HTTP+SSE transport unless and until its
client runtime supports streamable HTTP. Codex should use `/mcp`.
### Example: Store a Memory
```json
@@ -180,7 +219,7 @@ Health Check: http://localhost:3100/mcp/health
┌─────────────────────────────────────────────────────────┐
│ AI Agent │
└─────────────────────┬───────────────────────────────────┘
│ MCP Protocol (SSE)
│ MCP Protocol (Streamable HTTP / Legacy SSE)
┌─────────────────────▼───────────────────────────────────┐
│ OpenBrain MCP Server │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │