Skip to content

feat(mcp): native MCP server + Codex assistant support#24

Open
qasim-nylas wants to merge 14 commits intomainfrom
feature/native-mcp-server
Open

feat(mcp): native MCP server + Codex assistant support#24
qasim-nylas wants to merge 14 commits intomainfrom
feature/native-mcp-server

Conversation

@qasim-nylas
Copy link
Collaborator

@qasim-nylas qasim-nylas commented Feb 26, 2026

Summary

  • Replace the MCP proxy implementation with a native MCP server (nylas mcp serve) that calls Nylas API v3 via NylasClient
  • Expand MCP tool coverage to include contacts CRUD and utility time-conversion tools (current native toolset: 47 tools)
  • Add send_rsvp MCP tool support for calendar invitations
  • Add Codex assistant support to MCP install/status/uninstall flows (--assistant codex)
  • Update MCP docs to reflect native architecture (remove outdated proxy wording)

Architecture

Before: AI -> STDIO -> Proxy -> HTTP -> mcp.us.nylas.com -> Nylas API v3

After: AI -> STDIO -> Native MCP Server -> NylasClient -> Nylas API v3

Test Plan

  • MCP package unit tests pass: go test ./internal/adapters/mcp/...
  • MCP CLI tests pass: go test ./internal/cli/mcp/...
  • JSON-RPC flow validated (initialize, tools/list, tools/call, notifications, ping)
  • Tool registration/dispatch validated in server tests
  • Codex install/status/uninstall smoke-tested with isolated CODEX_HOME

Remove the HTTP proxy to mcp.us.nylas.com and replace with a native
MCP server that calls the Nylas API directly via NylasClient. Provides
37 tools across email, calendar, contacts, and utilities.
Cover JSON-RPC helpers, dispatch routing, protocol handlers,
tool registration, grant resolution, and executor methods
for messages, calendars, folders, contacts, and utilities.
Allows accepting, declining, or tentatively responding to
calendar event invitations via the MCP server.
@qasim-nylas qasim-nylas changed the title feat(mcp): replace proxy with native MCP server feat(mcp): native MCP server + Codex assistant support Feb 26, 2026
qasim-nylas and others added 9 commits February 26, 2026 08:22
Add integration tests using the official MCP Go SDK
(github.com/modelcontextprotocol/go-sdk) to validate real client
compatibility. The SDK uses newline-delimited JSON, which revealed
that our server was only writing Content-Length framed responses.

Fix the server to auto-detect the client's framing mode per-request
and respond in the same format, ensuring compatibility with both
Content-Length clients (Claude Code/TypeScript SDK) and
newline-delimited clients (Go SDK/Codex).

Changes:
- server.go: readRequestPayload returns framing mode, add
  writeNewlinePayload, writePayload dispatcher
- sdk_integration_test.go: 14 tests via official MCP Go SDK
- integration_test.go: protocol-level tests with auto-detect reader
- integration_tools_test.go: tool-specific tests with mock
- server_io_test.go: updated for new signature, add newline test
Add 10 MB Content-Length cap to prevent unbounded memory allocation
(SEC-001) and convert recursive readRequestPayload to iterative loop
to eliminate potential stack overflow from crafted input (SEC-004).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants