Skip to content

⭐️⭐️⭐️ Open-source, self-hosted alternative to Linear and Plane. Project management and issue tracking where teams and AI agents work side by side to plan and ship products.

feat(god): instance setting mcpEnabled as enabled by default (#227)

ryakel7d680aeea226
diff --git a/apps/api/src/modules/god/__tests__/integration/god-project-defaults.test.ts b/apps/api/src/modules/god/__tests__/integration/god-project-defaults.test.ts
new file mode 100644
index 00000000..2c5fc094
--- /dev/null
+++ b/apps/api/src/modules/god/__tests__/integration/god-project-defaults.test.ts
@@ -0,0 +1,93 @@
+import { describe, it, expect, beforeEach } from 'bun:test';
+import { resetDb } from '#tests/helpers/db';
+import { addUser, setup } from '../helpers';
+
+// The instance-wide project defaults under god mode: what a project starts with
+// when it is created. Only the instance owner may read or change them, and a
+// change reaches new projects only — the ones that already exist keep whatever
+// they were set to.
+
+describe('god project defaults', () => {
+ beforeEach(async () => {
+ await resetDb();
+ });
+
+ describe('access', () => {
+ it('refuses both routes for a user who is not the instance owner', async () => {
+ await setup();
+ const outsider = await addUser();
+
+ expect((await outsider.api.god['project-defaults'].get()).status).toBe(403);
+ expect((await outsider.api.god['project-defaults'].put({ mcpEnabled: false })).status).toBe(
+ 403,
+ );
+ });
+ });
+
+ describe('settings — GET/PUT /god/project-defaults', () => {
+ it('starts with MCP on, so an instance driven through MCP needs no toggle', async () => {
+ const { god } = await setup();
+
+ const res = await god.api.god['project-defaults'].get();
+
+ expect(res.status).toBe(200);
+ expect(res.data?.mcpEnabled).toBe(true);
+ });
+
+ it('stores a change and reads it back', async () => {
+ const { god } = await setup();
+
+ const put = await god.api.god['project-defaults'].put({ mcpEnabled: false });
+ const get = await god.api.god['project-defaults'].get();
+
+ expect(put.status).toBe(200);
+ expect(put.data?.mcpEnabled).toBe(false);
+ expect(get.data?.mcpEnabled).toBe(false);
+ });
+ });
+
+ describe('effect on project creation', () => {
+ it('creates a project with MCP on under the default', async () => {
+ const { god } = await setup();
+
+ const created = await god.api.projects.post({ key: 'MKT', name: 'Marketing' });
+ const settings = await god.api.projects({ projectKey: 'MKT' }).settings.get();
+
+ expect(created.status).toBe(201);
+ expect(settings.data?.mcpEnabled).toBe(true);
+ });
+
+ it('creates a project with MCP off once the default is turned off', async () => {
+ const { god } = await setup();
+ await god.api.god['project-defaults'].put({ mcpEnabled: false });
+
+ await god.api.projects.post({ key: 'MKT', name: 'Marketing' });
+ const settings = await god.api.projects({ projectKey: 'MKT' }).settings.get();
+
+ expect(settings.data?.mcpEnabled).toBe(false);
+ });
+
+ it('leaves projects that already exist untouched', async () => {
+ const { god } = await setup();
+ await god.api.projects.post({ key: 'MKT', name: 'Marketing' });
+ const before = await god.api.projects({ projectKey: 'MKT' }).settings.get();
+ expect(before.data?.mcpEnabled).toBe(true);
+
+ await god.api.god['project-defaults'].put({ mcpEnabled: false });
+
+ const after = await god.api.projects({ projectKey: 'MKT' }).settings.get();
+ expect(after.data?.mcpEnabled).toBe(true);
+ });
+
+ it('applies the default to a project created by any member, not just the owner', async () => {
+ const { god } = await setup();
+ await god.api.god['project-defaults'].put({ mcpEnabled: false });
+ const alice = await addUser();
+
+ await alice.api.projects.post({ key: 'ALC', name: 'Alice Only' });
+ const settings = await alice.api.projects({ projectKey: 'ALC' }).settings.get();
+
+ expect(settings.data?.mcpEnabled).toBe(false);
+ });
+ });
+});
diff --git a/apps/api/src/modules/god/__tests__/integration/god-projects.test.ts b/apps/api/src/modules/god/__tests__/integration/god-projects.test.ts
index 42729013..18874de1 100644
--- a/apps/api/src/modules/god/__tests__/integration/god-projects.test.ts
+++ b/apps/api/src/modules/god/__tests__/integration/god-projects.test.ts
@@ -40,7 +40,7 @@ describe('god projects', () => {
expect(res.data?.items[0]).toMatchObject({
key: 'ALC',
name: 'Alice Only',
- mcpEnabled: false,
+ mcpEnabled: true,
memberCount: 1,
issueCount: 0,
});
diff --git a/apps/api/src/modules/god/index.ts b/apps/api/src/modules/god/index.ts
index 05a36e60..ff467127 100644
--- a/apps/api/src/modules/god/index.ts
+++ b/apps/api/src/modules/god/index.ts
@@ -49,10 +49,13 @@ import {
setStorageSettings,
getHotkeySettings,
setHotkeySettings,
+ getProjectDefaults,
+ setProjectDefaults,
} from '#modules/settings/service';
import { getUpdateStatus } from '#modules/settings/updates';
import {
HotkeyCombosSchema,
+ ProjectDefaultsSchema,
StorageSettingsSchema,
UpdateStatusSchema,
} from '#modules/settings/model';
@@ -183,6 +186,24 @@ export const godRoutes = new Elysia({ name: 'god', detail: { tags: ['God'] } })
},
})
+ .get('/god/project-defaults', () => getProjectDefaults(), {
+ response: { 200: ProjectDefaultsSchema, ...errors(401, 403) },
+ detail: {
+ summary: 'Get project defaults',
+ description: 'Get what a newly created project starts with on this instance.',
+ },
+ })
+
+ .put('/god/project-defaults', ({ body }) => setProjectDefaults(body), {
+ body: ProjectDefaultsSchema,
+ response: { 200: ProjectDefaultsSchema, ...errors(400, 401, 403) },
+ detail: {
+ summary: 'Update project defaults',
+ description:
+ 'Update what a newly created project starts with. Projects that already exist are untouched; each setting stays editable per project.',
+ },
+ })
+
.get('/god/hotkey-settings', () => getHotkeySettings(), {
response: { 200: HotkeyCombosSchema, ...errors(401, 403) },
detail: {
diff --git a/apps/api/src/modules/projects/__tests__/integration/projects.test.ts b/apps/api/src/modules/projects/__tests__/integration/projects.test.ts
index 3b353321..733963d6 100644
--- a/apps/api/src/modules/projects/__tests__/integration/projects.test.ts
+++ b/apps/api/src/modules/projects/__tests__/integration/projects.test.ts
@@ -541,12 +541,12 @@ describe('projects', () => {
// MCP toggle. A test forges it to exercise that path without going through /mcp.
const asMcp = { headers: { 'x-mcp-loopback': '1' } };
- it('defaults a new project to MCP disabled', async () => {
+ it('defaults a new project to the instance project default (MCP on)', async () => {
const { api } = await signUpClient();
await api.projects.post({ key: 'MKT', name: 'Marketing' });
const view = await viewOf(api, 'MKT');
- expect(view.data?.project.mcpEnabled).toBe(false);
+ expect(view.data?.project.mcpEnabled).toBe(true);
});
it('lets an owner enable then disable MCP for the project', async () => {
@@ -578,6 +578,7 @@ describe('projects', () => {
it('blocks an MCP call to a project with MCP disabled, but not a web call', async () => {
const { api } = await signUpClient();
await api.projects.post({ key: 'MKT', name: 'Marketing' });
+ await api.projects({ projectKey: 'MKT' }).settings.patch({ mcpEnabled: false });
// Web request (no MCP marker) reaches the disabled project fine.
expect((await api.projects({ projectKey: 'MKT' }).get()).status).toBe(200);
@@ -598,6 +599,7 @@ describe('projects', () => {
it('blocks an MCP call on an entity-by-id route of a disabled project', async () => {
const { api } = await signUpClient();
await api.projects.post({ key: 'MKT', name: 'Marketing' });
+ await api.projects({ projectKey: 'MKT' }).settings.patch({ mcpEnabled: false });
const backlog = (await viewOf(api, 'MKT')).data!.columns.find((c) => c.name === 'Backlog')!;
const issue = (
await api
@@ -614,7 +616,7 @@ describe('projects', () => {
const { api } = await signUpClient();
await api.projects.post({ key: 'ON', name: 'Enabled' });
await api.projects.post({ key: 'OFF', name: 'Disabled' });
- await api.projects({ projectKey: 'ON' }).settings.patch({ mcpEnabled: true });
+ await api.projects({ projectKey: 'OFF' }).settings.patch({ mcpEnabled: false });
// A web list shows both; an MCP list shows only the enabled project.
expect((await api.projects.get()).data?.map((p) => p.key).sort()).toEqual(['OFF', 'ON']);
@@ -623,13 +625,13 @@ describe('projects', () => {
});
describe('settings', () => {
- it('defaults a new project to MCP off', async () => {
+ it('defaults a new project to the instance project default (MCP on)', async () => {
const { api } = await signUpClient();
await api.projects.post({ key: 'MKT', name: 'Marketing' });
const res = await api.projects({ projectKey: 'MKT' }).settings.get();
expect(res.status).toBe(200);
- expect(res.data).toMatchObject({ mcpEnabled: false });
+ expect(res.data).toMatchObject({ mcpEnabled: true });
});
it('starts a new project with every optional section enabled', async () => {
diff --git a/apps/api/src/modules/projects/service.ts b/apps/api/src/modules/projects/service.ts
index a72a9b84..f0fb97b7 100644
--- a/apps/api/src/modules/projects/service.ts
+++ b/apps/api/src/modules/projects/service.ts
@@ -17,6 +17,7 @@ import {
} from '#shared/permissions';
import { getProjectSetting, setProjectSetting } from '#shared/project-settings';
import { deleteThreadsWhere } from '#modules/agents/core/runtime/memory';
+import { getProjectDefaults } from '#modules/settings/service';
// Data access for projects: the top-level container that groups its own columns,
// issue types, labels, assignees, custom fields, issues, saved views, and
@@ -235,10 +236,18 @@ export async function createProject(
},
ownerId: string,
): Promise<ProjectRow> {
+ // What a new project starts with, set instance-wide in god mode. Read before the
+ // transaction opens so the settings lookup is not part of it.
+ const defaults = await getProjectDefaults();
return db.transaction(async (tx) => {
const [row] = await tx
.insert(project)
- .values({ key: input.key, name: input.name, description: input.description ?? '' })
+ .values({
+ key: input.key,
+ name: input.name,
+ description: input.description ?? '',
+ mcpEnabled: defaults.mcpEnabled,
+ })
.returning();
await tx.insert(projectMember).values({ projectId: row.id, userId: ownerId, role: 'owner' });
// Every project starts with a default "Member" role, assigned to members that
diff --git a/apps/api/src/modules/settings/model.ts b/apps/api/src/modules/settings/model.ts
index 7f519f4f..1db1420e 100644
--- a/apps/api/src/modules/settings/model.ts
+++ b/apps/api/src/modules/settings/model.ts
@@ -7,6 +7,10 @@ export const StorageSettingsSchema = t.Object({
projectQuotaMb: t.Number(),
});
+export const ProjectDefaultsSchema = t.Object({
+ mcpEnabled: t.Boolean(),
+});
+
// A command id bound to a combination written as modifier tokens plus a key
// ('mod+k', 'n'). The set of commands lives in the web app (its lib/hotkeys), so
// the API checks the shape and stores the map as given.
diff --git a/apps/api/src/modules/settings/service.ts b/apps/api/src/modules/settings/service.ts
index dce83b22..f7680ca3 100644
--- a/apps/api/src/modules/settings/service.ts
+++ b/apps/api/src/modules/settings/service.ts
@@ -87,6 +87,39 @@ export function mimeAllowed(contentType: string, allowed: string[]): boolean {
);
}
+// Instance-wide project defaults (app_setting key 'projects'): what a newly
+// created project starts with. Only the defaults live here — every one of them
+// stays editable per project afterwards, so this decides the starting value and
+// nothing else.
+
+const PROJECT_DEFAULTS_SETTING_KEY = 'projects';
+
+export interface ProjectDefaults {
+ // Whether a new project starts reachable over MCP. On: an instance driven
+ // through MCP does not have to remember the per-project toggle. This is a
+ // visibility default, not an access grant — a project still only appears to a
+ // member holding a key, exactly as it does today.
+ mcpEnabled: boolean;
+}
+
+function defaultProjectDefaults(): ProjectDefaults {
+ return { mcpEnabled: true };
+}
+
+export async function getProjectDefaults(): Promise<ProjectDefaults> {
+ const stored = await getSetting<Partial<ProjectDefaults>>(PROJECT_DEFAULTS_SETTING_KEY);
+ // Merge over the default so a value written before a field was added stays valid.
+ return { ...defaultProjectDefaults(), ...(stored ?? {}) };
+}
+
+export async function setProjectDefaults(
+ patch: Partial<ProjectDefaults>,
+): Promise<ProjectDefaults> {
+ const next = { ...(await getProjectDefaults()), ...patch };
+ await setSetting(PROJECT_DEFAULTS_SETTING_KEY, next);
+ return next;
+}
+
// The instance keyboard shortcuts (app_setting key 'hotkeys'): the combination
// each command is bound to for everyone on this instance. Only the bindings
// changed in god mode are stored; the web app fills the rest from its built-in
diff --git a/apps/web/messages/ar/god.json b/apps/web/messages/ar/god.json
index 9532baea..ccd8c851 100644
--- a/apps/web/messages/ar/god.json
+++ b/apps/web/messages/ar/god.json
@@ -120,6 +120,13 @@
"noMembersTitle": "لا يوجد أعضاء",
"noMembersHint": "محدش هيقدر يوصل للمشروع ده لحد ما حد يتدعى ليه."
},
+ "general": {
+ "saved": "Project defaults saved",
+ "projectDefaults": "Project defaults",
+ "projectDefaultsHint": "What a project starts with when it is created. Projects that already exist are untouched, and every default here stays editable per project.",
+ "mcpEnabled": "Enable MCP on new projects",
+ "mcpEnabledHint": "A new project is reachable over MCP straight away, instead of waiting for the per-project toggle. It stays visible only to members holding a key, exactly as it is today."
+ },
"authentication": {
"saved": "تم حفظ إعدادات المصادقة",
"registration": "التسجيل",
diff --git a/apps/web/messages/ar/sections.json b/apps/web/messages/ar/sections.json
index 70a6d37a..2f59513b 100644
--- a/apps/web/messages/ar/sections.json
+++ b/apps/web/messages/ar/sections.json
@@ -19,6 +19,10 @@
"label": "المشاريع",
"description": "كل مشروع على النسخة دي: كل واحد فيه إيه، وآخر مرة كان نشط فيها، ومين يقدر يدخله."
},
+ "general": {
+ "label": "General",
+ "description": "The instance-wide defaults a new project starts with. Each one stays editable per project afterwards."
+ },
"authentication": {
"label": "المصادقة",
"description": "مين يقدر يسجّل في النسخة دي، والحسابات بتتأكّد إزاي، والمزوّدين اللي الناس بتدخل عن طريقهم."
diff --git a/apps/web/messages/en/god.json b/apps/web/messages/en/god.json
index 89cee049..4d464668 100644
--- a/apps/web/messages/en/god.json
+++ b/apps/web/messages/en/god.json
@@ -120,6 +120,13 @@
"noMembersTitle": "No members",
"noMembersHint": "Nobody can reach this project until someone is invited to it."
},
+ "general": {
+ "saved": "Project defaults saved",
+ "projectDefaults": "Project defaults",
+ "projectDefaultsHint": "What a project starts with when it is created. Projects that already exist are untouched, and every default here stays editable per project.",
+ "mcpEnabled": "Enable MCP on new projects",
+ "mcpEnabledHint": "A new project is reachable over MCP straight away, instead of waiting for the per-project toggle. It stays visible only to members holding a key, exactly as it is today."
+ },
"authentication": {
"saved": "Authentication settings saved",
"registration": "Registration",
diff --git a/apps/web/messages/en/sections.json b/apps/web/messages/en/sections.json
index 2350faa2..bbd7c3d1 100644
--- a/apps/web/messages/en/sections.json
+++ b/apps/web/messages/en/sections.json
@@ -19,6 +19,10 @@
"label": "Projects",
"description": "Every project on this instance: what each one holds, when it was last active, and who can reach it."
},
+ "general": {
+ "label": "General",
+ "description": "The instance-wide defaults a new project starts with. Each one stays editable per project afterwards."
+ },
"authentication": {
"label": "Authentication",
"description": "Who may register on this instance, how accounts are confirmed, and the providers people sign in with."
diff --git a/apps/web/messages/ru/god.json b/apps/web/messages/ru/god.json
index 67acd243..e09e947e 100644
--- a/apps/web/messages/ru/god.json
+++ b/apps/web/messages/ru/god.json
@@ -120,6 +120,13 @@
"noMembersTitle": "Нет участников",
"noMembersHint": "Никто не видит этот проект, пока кого-нибудь не пригласят."
},
+ "general": {
+ "saved": "Project defaults saved",
+ "projectDefaults": "Project defaults",
+ "projectDefaultsHint": "What a project starts with when it is created. Projects that already exist are untouched, and every default here stays editable per project.",
+ "mcpEnabled": "Enable MCP on new projects",
+ "mcpEnabledHint": "A new project is reachable over MCP straight away, instead of waiting for the per-project toggle. It stays visible only to members holding a key, exactly as it is today."
+ },
"authentication": {
"saved": "Настройки аутентификации сохранены",
"registration": "Регистрация",
diff --git a/apps/web/messages/ru/sections.json b/apps/web/messages/ru/sections.json
index 89bd6c0a..4fe222dd 100644
--- a/apps/web/messages/ru/sections.json
+++ b/apps/web/messages/ru/sections.json
@@ -19,6 +19,10 @@
"label": "Проекты",
"description": "Все проекты этого инстанса: что в каждом, когда была последняя активность и у кого есть доступ."
},
+ "general": {
+ "label": "General",
+ "description": "The instance-wide defaults a new project starts with. Each one stays editable per project afterwards."
+ },
"authentication": {
"label": "Аутентификация",
"description": "Кто может регистрироваться в этом инстансе, как подтверждаются аккаунты и через каких провайдеров люди входят."
diff --git a/apps/web/messages/uk/god.json b/apps/web/messages/uk/god.json
index c8147032..51994f31 100644
--- a/apps/web/messages/uk/god.json
+++ b/apps/web/messages/uk/god.json
@@ -120,6 +120,13 @@
"noMembersTitle": "Немає учасників",
"noMembersHint": "Ніхто не бачить цей проєкт, доки когось не запросять."
},
+ "general": {
+ "saved": "Project defaults saved",
+ "projectDefaults": "Project defaults",
+ "projectDefaultsHint": "What a project starts with when it is created. Projects that already exist are untouched, and every default here stays editable per project.",
+ "mcpEnabled": "Enable MCP on new projects",
+ "mcpEnabledHint": "A new project is reachable over MCP straight away, instead of waiting for the per-project toggle. It stays visible only to members holding a key, exactly as it is today."
+ },
"authentication": {
"saved": "Налаштування автентифікації збережено",
"registration": "Реєстрація",
diff --git a/apps/web/messages/uk/sections.json b/apps/web/messages/uk/sections.json
index 07b88f43..def09607 100644
--- a/apps/web/messages/uk/sections.json
+++ b/apps/web/messages/uk/sections.json
@@ -19,6 +19,10 @@
"label": "Проєкти",
"description": "Усі проєкти цього інстансу: що в кожному, коли була остання активність і хто має доступ."
},
+ "general": {
+ "label": "General",
+ "description": "The instance-wide defaults a new project starts with. Each one stays editable per project afterwards."
+ },
"authentication": {
"label": "Автентифікація",
"description": "Хто може реєструватися в цьому інстансі, як підтверджуються акаунти і через яких провайдерів люди входять."
diff --git a/apps/web/messages/zh-CN/god.json b/apps/web/messages/zh-CN/god.json
index 8c972dd3..bafbe37c 100644
--- a/apps/web/messages/zh-CN/god.json
+++ b/apps/web/messages/zh-CN/god.json
@@ -120,6 +120,13 @@
"noMembersTitle": "暂无成员",
"noMembersHint": "需要邀请成员后才能访问此项目。"
},
+ "general": {
+ "saved": "Project defaults saved",
+ "projectDefaults": "Project defaults",
+ "projectDefaultsHint": "What a project starts with when it is created. Projects that already exist are untouched, and every default here stays editable per project.",
+ "mcpEnabled": "Enable MCP on new projects",
+ "mcpEnabledHint": "A new project is reachable over MCP straight away, instead of waiting for the per-project toggle. It stays visible only to members holding a key, exactly as it is today."
+ },
"authentication": {
"saved": "身份验证设置已保存",
"registration": "注册",
diff --git a/apps/web/messages/zh-CN/sections.json b/apps/web/messages/zh-CN/sections.json
index e2a05f76..c236428a 100644
--- a/apps/web/messages/zh-CN/sections.json
+++ b/apps/web/messages/zh-CN/sections.json
@@ -19,6 +19,10 @@
"label": "项目",
"description": "此实例中的所有项目,包括项目内容、最近活动时间和访问成员。"
},
+ "general": {
+ "label": "General",
+ "description": "The instance-wide defaults a new project starts with. Each one stays editable per project afterwards."
+ },
"authentication": {
"label": "身份验证",
"description": "设置谁可以注册、如何验证账户以及可用的外部登录提供商。"
diff --git a/apps/web/src/app/god/general/page.tsx b/apps/web/src/app/god/general/page.tsx
new file mode 100644
index 00000000..cc32f3a5
--- /dev/null
+++ b/apps/web/src/app/god/general/page.tsx
@@ -0,0 +1,5 @@
+import GodGeneralPage from '@/features/god/GodGeneralPage';
+
+export default function Page() {
+ return <GodGeneralPage />;
+}
diff --git a/apps/web/src/features/god/GodGeneralPage.tsx b/apps/web/src/features/god/GodGeneralPage.tsx
new file mode 100644
index 00000000..cebe9a19
--- /dev/null
+++ b/apps/web/src/features/god/GodGeneralPage.tsx
@@ -0,0 +1,65 @@
+'use client';
+
+import { toast } from 'sonner';
+import { useTranslations } from 'next-intl';
+import SettingsCard from '@/components/common/page/SettingsCard';
+import SettingsRow from '@/components/common/page/SettingsRow';
+import SettingsSection from '@/components/common/page/SettingsSection';
+import { Switch } from '@/components/ui/switch';
+import GodSectionPage from './components/GodSectionPage';
+import GodSettingsGate from './components/GodSettingsGate';
+import {
+ useInstanceProjectDefaultsQuery,
+ useUpdateInstanceProjectDefaults,
+} from './services/god.service';
+import type { ProjectDefaults } from '@/lib/api';
+
+// General: the instance-wide defaults that decide what a new project starts with.
+// Each one stays editable per project afterwards, and projects that already exist
+// are untouched by a change here.
+export default function GodGeneralPage() {
+ const query = useInstanceProjectDefaultsQuery();
+
+ return (
+ <GodSettingsGate slug="general" data={query.data}>
+ {(defaults) => <GeneralForm defaults={defaults} />}
+ </GodSettingsGate>
+ );
+}
+
+function GeneralForm({ defaults }: { defaults: ProjectDefaults }) {
+ const t = useTranslations('god.general');
+ const update = useUpdateInstanceProjectDefaults();
+
+ // A single toggle, so it saves on change rather than behind a Save button.
+ async function setMcpEnabled(mcpEnabled: boolean) {
+ try {
+ await update.mutateAsync({ ...defaults, mcpEnabled });
+ toast.success(t('saved'));
+ } catch {
+ // The failure already surfaced through the global mutation error toast.
+ }
+ }
+
+ return (
+ <GodSectionPage slug="general">
+ <div className="space-y-8">
+ <SettingsSection title={t('projectDefaults')} description={t('projectDefaultsHint')}>
+ <SettingsCard className="divide-y divide-border/60">
+ <SettingsRow
+ title={t('mcpEnabled')}
+ description={t('mcpEnabledHint')}
+ control={
+ <Switch
+ checked={defaults.mcpEnabled}
+ disabled={update.isPending}
+ onCheckedChange={(checked) => void setMcpEnabled(checked)}
+ />
+ }
+ />
+ </SettingsCard>
+ </SettingsSection>
+ </div>
+ </GodSectionPage>
+ );
+}
diff --git a/apps/web/src/features/god/services/god.service.ts b/apps/web/src/features/god/services/god.service.ts
index 144c9f6d..d59d21d9 100644
--- a/apps/web/src/features/god/services/god.service.ts
+++ b/apps/web/src/features/god/services/god.service.ts
@@ -8,6 +8,7 @@ import {
type InstanceGoogleSettingsPatch,
type InstanceTelegramSettingsPatch,
type InstanceUserKind,
+ type ProjectDefaults,
type StorageSettingsPatch,
} from '@/lib/api';
import { qk } from '@/services/queryKeys';
@@ -82,6 +83,23 @@ export function useUpdateInstanceTelegramSettings() {
});
}
+// What a new project starts with on this instance. Projects that already exist are
+// untouched by a change here.
+export function useInstanceProjectDefaultsQuery() {
+ return useQuery({
+ queryKey: qk.instanceProjectDefaults,
+ queryFn: () => api.getInstanceProjectDefaults(),
+ });
+}
+
+export function useUpdateInstanceProjectDefaults() {
+ const qc = useQueryClient();
+ return useMutation({
+ mutationFn: (body: ProjectDefaults) => api.updateInstanceProjectDefaults(body),
+ onSuccess: (data) => qc.setQueryData(qk.instanceProjectDefaults, data),
+ });
+}
+
// The upload limits: file sizes, accepted attachment types, and the per-project
// storage quota.
export function useInstanceStorageSettingsQuery() {
diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts
index 73e98d1f..860ac77f 100644
--- a/apps/web/src/lib/api.ts
+++ b/apps/web/src/lib/api.ts
@@ -977,6 +977,10 @@ export interface NotificationSettingsPatch {
// The instance upload limits. Readable by any signed-in user, because the upload UI
// states them before a file is picked; only god mode can change them.
+export interface ProjectDefaults {
+ mcpEnabled: boolean;
+}
+
export interface StorageSettings {
maxAttachmentMb: number;
maxAvatarMb: number;
@@ -3400,6 +3404,13 @@ export const api = {
getUpdateStatus: () => request<UpdateStatus>('/god/updates'),
checkForUpdates: () => request<UpdateStatus>('/god/updates/check', { method: 'POST' }),
+ getInstanceProjectDefaults: () => request<ProjectDefaults>('/god/project-defaults'),
+ updateInstanceProjectDefaults: (body: ProjectDefaults) =>
+ request<ProjectDefaults>('/god/project-defaults', {
+ method: 'PUT',
+ body: JSON.stringify(body),
+ }),
+
getInstanceStorageSettings: () => request<StorageSettings>('/god/storage-settings'),
updateInstanceStorageSettings: (patch: StorageSettingsPatch) =>
request<StorageSettings>('/god/storage-settings', {
diff --git a/apps/web/src/services/queryKeys.ts b/apps/web/src/services/queryKeys.ts
index 12c92db8..92fb375c 100644
--- a/apps/web/src/services/queryKeys.ts
+++ b/apps/web/src/services/queryKeys.ts
@@ -155,6 +155,7 @@ export const qk = {
instanceEmailSettings: ['instanceEmailSettings'] as const,
instanceGoogleSettings: ['instanceGoogleSettings'] as const,
instanceTelegramSettings: ['instanceTelegramSettings'] as const,
+ instanceProjectDefaults: ['instanceProjectDefaults'] as const,
instanceStorageSettings: ['instanceStorageSettings'] as const,
// The upload limits as read by the upload UI (open to any signed-in user).
storageSettings: ['storageSettings'] as const,
diff --git a/apps/web/src/utils/godSections.ts b/apps/web/src/utils/godSections.ts
index 31c4201a..0215c8f1 100644
--- a/apps/web/src/utils/godSections.ts
+++ b/apps/web/src/utils/godSections.ts
@@ -5,6 +5,7 @@ import {
KeyRound,
Mail,
Send,
+ SlidersHorizontal,
Users,
type LucideIcon,
} from 'lucide-react';
@@ -38,6 +39,11 @@ export const GOD_SECTIONS: GodSection[] = [
group: 'management',
icon: FolderKanban,
},
+ {
+ slug: 'general',
+ group: 'instance',
+ icon: SlidersHorizontal,
+ },
{
slug: 'authentication',
group: 'instance',