feat(mcp): native MCP server + Codex assistant support#24
Open
qasim-nylas wants to merge 14 commits intomainfrom
Open
feat(mcp): native MCP server + Codex assistant support#24qasim-nylas wants to merge 14 commits intomainfrom
qasim-nylas wants to merge 14 commits intomainfrom
Conversation
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.
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
nylas mcp serve) that calls Nylas API v3 viaNylasClientsend_rsvpMCP tool support for calendar invitations--assistant codex)Architecture
Before:
AI -> STDIO -> Proxy -> HTTP -> mcp.us.nylas.com -> Nylas API v3After:
AI -> STDIO -> Native MCP Server -> NylasClient -> Nylas API v3Test Plan
go test ./internal/adapters/mcp/...go test ./internal/cli/mcp/...initialize,tools/list,tools/call, notifications,ping)CODEX_HOME