Skip to content

Build your personal knowledge base with Trilium Notes

feat(options/llm): display endpoint URL

Elian Dorane9a876e8f02e
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index a603b14317..5605e5bed9 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2338,6 +2338,8 @@
"mcp_title": "MCP (Model Context Protocol)",
"mcp_enabled": "Enable MCP server",
"mcp_enabled_description": "Expose a Model Context Protocol (MCP) endpoint so that AI coding assistants (e.g. Claude Code, GitHub Copilot) can read and modify your notes. The endpoint is only accessible from localhost.",
+ "mcp_endpoint_title": "Endpoint URL",
+ "mcp_endpoint_description": "Add this URL to your AI assistant's MCP configuration:",
"tools": {
"search_notes": "Search notes",
"get_note": "Get note",
diff --git a/apps/client/src/widgets/type_widgets/options/llm.tsx b/apps/client/src/widgets/type_widgets/options/llm.tsx
index 83793be0ac..1c24c6abfa 100644
--- a/apps/client/src/widgets/type_widgets/options/llm.tsx
+++ b/apps/client/src/widgets/type_widgets/options/llm.tsx
@@ -1,12 +1,13 @@
import { useCallback, useMemo, useState } from "preact/hooks";
+
+import dialog from "../../../services/dialog";
import { t } from "../../../services/i18n";
+import ActionButton from "../../react/ActionButton";
import Button from "../../react/Button";
import FormCheckbox from "../../react/FormCheckbox";
+import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
import OptionsSection from "./components/OptionsSection";
import AddProviderModal, { type LlmProviderConfig, PROVIDER_TYPES } from "./llm/AddProviderModal";
-import ActionButton from "../../react/ActionButton";
-import dialog from "../../../services/dialog";
-import { useTriliumOption, useTriliumOptionBool } from "../../react/hooks";
export default function LlmSettings() {
const [providersJson, setProvidersJson] = useTriliumOption("llmProviders");
@@ -65,8 +66,14 @@ export default function LlmSettings() {
);
}
+function getMcpEndpointUrl() {
+ const port = window.location.port || (window.location.protocol === "https:" ? "443" : "80");
+ return `http://localhost:${port}/mcp`;
+}
+
function McpSettings() {
const [mcpEnabled, setMcpEnabled] = useTriliumOptionBool("mcpEnabled");
+ const endpointUrl = useMemo(() => getMcpEndpointUrl(), []);
return (
<OptionsSection title={t("llm.mcp_title")}>
@@ -77,6 +84,20 @@ function McpSettings() {
currentValue={mcpEnabled}
onChange={setMcpEnabled}
/>
+
+ {mcpEnabled && (
+ <>
+ <hr />
+ <h5>{t("llm.mcp_endpoint_title")}</h5>
+ <p className="form-text">{t("llm.mcp_endpoint_description")}</p>
+ <input
+ type="text"
+ className="form-control"
+ value={endpointUrl}
+ readOnly
+ />
+ </>
+ )}
</OptionsSection>
);
}