Skip to content

Add MCP gateway: drop Lemonade into Claude Desktop, VS Code or Cursor in 30 seconds#2131

Open
siavashhub wants to merge 3 commits into
lemonade-sdk:mainfrom
siavashhub:feat/mcp-gw-server-mvp
Open

Add MCP gateway: drop Lemonade into Claude Desktop, VS Code or Cursor in 30 seconds#2131
siavashhub wants to merge 3 commits into
lemonade-sdk:mainfrom
siavashhub:feat/mcp-gw-server-mvp

Conversation

@siavashhub
Copy link
Copy Markdown
Collaborator

@siavashhub siavashhub commented Jun 7, 2026

What this does. Adds a single POST /mcp endpoint that speaks the Model Context Protocol (Streamable HTTP, spec 2025-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 - discovery
  • lemonade_chat - chat completion (forwards to any backend)
  • lemonade_transcribe_audio - base64-in, transcript-out
  • lemonade_generate_image - base64 PNG out

Embeddings, 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

"mcpServers": {
  "lemonade": {
    "command": "npx",
    "args": [
      "-y",
      "mcp-remote",
      "http://localhost:13305/mcp"
    ]
  }
}

Open Copilot Chat in Agent mode → the four lemonade_* tools appear in the picker.

GHCP Screenshot 1:
image

GHCP Screenshot 2:
image

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 - McpServer class declaration
  • src/cpp/server/mcp_server.cpp - JSON-RPC 2.0 dispatcher + 4 tools
  • test/server_mcp.py - integration tests (envelope behaviour, tools/list, live chat call)
  • docs/api/mcp.md - endpoint reference with curl examples

Files modified

  • src/cpp/server/server.cpp - instantiate McpServer next to OllamaApi; add /mcp to is_api_route so LEMONADE_API_KEY still gates it
  • CMakeLists.txt - register mcp_server.cpp in SOURCES_CORE
  • AGENTS.md- document/mcpas the third exception to the quad-prefix registration (alongside Anthropic/v1/messagesand Ollama/api/*`); MCP spec mandates a fixed single-URL shape
  • docs/api/README.md - new row in the API table

Roadmap (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.py covers envelope behaviour (parse errors, method-not-found, batch, notifications) and a live chat round-trip. Local build clean on Windows.

@github-actions github-actions Bot added area::api HTTP REST API surface and route handlers enhancement New feature or request labels Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area::api HTTP REST API surface and route handlers enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant