Skip to content

Fix MCP discovery and Accept compatibility#41

Merged
Trailgenic merged 2 commits into
mainfrom
codex/create-branch-for-mcp-compatibility-fixes
Jul 14, 2026
Merged

Fix MCP discovery and Accept compatibility#41
Trailgenic merged 2 commits into
mainfrom
codex/create-branch-for-mcp-compatibility-fixes

Conversation

@Trailgenic

Copy link
Copy Markdown
Owner

Motivation

  • Restore browser-readable JSON discovery at the canonical MCP root and make the MCP POST transport tolerant of harmless/incomplete Accept headers while preserving all existing security, validation, and SDK behavior.

Description

  • Implement Accept compatibility and normalization in app/mcp/route.ts: accept missing/empty, */*, and JSON-only Accept headers, normalize those cases to application/json, text/event-stream, pass fully compliant JSON+SSE requests through unchanged, and reject text/event-stream-only or unsupported types with HTTP 406; normalization clones the incoming Request and changes only the Accept header. (Preserves Content-Type, Origin, MCP-Protocol-Version, session headers, body and all other request properties and continues to call handleEllaMcpPost.)
  • Restore browser discovery JSON for https://mcp.ellaentity.ai/ in app/mcp/route.ts, generating discovery values from the canonical registry constants (canonical entity ID, server info, protocol versions, tool names, resource URIs, docs and entity-graph URLs, and a public read-only scope statement) rather than hard-coding values.
  • Use a minimal routing approach: keep the existing host-based rewrite but add a marker so root rewrites can be distinguished; next.config.ts rewrites mcp.ellaentity.ai/ -> /mcp?mcpRoot=1, and app/mcp/route.ts treats host mcp.ellaentity.ai + either path / or the mcpRoot=1 marker as the canonical root discovery request; direct GET /mcp remains 405 with Allow: POST, OPTIONS.
  • Bump MCP server behavior version in registry from 1.1.2 to 1.1.3 without changing any ontology/entity data, canonical IDs, tool names, resource URIs, data versions, lastModified values, or privacy boundaries.
  • Add/update behavioral tests in tests/mcp.test.ts to assert Accept normalization behavior and canonical root discovery and alias behavior.
  • Files changed: app/mcp/route.ts, lib/ella-registry.ts, next.config.ts, tests/mcp.test.ts (commit on branch codex/fix-mcp-discovery-and-accept-compatibility, commit id c1ffd68).

Testing

  • Ran git diff --check which passed and committed the changes locally; the repository contains the new tests and route logic but cannot be pushed from this environment due to network/proxy restrictions.
  • Attempted npm ci but the environment’s proxy/network prevented a successful dependency install, leaving dependencies incomplete and causing subsequent steps to fail.
  • npm run lint could not complete due to missing dev dependencies (ESLint modules), therefore lint did not pass in this environment.
  • npm run typecheck failed locally because required packages and types (e.g., next, React JSX runtime, zod, MCP SDK types, Node types) were not available after the failed npm ci.
  • npm test could not complete because tsx was not installed in node_modules in this environment; tests were added and are runnable in a normal environment and include assertions for: missing Accept, empty Accept, */*, application/json only, application/json, text/event-stream, text/event-stream alone -> 406, text/plain -> 406, invalid Content-Type -> 415, disallowed Origin -> 403, preservation of JSON-RPC body and headers, root discovery JSON contents, /mcp 405 behavior, and alias POST behavior.
  • npm run build could not complete locally because next was not available after dependency install failed.
  • git push failed in this environment (CONNECT tunnel failed, response 403) so the branch remains pushed only locally and GitHub Actions CI / verify was not run; therefore no Draft PR URL is available from this run.

If CI/network access is available in your environment, run the verification sequence: npm ci, npm run lint, npm run typecheck, npm test, npm run build, and the tests added in tests/mcp.test.ts should validate the Accept normalization and discovery behavior; the change preserves all canonical registry values, tools, resources, protocols, schemas, provenance, and privacy boundaries (only the server version string was incremented to 1.1.3).


Codex Task

@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ellaentity Ready Ready Preview, Comment Jul 14, 2026 2:00am

Request Review

@Trailgenic
Trailgenic merged commit a67ccb8 into main Jul 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant