makepad/libs/ai/services/Cargo.toml
Admin 0f39445982 ai: Claude Desktop drives any app with the F10 panel -- pick "Claude Desktop" in the panel's provider menu and the app serves its tools to it over MCP
- The loopback MCP server moves from Director into libs/ai/services (mcp::server); Director re-exports it, its lane tokens and tests unchanged. The dispatcher now names the server and its instructions; a TokenStore can live in memory only (ephemeral).
- mcp::host: while Claude Desktop is the provider the panel serves its registry's tools (service__tool names) on an ephemeral 127.0.0.1 port with a fresh bearer token, and writes ~/.makepad/mcp/<exe-stem>.json {pid, port, token, title} (0600 in a 0700 dir), removed when the provider changes or the panel goes. Calls queue to the UI thread and run through EngineCore::call_external: a card in the transcript, destructive calls held for the person's confirm (the pane opens for it), the result sent back when the card lands.
- mcp::mcpb: "Connect to Claude Desktop" writes <exe-stem>.mcpb (a stored zip, manifest_version 0.3, binary server = this executable with --mcp) and opens it so Claude Desktop shows its install dialog.
- platform mcp_relay: `<app> --mcp`, checked first in app_main before any Cx, window, GPU or audio, relays newline JSON-RPC on stdio to the running app's endpoint. It answers initialize/ping itself and tools/list from the app's last list while the app is down, starts the app (detached, MAKEPAD_AI_PROVIDER=claude-desktop, engine up with the pane closed) on the first call that needs it, waits up to 20 s for its file, and exits when stdin closes.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-25 00:43:05 +02:00

34 lines
1.5 KiB
TOML

# The AI services layer.
#
# One conversation, many apps. An app EXPOSES an AI service: a manifest (who
# it is, a short brief, the tools it will execute) and a port that receives
# calls and answers them. A HOST owns the conversation: the desktop (wm's
# slide-in chat pane) or an app that embeds the chat panel itself. The host's
# engine aggregates every connected service into one tool table, drives the
# model, routes each call to the service that owns it, and shows the result.
#
# `wire` + `port` are what every app links (platform-only, no widgets, no
# model runtime). The `engine` feature is what a host links: the agent seam,
# the hub's providers and the local model election.
#
# Design of record: local/agent_state/aichat/DESIGN.md
[package]
name = "makepad-ai-services"
version = "0.1.0"
edition = "2021"
license = "MIT OR Apache-2.0"
description = "What an app exposes to a central AI chat (manifest, tools, calls, results) and the engine that drives many apps from one conversation"
[features]
default = []
# The real models: the hub's local engine and its cloud providers. Off by
# default so an app that only exposes a service never links a model runtime.
engine = ["makepad-ai-hub"]
[dependencies]
makepad-platform = { path = "../../../platform" }
makepad-micro-serde = { path = "../../micro_serde" }
makepad-strict-json = { path = "../../strict_json" }
makepad-bounded-http = { path = "../../bounded_http" }
makepad-ai-hub = { path = "../hub", default-features = false, features = ["llm"], optional = true }