Repository navigation
feat(mcp): run MCP on the Platform kit, ready for the Claude and ChatGPT directories - #174
Merged
Merged
Conversation
….* tools SendLit's own SDK 2 server registered one tool per REST operation (118). /mcp now runs on @codelitdev/mcp-server-kit, following CourseLit: 29 dedicated tools for the everyday flows (contacts, segments, templates, sequences and broadcasts, transactional email, events, delivery events, plan usage), and api.list_operations / api.describe_operation / api.read / api.write / api.delete for every other team operation in the parity manifest. Generic calls are real REST requests to the same app over a loopback listener, with the caller's credential, team, IP and request id. Authorization is per operation (policy.ts maps each MCP-reachable operation to its OAuth scope) for both kinds of tool; team keys still can't manage keys. The route keeps SendLit's auth and team resolution (now shared with REST via resolveUserTeam), x-sendlit-apikey, the OAuth discovery routes, the WWW-Authenticate challenge and per-tool rate limits. Tool errors are platform errors whose details keep SendLit's reason and message. Breaking for MCP clients: removed tools are reached through api.* and deletes need confirm: true; server version 3.0.0. See ADR 0010. Needs @codelitdev/mcp-server-kit with tool title/outputSchema/annotations (codelitdev/platform#22).
0.7.0's mcp-server-kit carries tool titles, output schemas and the idempotent/open-world hints the MCP tools use.
…y review Drop the generic api.* tools: the ChatGPT Plugins Directory requires each model-callable operation to be its own tool and rejects discovery plus a generic executor. All 115 tools are back on the kit, built by dedicatedTool() from their REST operation, with their former names and schemas. For directory review, every tool now has a title and an explicit openWorldHint, destructive tools advertise confirm (which the kit requires), and tests pin these. Unexpected errors no longer echo raw messages; known ones keep SendLit's reason. The generic tools' loopback listener, replayed credentials and client IP are gone. ADR 0010 records the decision.
0.8.0's mcp-server-kit advertises every tool hint as an explicit boolean, as the ChatGPT Plugins Directory requires.
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.
Re-opens #173 against
main. #173 merged intot3/login-turnstileseconds after #172 merged, before GitHub retargeted it, so its commits never reachedmain. Same commits, unchanged and already reviewed; the description below is #173's.What
/mcpruns on@codelitdev/mcp-server-kitinstead of SendLit's own MCP SDK server, wiring and tool registry (ADR 0010).What SendLit keeps:
resolveAuth, andresolveUserTeam, which is now shared with REST'srequireTeam.x-sendlit-apikey, beside the kit'sX-API-Key.WWW-Authenticatechallenge on 401.Tools: each of the 115 tools still maps to one REST operation (111 operations plus 4 ESP aliases), with the same names and schemas.
dedicatedTool()builds each one from its REST operation id.policy.tsmaps every MCP-reachable operation to its OAuth scope, and team keys still can't manage API keys.What the Claude and ChatGPT directories review is enforced and tested:
readOnlyHint,destructiveHint,openWorldHintandidempotentHintas explicit booleansconfirm, which the kit requires to betrueErrors: tool failures are platform errors (
not_found,conflict,validation_failed,forbidden, …).details.reasoncarries SendLit's own code (for exampleplan_limit_reachedortemplate_not_transactional) anddetails.messageexplains it. Unexpected errors are reported and returned asinternal_error, never with their raw message. Input validation errors name the failing field.Fixed along the way:
get_plan_usagelooked the team up by the wrong id, so it always returned not-found.Platform: every
@codelitdev/*package moves to 0.8.0. 0.7.0 added tool titles and output schemas (codelitdev/platform#22) and 0.8.0 explicit hints (codelitdev/platform#24). Managed files are synced.History in this branch
The first commit tried CourseLit's generic
api.*tools (discovery plus one generic executor per risk). Before release I removed them again: OpenAI's plugin guidelines reject "discovery, operation selection, or schema fetching with a generic executor". ADR 0010 records why. Squash-merge if you'd rather not keep that detour in history.Breaking for MCP clients
The server version moves to 3.0.0:
confirm: trueTesting
platform-cli doctor.delete_contactrefuses withoutconfirmand deletes with it. Team keys are refused key management. A request without credentials gets 401 with the OAuth challenge./oauth/loginwith Turnstile → consent showscontacts:read sequences:read→ code → token with exactly those scopeslist_contactsandlist_sequenceswork,send_emailis refused withinsufficient_scope, and an invalid token gets 401 with the challenge