mhc-desktop-backend
Backend HTTP/SSE service for the mhc-desktop Skill/MCP client.
- Stack: FastAPI + minimal-harness + mh-service-kit + openai + anthropic
- Default port:
8765(MHC_PORT) - Dev: hot-reload via uvicorn (
MHC_RELOAD=1)
Endpoints
| Method | Path | Purpose |
|---|---|---|
GET |
/api/v1/health |
Service identity + version + data_dir |
GET |
/ready |
Liveness probe |
GET |
/api/v1/providers |
List configured providers (api_key masked) |
GET |
/api/v1/providers/{name} |
Fetch one provider |
POST |
/api/v1/providers[?preset_id=...] |
Create; preset_id seeds the body from a built-in preset |
PUT |
/api/v1/providers/{name} |
Update fields |
DELETE |
/api/v1/providers/{name} |
Remove |
GET |
/api/v1/providers/presets |
Built-in preset templates |
POST |
/api/v1/chat |
SSE chat — streams event: chunk / event: done / event: error |
GET |
/api/v1/onboarding |
First-run tour cards (centered / media-text / media-top), localised by Accept-Language; full i18n dicts included |
Provider config
Lives at ~/.mhc-desktop/providers.json. Schema is byte-for-byte compatible
with mh-local's ~/.config/mh-local/providers.json — copy a file between the
two and it just works.
[
{
"name": "openai",
"provider_type": "openai",
"api_key": "sk-...",
"base_url": "https://api.openai.com/v1",
"default_model": "gpt-4o-mini",
"description": "OpenAI official API",
"models": [{"code": "gpt-4o-mini", "display_name": "GPT-4o mini", "max_context": 128000}],
"created_at": "...",
"updated_at": "..."
}
]
Dev
uv run python -m mhc_desktop_backend
# health: http://127.0.0.1:8765/api/v1/health
# docs: http://127.0.0.1:8765/docs
Or use the workspace helper:
bash scripts/dev-mhc-desktop.sh
Starts backend (hot reload) + frontend (HMR) on :5180, tails logs to .logs/.
Env
| Var | Default | Purpose |
|---|---|---|
MHC_HOST |
127.0.0.1 |
Bind address |
MHC_PORT |
8765 |
HTTP port |
MHC_DEBUG |
1 |
Toggle debug mode flag (also enables permissive CORS) |
MHC_RELOAD |
1 |
Uvicorn hot reload (dev only) |
MH_LOG_LEVEL |
INFO |
Root log level |
Build
uv build
Wheel: dist/mhc_desktop_backend-*.whl.
Tools subsystem
A "Tool" is the third concept alongside Skills and MCP. See
mhc_desktop_backend/tools/ for the implementation:
models.py—Tooldataclass + slug rules; slugs disallow::to keep the MCP-vs-Tool distinction explicit in thenamefield of ToolCall TypedDicts.store.py— file-backed CRUD ontools-state.json; bundled tools are code-side, not on disk, but the store lists them alongside user tools.bundled/—now(ISO 8601 timestamp) anduuid(v4) trivial callables for E2E verification.imports.py—import_local_toolcompiles + caches Python source strings;run_toolis the cancellable, time-bounded executor.__init__.py— public surface +build_streaming_toolwrapping aToolinto a minimal-harnessStreamingTool.
API
GET /api/v1/tools— list (bundled first, then user).GET /api/v1/tools/bundled— bundled slugs only.POST /api/v1/tools— create / register.GET /api/v1/tools/{slug}— detail (auth header redacted).PUT /api/v1/tools/{slug}— update.PUT /api/v1/tools/{slug}/enabled— flip on/off.DELETE /api/v1/tools/{slug}— remove.POST /api/v1/tools/import-source— compile + register a Python source string.GET /api/v1/tools/{slug}/export— JSON manifest.
Bundled skill mcp-tool-mix
Drives the goal's most complex scenario: a single skill that
instructs the model to call both an MCP (dummy-mcp::add) and a
local Tool (now). Used by scripts/e2e-tools.mjs Check 8 to
verify the capsule distinction works end-to-end.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mhc_desktop_backend-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mhc_desktop_backend-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63970096ef0a527dffa4bb7a74dbfeb09fd4868fa9f8b4badcd50b878d42af58
|
|
| MD5 |
507ebfacdea6d5ec74306dd957a55a30
|
|
| BLAKE2b-256 |
744396a5c9de3f4fe584a2f68c8c9b0fd0054dda9d908223b9365dee06f59220
|