diff --git a/CHANGELOG.md b/CHANGELOG.md index c13823d..4974725 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # @copilotkit/pathfinder +## 1.13.1 + +### Patch Changes + +- **Streamable HTTP JSON Response**: Enabled `enableJsonResponse` on the Streamable HTTP MCP transport for compatibility with clients that cannot parse SSE-formatted responses (notably OpenAI Codex CLI). Fully MCP spec-compliant — the spec allows servers to return either `application/json` or `text/event-stream` for single-message responses + ## 1.13.0 ### Minor Changes diff --git a/docs/clients/index.html b/docs/clients/index.html index 06473d1..648a9ad 100644 --- a/docs/clients/index.html +++ b/docs/clients/index.html @@ -379,6 +379,32 @@

Verifying the Connection

Try asking your agent to run a simple command like find / -name "*.md" | head -5 to verify the bash tool is working, or ask a question about your docs to test semantic search.

+

Known Concerns

+ +

SSE Parsing Bugs in Some MCP Clients

+ +

Some MCP clients have bugs handling SSE-formatted responses from Streamable HTTP endpoints. This can cause initialization failures, connection drops, or cryptic errors when connecting to Pathfinder's /mcp endpoint.

+ +

The most notable example is OpenAI Codex CLI, which uses the rmcp Rust SDK internally. That SDK's SSE parser does not correctly handle the text/event-stream content type that MCP servers typically return for single-message exchanges over Streamable HTTP.

+ +

Pathfinder's Mitigation

+ +

Pathfinder enables enableJsonResponse: true on its Streamable HTTP transport. This causes the server to return Content-Type: application/json instead of SSE-wrapped responses for single-message exchanges (i.e., requests where the server sends exactly one response and does not need to stream). This is fully compliant with the MCP specification, which states that servers MAY return either format for non-streaming responses.

+ +

This setting works around the client-side bugs transparently — no configuration needed on your end.

+ +

stdio Bridge Workaround

+ +

If you still encounter connection issues with a particular client, you can use mcp-remote as a stdio bridge. This converts the HTTP transport into a local stdio pipe, which every MCP client supports reliably:

+ +
# Codex CLI — ~/.codex/config.toml + +[mcp_servers.pathfinder] +command = "npx" +args = ["mcp-remote@latest", "--http", "--allow-http", "https://mcp.copilotkit.ai/mcp"]
+ +

Replace the URL with your own Pathfinder instance's /mcp endpoint. The --http flag tells mcp-remote to use Streamable HTTP (not SSE), and --allow-http permits non-TLS connections if you're running locally.

+ diff --git a/package-lock.json b/package-lock.json index 914e5e3..4cc3f8a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@copilotkit/pathfinder", - "version": "1.13.0", + "version": "1.13.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@copilotkit/pathfinder", - "version": "1.13.0", + "version": "1.13.1", "license": "Elastic-2.0", "dependencies": { "@discordjs/rest": "^2.6.1", @@ -3768,7 +3768,7 @@ } }, "node_modules/magic-bytes.js": { - "version": "1.13.0", + "version": "1.13.1", "resolved": "https://registry.npmjs.org/magic-bytes.js/-/magic-bytes.js-1.13.0.tgz", "integrity": "sha512-afO2mnxW7GDTXMm5/AoN1WuOcdoKhtgXjIvHmobqTD1grNplhGdv3PFOyjCVmrnOZBIT/gD/koDKpYG+0mvHcg==", "license": "MIT" @@ -4367,7 +4367,7 @@ } }, "node_modules/pg-protocol": { - "version": "1.13.0", + "version": "1.13.1", "resolved": "https://registry.npmjs.org/pg-protocol/-/pg-protocol-1.13.0.tgz", "integrity": "sha512-zzdvXfS6v89r6v7OcFCHfHlyG/wvry1ALxZo4LqgUoy7W9xhBDMaqOuMiF3qEV45VqsN6rdlcehHrfDtlCPc8w==", "license": "MIT" diff --git a/package.json b/package.json index fb4d8b8..d02054b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@copilotkit/pathfinder", - "version": "1.13.0", + "version": "1.13.1", "description": "The knowledge server for AI agents — index docs, code, Notion, Slack, and Discord into searchable, agent-accessible knowledge via MCP. Supports OpenAI, Ollama, and local transformers.js embeddings.", "type": "module", "repository": { diff --git a/src/cli.ts b/src/cli.ts index 2daaafc..19431b8 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -11,7 +11,7 @@ const program = new Command(); program .name("pathfinder") .description("The knowledge server for AI agents") - .version("1.13.0"); + .version("1.13.1"); program .command("init") diff --git a/src/server.ts b/src/server.ts index 524a17a..4354b73 100644 --- a/src/server.ts +++ b/src/server.ts @@ -1626,6 +1626,7 @@ app.post("/mcp", bearerMiddleware, async (req: Request, res: Response) => { const initOutcome: { rejected: boolean } = { rejected: false }; const transport = new StreamableHTTPServerTransport({ sessionIdGenerator: () => preSid, + enableJsonResponse: true, onsessioninitialized: (sid) => { // Registration moved here intentionally — we can't populate // transports[sid] before the transport object exists, and the SDK