Add MCP gateway: drop Lemonade into Claude Desktop, VS Code or Cursor in 30 seconds#2131
Open
siavashhub wants to merge 3 commits into
Open
Add MCP gateway: drop Lemonade into Claude Desktop, VS Code or Cursor in 30 seconds#2131siavashhub wants to merge 3 commits into
siavashhub wants to merge 3 commits into
Conversation
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.
What this does. Adds a single
POST /mcpendpoint that speaks the Model Context Protocol (Streamable HTTP, spec2025-06-18). Any MCP-aware host like GitHub Copilot (Agent mode), Claude Desktop, Cursor, Cline, Continue... can now call local Lemonade models as tools.Why it matters. Agents running in a frontier model can now route the privacy-sensitive or high-volume parts of a task to local Lemonade models without leaving the conversation. Bulk classification, on-device transcription and image generation become free, private and offline, orchestrated by whatever host model the user prefers.
MVP scope. 4 tools:
lemonade_list_models- discoverylemonade_chat- chat completion (forwards to any backend)lemonade_transcribe_audio- base64-in, transcript-outlemonade_generate_image- base64 PNG outEmbeddings, TTS and SSE streaming intentionally deferred (happy to add as follow-ups if merged.)
Try it (≈30 sec). Start lemond, then add to VS Code's
{ "servers": { "lemonade": { "type": "http", "url": "http://localhost:13305/mcp" } } }Or use below within claude_desktop_config.json for Claude Desktop
Open Copilot Chat in Agent mode → the four
lemonade_*tools appear in the picker.GHCP Screenshot 1:

GHCP Screenshot 2:

Diff scope. Additive only, no breaking changes to existing REST endpoints, no new runtime deps. Roughly ~600 lines of C++ plus tests/docs.
Files added
src/cpp/include/lemon/mcp_server.h-McpServerclass declarationsrc/cpp/server/mcp_server.cpp- JSON-RPC 2.0 dispatcher + 4 toolstest/server_mcp.py- integration tests (envelope behaviour,tools/list, live chat call)docs/api/mcp.md- endpoint reference with curl examplesFiles modified
src/cpp/server/server.cpp- instantiateMcpServernext toOllamaApi; add/mcptois_api_routesoLEMONADE_API_KEYstill gates itCMakeLists.txt- registermcp_server.cppinSOURCES_CORE- document/mcpas the third exception to the quad-prefix registration (alongside Anthropic/v1/messagesand Ollama/api/*`); MCP spec mandates a fixed single-URL shapedocs/api/README.md- new row in the API tableRoadmap (separate follow-ups if there's appetite). Embeddings + reranking tools; TTS; SSE streaming for
chat; an MCP client in Lemonade (would unlock Lemonade-calls-Lemonade and voice-driven agents over the Realtime API).Tests.
python test/server_mcp.pycovers envelope behaviour (parse errors, method-not-found, batch, notifications) and a live chat round-trip. Local build clean on Windows.