mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 05:59:36 +08:00
Per-account MCP Services and CLI Apps — the two ways a deployment plugs in tools DeepTutor never shipped — plus the isolation that makes them safe on a shared install. - MCP Services: a 45-entry curated store of hosted servers each account installs for itself, OAuth 2.1 (PKCE + dynamic client registration) for the servers that require it, static keys held by reference and resolved in memory at connect time, stdio refused for self-service. Settings no longer configures MCP; /settings/mcp redirects to the store. - CLI Apps: 101 tools snapshotted from the two CLI-Anything registries. Installs are admin-only, the registry's install_cmd is parsed into an argv we build rather than executed, npm install scripts are forced off, and 66 first-party entries are pinned to one reviewed commit. Apps land in data/cli-apps, one environment each, mounted read-only into the runner. - Credentials that authorise a person move to data/system, the one branch the exec sandbox never mounts: Codex tokens relocate themselves on first use (refusing to follow a symlink), per-user MCP configs and keys land beside them. - Grants gain a cli_apps whitelist with the same deny-by-default posture as MCP tools; a per-turn registry view keeps one owner's provider tools out of the process-global registry and refuses an unauthorised tool at execute, not just in the manifest. - The composer reports what filled this turn's context window, a gutter rail jumps back through long conversations, and the workspace collapses to a drawer on small screens. - The composer keeps focus after sending and across tab switches (#720); released images carry provenance and SBOM attestations (#722). README prose, all ten translated READMEs, and the docs-site pages that named Settings → MCP are updated to match. Release notes: assets/releases/ver1-5-7.md
114 lines
4.0 KiB
TypeScript
114 lines
4.0 KiB
TypeScript
"use client";
|
|
|
|
import { Lock, Plus, Trash2 } from "lucide-react";
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
import { inputClass, labelClass } from "@/components/mcp/styles";
|
|
import type { McpKvPair } from "@/lib/mcp-api";
|
|
|
|
/**
|
|
* A stored credential arrives as ``${secret:server/field}``: the value itself is
|
|
* never returned to this page. Detected here so the row can say so.
|
|
*/
|
|
export function isStoredCredential(value: string): boolean {
|
|
return value.startsWith("${secret:") && value.endsWith("}");
|
|
}
|
|
|
|
/**
|
|
* Editable key/value rows (environment variables, HTTP headers).
|
|
*
|
|
* Values are masked: on a self-configured server a header or env value is, in
|
|
* practice, always the credential, and the backend stores it apart from the
|
|
* config for exactly that reason.
|
|
*/
|
|
export default function KeyValueEditor({
|
|
label,
|
|
pairs,
|
|
onChange,
|
|
keyPlaceholder,
|
|
valuePlaceholder,
|
|
}: {
|
|
label: string;
|
|
pairs: McpKvPair[];
|
|
onChange: (pairs: McpKvPair[]) => void;
|
|
keyPlaceholder: string;
|
|
valuePlaceholder: string;
|
|
}) {
|
|
const { t } = useTranslation();
|
|
const update = (idx: number, patch: Partial<McpKvPair>) => {
|
|
onChange(pairs.map((p, i) => (i === idx ? { ...p, ...patch } : p)));
|
|
};
|
|
const remove = (idx: number) => {
|
|
onChange(pairs.filter((_, i) => i !== idx));
|
|
};
|
|
const add = () => {
|
|
onChange([...pairs, { key: "", value: "" }]);
|
|
};
|
|
return (
|
|
<div>
|
|
<label className={labelClass}>{label}</label>
|
|
<div className="space-y-2">
|
|
{pairs.map((pair, idx) => (
|
|
<div key={idx} className="flex items-center gap-2">
|
|
<input
|
|
className={`${inputClass} font-mono`}
|
|
value={pair.key}
|
|
onChange={(e) => update(idx, { key: e.target.value })}
|
|
placeholder={keyPlaceholder}
|
|
spellCheck={false}
|
|
autoComplete="off"
|
|
/>
|
|
{isStoredCredential(pair.value) ? (
|
|
// A saved credential comes back as a reference, never as its
|
|
// value. Showing the placeholder as editable text would invite
|
|
// saving it *as* the credential, so the row reads as configured
|
|
// and offers a deliberate replace instead.
|
|
<div
|
|
className={`${inputClass} flex items-center justify-between gap-2 text-[var(--muted-foreground)]`}
|
|
>
|
|
<span className="inline-flex items-center gap-1.5">
|
|
<Lock className="h-3 w-3" />
|
|
{t("Configured")}
|
|
</span>
|
|
<button
|
|
type="button"
|
|
onClick={() => update(idx, { value: "" })}
|
|
className="rounded px-1.5 text-[11px] hover:text-[var(--foreground)]"
|
|
>
|
|
{t("Replace")}
|
|
</button>
|
|
</div>
|
|
) : (
|
|
<input
|
|
className={`${inputClass} font-mono`}
|
|
type="password"
|
|
value={pair.value}
|
|
onChange={(e) => update(idx, { value: e.target.value })}
|
|
placeholder={valuePlaceholder}
|
|
spellCheck={false}
|
|
autoComplete="off"
|
|
/>
|
|
)}
|
|
<button
|
|
type="button"
|
|
onClick={() => remove(idx)}
|
|
aria-label={t("Remove")}
|
|
className="shrink-0 rounded-md p-2 text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-red-500"
|
|
>
|
|
<Trash2 className="h-3.5 w-3.5" />
|
|
</button>
|
|
</div>
|
|
))}
|
|
<button
|
|
type="button"
|
|
onClick={add}
|
|
className="inline-flex items-center gap-1.5 rounded-md border border-[var(--border)] bg-[var(--card)] px-2.5 py-1.5 text-[11.5px] font-medium text-[var(--muted-foreground)] transition-colors hover:bg-[var(--muted)] hover:text-[var(--foreground)]"
|
|
>
|
|
<Plus className="h-3 w-3" />
|
|
{t("Add row")}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|