@deepseek-ai/dsh-notion 0.0.0-stage → 0.2.3-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.i18n.yaml +73 -0
- package/README.md +154 -2
- package/README.zh.md +155 -0
- package/cordis.patch.yml +3 -0
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/docs/preview.svg +1 -0
- package/docs/preview.zh.svg +1 -0
- package/icon.svg +7 -0
- package/lib/index.js +213 -0
- package/lib/types/index.d.ts +31 -0
- package/lib/types/index.d.ts.map +1 -0
- package/lib/types/index.js.map +1 -0
- package/lib/types/locales.d.ts +8 -0
- package/lib/types/locales.d.ts.map +1 -0
- package/lib/types/locales.js.map +1 -0
- package/locale/de.json +7 -0
- package/locale/en.json +7 -0
- package/locale/es.json +7 -0
- package/locale/fr.json +7 -0
- package/locale/ja.json +7 -0
- package/locale/pt.json +7 -0
- package/locale/ru.json +7 -0
- package/locale/zh.json +7 -0
- package/package.json +64 -3
- package/src/index.ts +65 -0
- package/src/locales.ts +167 -0
package/icon.svg
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36">
|
|
2
|
+
<g transform="translate(4.41176471 4) scale(0.823529412)" fill="none">
|
|
3
|
+
<path d="M3.8051 3.26755L20.5301 2.04319C22.5839 1.86808 23.1124 1.98538 24.4032 2.91756L29.7421 6.64773C30.623 7.28917 30.9165 7.46381 30.9165 8.16307V28.6217C30.9165 29.9038 30.4468 30.6622 28.804 30.7782L9.38138 31.9442C8.14825 32.0027 7.56135 31.8279 6.91556 31.0114L2.98395 25.9405C2.27947 25.0072 1.98651 24.3088 1.98651 23.4918V5.3068C1.98651 4.25826 2.45649 3.38366 3.8051 3.26755Z" fill="#fff" />
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.64643 1.29903L20.3723 0.0746037C21.3849 -0.0114809 22.3097 -0.0595444 23.1918 0.139197C24.141 0.353054 24.86 0.807308 25.5578 1.31054L30.9002 5.04319L30.9158 5.05461C30.9547 5.08281 30.9968 5.11312 31.0417 5.14536C31.3674 5.37943 31.8354 5.71564 32.1631 6.09295C32.7252 6.73997 32.9031 7.45237 32.9031 8.16303V28.6217C32.9031 29.4467 32.763 30.5442 31.967 31.4425C31.1549 32.3592 30.0175 32.6721 28.9448 32.7479L28.9343 32.7486L9.48857 33.916L9.47602 33.9165C8.79263 33.949 8.01197 33.9383 7.24718 33.6609C6.41395 33.3586 5.82508 32.8277 5.35391 32.2318L5.34799 32.2243L1.40271 27.1359L1.39499 27.1257C0.55231 26.0092 0 24.8994 0 23.4918V5.30675C0 4.51862 0.17342 3.55089 0.82429 2.72219C1.51537 1.84231 2.52546 1.39554 3.6337 1.30013L3.64643 1.29903ZM20.5301 2.04315L3.80509 3.26752C2.45647 3.38361 1.9865 4.25823 1.9865 5.30675V23.4918C1.9865 24.3088 2.27946 25.0072 2.98394 25.9405L6.91553 31.0114C7.56133 31.8279 8.14822 32.0025 9.38137 31.944L28.804 30.7782C30.4468 30.6622 30.9165 29.9039 30.9165 28.6217V8.16303C30.9165 7.50025 30.6529 7.30878 29.8751 6.74438C29.8323 6.71333 29.788 6.68115 29.7421 6.6477L24.4032 2.91752C23.1124 1.98534 22.5839 1.86805 20.5301 2.04315Z" fill="#fff" />
|
|
5
|
+
<path d="M20.5301 2.04318C22.5838 1.86808 23.1124 1.98541 24.4031 2.91757L29.7421 6.64778C30.623 7.28918 30.9167 7.46383 30.9167 8.16301V28.6217C30.9167 29.9039 30.4468 30.6622 28.804 30.7782L9.38127 31.944C8.14822 32.0025 7.56137 31.8279 6.9156 31.0114L2.98396 25.9405C2.27951 25.0072 1.98647 24.3088 1.98645 23.492V5.30687C1.98645 4.25835 2.45646 3.38365 3.80508 3.26754L20.5301 2.04318ZM28.9214 9.91165C28.9214 9.15462 28.6285 8.74625 27.9818 8.80449L8.91064 9.91165C8.20688 9.97045 7.9722 10.3204 7.9722 11.0779V28.4466C7.97222 29.3801 8.44147 29.7293 9.49759 29.6715L27.7471 28.6217C28.8037 28.5641 28.9214 27.922 28.9214 27.1636V9.91165ZM25.988 12.0096C26.1051 12.5347 25.988 13.0592 25.4588 13.1182L24.5795 13.2926V26.1151C23.816 26.5231 23.1122 26.7563 22.5256 26.7563C21.5863 26.7563 21.351 26.4646 20.6475 25.5908L14.8959 16.6149V25.2992L16.7158 25.7076C16.7158 25.7076 16.7159 26.7563 15.2475 26.7563L11.1994 26.9897C11.0818 26.7563 11.1995 26.1739 11.6101 26.0571L12.6664 25.7662V14.2837L11.1997 14.1668C11.0822 13.6417 11.3751 12.8847 12.1972 12.8259L16.5398 12.5349L22.5256 21.6277V13.5839L20.9993 13.4098C20.8821 12.7679 21.351 12.3018 21.9379 12.244L25.988 12.0096ZM23.816 4.43331C23.2877 4.02552 22.5835 3.55846 21.2343 3.67528L5.15507 4.84121C4.56875 4.89903 4.45158 5.19046 4.68509 5.42409L6.97519 7.23083C7.91323 7.98837 8.26511 7.93069 10.0265 7.81388L26.632 6.82259C26.9842 6.82259 26.6915 6.47348 26.5739 6.41536L23.816 4.43331Z" fill="#000" />
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import z from "@deepseek-ai/schemastery";
|
|
2
|
+
//#region lib/types/locales.js
|
|
3
|
+
/** Notion's account text in every shipped language. */
|
|
4
|
+
const COPY = {
|
|
5
|
+
title: {
|
|
6
|
+
zh: "Notion 账号",
|
|
7
|
+
en: "Notion account",
|
|
8
|
+
ja: "Notion アカウント",
|
|
9
|
+
es: "Cuenta de Notion",
|
|
10
|
+
fr: "Compte Notion",
|
|
11
|
+
de: "Notion-Konto",
|
|
12
|
+
ru: "Аккаунт Notion",
|
|
13
|
+
pt: "Conta do Notion"
|
|
14
|
+
},
|
|
15
|
+
connect: {
|
|
16
|
+
zh: "连接 Notion",
|
|
17
|
+
en: "Connect Notion",
|
|
18
|
+
ja: "Notion を接続",
|
|
19
|
+
es: "Conectar Notion",
|
|
20
|
+
fr: "Connecter Notion",
|
|
21
|
+
de: "Notion verbinden",
|
|
22
|
+
ru: "Подключить Notion",
|
|
23
|
+
pt: "Conectar Notion"
|
|
24
|
+
},
|
|
25
|
+
activation: {
|
|
26
|
+
title: {
|
|
27
|
+
zh: "连接 Notion 账号",
|
|
28
|
+
en: "Connect your Notion account",
|
|
29
|
+
ja: "Notion アカウントを接続",
|
|
30
|
+
es: "Conecte su cuenta de Notion",
|
|
31
|
+
fr: "Connectez votre compte Notion",
|
|
32
|
+
de: "Notion-Konto verbinden",
|
|
33
|
+
ru: "Подключите аккаунт Notion",
|
|
34
|
+
pt: "Conecte sua conta do Notion"
|
|
35
|
+
},
|
|
36
|
+
body: {
|
|
37
|
+
zh: "Notion 插件已开启。连接你的 Notion 账号后,就可以在对话中使用它。",
|
|
38
|
+
en: "The Notion plugin is on. Connect your Notion account to use it in conversations.",
|
|
39
|
+
ja: "Notion プラグインがオンになりました。Notion アカウントを接続すると、会話の中で使用できます。",
|
|
40
|
+
es: "El complemento de Notion está activado. Conecte su cuenta de Notion para usarlo en las conversaciones.",
|
|
41
|
+
fr: "Le plugin Notion est activé. Connectez votre compte Notion pour l’utiliser dans les conversations.",
|
|
42
|
+
de: "Das Notion-Plugin ist aktiviert. Verbinden Sie Ihr Notion-Konto, um es in Unterhaltungen zu verwenden.",
|
|
43
|
+
ru: "Плагин Notion включён. Подключите аккаунт Notion, чтобы использовать его в беседах.",
|
|
44
|
+
pt: "O plugin do Notion está ativado. Conecte sua conta do Notion para usá-lo nas conversas."
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
detail: {
|
|
48
|
+
disconnected: {
|
|
49
|
+
zh: "连接 Notion 账号后,可以在对话中搜索、读取和编辑你授权的页面与数据库。",
|
|
50
|
+
en: "Connect your Notion account to search, read, and edit the pages and databases you authorize, right from a conversation.",
|
|
51
|
+
ja: "Notion アカウントを接続すると、承認したページやデータベースを会話の中から直接検索、閲覧、編集できます。",
|
|
52
|
+
es: "Conecte su cuenta de Notion para buscar, leer y editar las páginas y bases de datos que autorice, directamente desde una conversación.",
|
|
53
|
+
fr: "Connectez votre compte Notion pour rechercher, lire et modifier les pages et bases de données que vous autorisez, directement depuis une conversation.",
|
|
54
|
+
de: "Verbinden Sie Ihr Notion-Konto, um die von Ihnen freigegebenen Seiten und Datenbanken direkt aus einer Unterhaltung heraus zu durchsuchen, zu lesen und zu bearbeiten.",
|
|
55
|
+
ru: "Подключите аккаунт Notion, чтобы искать, читать и редактировать разрешённые вами страницы и базы данных прямо из беседы.",
|
|
56
|
+
pt: "Conecte sua conta do Notion para pesquisar, ler e editar as páginas e os bancos de dados que você autorizar, direto de uma conversa."
|
|
57
|
+
},
|
|
58
|
+
waitingBrowser: {
|
|
59
|
+
zh: "已打开 Notion 授权页面。在 Notion 中确认后,回到这里查看结果。",
|
|
60
|
+
en: "The Notion authorization page is open. Confirm in Notion, then come back here to see the result.",
|
|
61
|
+
ja: "Notion の認可ページを開きました。Notion で確定したら、ここに戻って結果を確認してください。",
|
|
62
|
+
es: "La página de autorización de Notion está abierta. Confirme en Notion y luego vuelva aquí para ver el resultado.",
|
|
63
|
+
fr: "La page d’autorisation Notion est ouverte. Confirmez dans Notion, puis revenez ici pour voir le résultat.",
|
|
64
|
+
de: "Die Notion-Autorisierungsseite ist geöffnet. Bestätigen Sie in Notion und kehren Sie dann hierher zurück, um das Ergebnis zu sehen.",
|
|
65
|
+
ru: "Страница авторизации Notion открыта. Подтвердите в Notion, затем вернитесь сюда, чтобы увидеть результат.",
|
|
66
|
+
pt: "A página de autorização do Notion está aberta. Confirme no Notion e depois volte aqui para ver o resultado."
|
|
67
|
+
},
|
|
68
|
+
authorizing: {
|
|
69
|
+
zh: "正在与 Notion 完成授权。",
|
|
70
|
+
en: "Finishing authorization with Notion.",
|
|
71
|
+
ja: "Notion での認可を完了しています。",
|
|
72
|
+
es: "Completando la autorización con Notion.",
|
|
73
|
+
fr: "Finalisation de l’autorisation avec Notion.",
|
|
74
|
+
de: "Die Autorisierung mit Notion wird abgeschlossen.",
|
|
75
|
+
ru: "Завершение авторизации в Notion.",
|
|
76
|
+
pt: "Concluindo a autorização com o Notion."
|
|
77
|
+
},
|
|
78
|
+
connecting: {
|
|
79
|
+
zh: "正在连接 Notion。",
|
|
80
|
+
en: "Connecting to Notion.",
|
|
81
|
+
ja: "Notion に接続しています。",
|
|
82
|
+
es: "Conectando con Notion.",
|
|
83
|
+
fr: "Connexion à Notion en cours.",
|
|
84
|
+
de: "Verbindung mit Notion wird hergestellt.",
|
|
85
|
+
ru: "Подключение к Notion.",
|
|
86
|
+
pt: "Conectando ao Notion."
|
|
87
|
+
},
|
|
88
|
+
connected: {
|
|
89
|
+
zh: "可以在对话中直接请 Agent 使用 Notion。",
|
|
90
|
+
en: "Ask the agent to use Notion directly in a conversation.",
|
|
91
|
+
ja: "会話の中でエージェントに Notion の使用を直接依頼できます。",
|
|
92
|
+
es: "Pida al agente que use Notion directamente en una conversación.",
|
|
93
|
+
fr: "Demandez à l’agent d’utiliser Notion directement dans une conversation.",
|
|
94
|
+
de: "Bitten Sie den Agenten, Notion direkt in einer Unterhaltung zu verwenden.",
|
|
95
|
+
ru: "Попросите агента использовать Notion прямо в беседе.",
|
|
96
|
+
pt: "Peça ao agente que use o Notion diretamente em uma conversa."
|
|
97
|
+
},
|
|
98
|
+
rejected: {
|
|
99
|
+
zh: "Notion 不再接受当前授权,请重新连接。",
|
|
100
|
+
en: "Notion no longer accepts the current authorization. Connect again.",
|
|
101
|
+
ja: "Notion は現在の認可を受け付けなくなりました。再度接続してください。",
|
|
102
|
+
es: "Notion ya no acepta la autorización actual. Vuelva a conectar.",
|
|
103
|
+
fr: "Notion n’accepte plus l’autorisation actuelle. Reconnectez-vous.",
|
|
104
|
+
de: "Notion akzeptiert die aktuelle Autorisierung nicht mehr. Verbinden Sie erneut.",
|
|
105
|
+
ru: "Notion больше не принимает текущую авторизацию. Подключитесь снова.",
|
|
106
|
+
pt: "O Notion não aceita mais a autorização atual. Conecte novamente."
|
|
107
|
+
},
|
|
108
|
+
scope: {
|
|
109
|
+
zh: "当前授权缺少所需权限。重新连接时,请在 Notion 中确认权限。",
|
|
110
|
+
en: "The current authorization lacks required permissions. Confirm them in Notion when you connect again.",
|
|
111
|
+
ja: "現在の認可には必要な権限が不足しています。再度接続するときに、Notion で権限を確認してください。",
|
|
112
|
+
es: "A la autorización actual le faltan permisos necesarios. Confírmelos en Notion cuando vuelva a conectar.",
|
|
113
|
+
fr: "L’autorisation actuelle ne dispose pas des permissions requises. Confirmez-les dans Notion lors de la reconnexion.",
|
|
114
|
+
de: "Der aktuellen Autorisierung fehlen erforderliche Berechtigungen. Bestätigen Sie diese in Notion, wenn Sie erneut verbinden.",
|
|
115
|
+
ru: "Текущей авторизации не хватает нужных разрешений. Подтвердите их в Notion при повторном подключении.",
|
|
116
|
+
pt: "A autorização atual não tem as permissões necessárias. Confirme-as no Notion ao conectar novamente."
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
signOut: {
|
|
120
|
+
title: {
|
|
121
|
+
zh: "退出 Notion 登录?",
|
|
122
|
+
en: "Sign out of Notion?",
|
|
123
|
+
ja: "Notion からサインアウトしますか?",
|
|
124
|
+
es: "¿Cerrar sesión en Notion?",
|
|
125
|
+
fr: "Se déconnecter de Notion\xA0?",
|
|
126
|
+
de: "Von Notion abmelden?",
|
|
127
|
+
ru: "Выйти из Notion?",
|
|
128
|
+
pt: "Sair do Notion?"
|
|
129
|
+
},
|
|
130
|
+
body: {
|
|
131
|
+
zh: "将删除 DSH 保存的 Notion 授权,之后对话中无法使用 Notion。如需在 Notion 一侧撤销连接,请到 Notion 的设置中处理。",
|
|
132
|
+
en: "This deletes the Notion authorization DSH saved, so conversations can no longer use Notion. To revoke the connection on Notion's side, use Notion's settings.",
|
|
133
|
+
ja: "DSH が保存した Notion の認可を削除します。以後、会話の中で Notion は使用できなくなります。Notion 側で接続を取り消すには、Notion の設定から行ってください。",
|
|
134
|
+
es: "Se eliminará la autorización de Notion que guardó DSH, por lo que las conversaciones ya no podrán usar Notion. Para revocar la conexión del lado de Notion, use la configuración de Notion.",
|
|
135
|
+
fr: "Cela supprime l’autorisation Notion enregistrée par DSH\xA0: les conversations ne pourront plus utiliser Notion. Pour révoquer la connexion côté Notion, utilisez les paramètres de Notion.",
|
|
136
|
+
de: "Dadurch wird die von DSH gespeicherte Notion-Autorisierung gelöscht, sodass Unterhaltungen Notion nicht mehr verwenden können. Um die Verbindung auf Notion-Seite zu widerrufen, verwenden Sie die Einstellungen von Notion.",
|
|
137
|
+
ru: "Сохранённая DSH авторизация Notion будет удалена, и беседы больше не смогут использовать Notion. Чтобы отозвать подключение на стороне Notion, воспользуйтесь настройками Notion.",
|
|
138
|
+
pt: "Isso exclui a autorização do Notion salva pelo DSH, e as conversas não poderão mais usar o Notion. Para revogar a conexão no lado do Notion, use as configurações do Notion."
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
notice: {
|
|
142
|
+
connected: {
|
|
143
|
+
zh: "Notion 已连接",
|
|
144
|
+
en: "Notion connected",
|
|
145
|
+
ja: "Notion を接続しました",
|
|
146
|
+
es: "Notion conectado",
|
|
147
|
+
fr: "Notion connecté",
|
|
148
|
+
de: "Notion verbunden",
|
|
149
|
+
ru: "Notion подключён",
|
|
150
|
+
pt: "Notion conectado"
|
|
151
|
+
},
|
|
152
|
+
signedOut: {
|
|
153
|
+
zh: "已退出 Notion 登录",
|
|
154
|
+
en: "Signed out of Notion",
|
|
155
|
+
ja: "Notion からサインアウトしました",
|
|
156
|
+
es: "Sesión de Notion cerrada",
|
|
157
|
+
fr: "Déconnecté de Notion",
|
|
158
|
+
de: "Von Notion abgemeldet",
|
|
159
|
+
ru: "Выполнен выход из Notion",
|
|
160
|
+
pt: "Você saiu do Notion"
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
//#endregion
|
|
165
|
+
//#region lib/types/index.js
|
|
166
|
+
/**
|
|
167
|
+
* Notion plugin: registers Notion's hosted MCP server with the shared MCP
|
|
168
|
+
* manager for this plugin's lifetime, tells the model to call it the Notion
|
|
169
|
+
* plugin, and shows the account on the Plugins page while the account registry
|
|
170
|
+
* runs. The manager owns connection, OAuth authorization, saved grants, and
|
|
171
|
+
* sign-out; once a grant exists, the server's `mcp__notion__*` tools are
|
|
172
|
+
* listed in the system prompt and each agent loads the ones it needs.
|
|
173
|
+
* @module @deepseek-ai/dsh-notion
|
|
174
|
+
*/
|
|
175
|
+
const name = "notion";
|
|
176
|
+
const inject = ["mcpManager", "systemPrompt"];
|
|
177
|
+
const SERVER_NAME = "notion";
|
|
178
|
+
const CREDENTIAL_KEY = "mcp-client/notion";
|
|
179
|
+
const GUIDANCE = "Tools named `mcp__notion__*` come from the Notion plugin. In user-facing replies, call it the Notion plugin (Notion 插件 in Chinese), not MCP. If no `mcp__notion__*` tool appears in your tool list, Notion is not connected yet; ask the user to connect it on the Notion plugin page in Plugins.";
|
|
180
|
+
/** Runtime configuration schema for the Notion plugin. */
|
|
181
|
+
const Config = z.object({
|
|
182
|
+
url: z.string().default("https://mcp.notion.com/mcp"),
|
|
183
|
+
toolLoading: z.union(["eager", "on-demand"]).default("on-demand")
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* Register the Notion server, its naming guidance, and, while the account registry runs, its Plugins page account; all
|
|
187
|
+
* are withdrawn when the plugin unloads.
|
|
188
|
+
* @param ctx - Context carrying the MCP manager and system prompt.
|
|
189
|
+
* @param config - Notion endpoint and tool loading.
|
|
190
|
+
* @throws when another configured or registered server already uses the `notion` name or credential key.
|
|
191
|
+
*/
|
|
192
|
+
function apply(ctx, config) {
|
|
193
|
+
ctx.mcpManager.register(SERVER_NAME, {
|
|
194
|
+
transport: "streamable-http",
|
|
195
|
+
url: config.url,
|
|
196
|
+
oauth: { credentialKey: CREDENTIAL_KEY },
|
|
197
|
+
toolLoading: config.toolLoading
|
|
198
|
+
});
|
|
199
|
+
ctx.systemPrompt.section({
|
|
200
|
+
name: SERVER_NAME,
|
|
201
|
+
order: ctx.systemPrompt.getSectionOrder("MCP_SERVERS"),
|
|
202
|
+
text: GUIDANCE
|
|
203
|
+
});
|
|
204
|
+
ctx.inject(["mcpAccounts"], (scope) => {
|
|
205
|
+
scope.effect(() => scope.mcpAccounts.register({
|
|
206
|
+
server: SERVER_NAME,
|
|
207
|
+
packageName: "@deepseek-ai/dsh-notion",
|
|
208
|
+
copy: COPY
|
|
209
|
+
}), "notion: Plugins page account");
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
export { Config, apply, inject, name };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion plugin: registers Notion's hosted MCP server with the shared MCP
|
|
3
|
+
* manager for this plugin's lifetime, tells the model to call it the Notion
|
|
4
|
+
* plugin, and shows the account on the Plugins page while the account registry
|
|
5
|
+
* runs. The manager owns connection, OAuth authorization, saved grants, and
|
|
6
|
+
* sign-out; once a grant exists, the server's `mcp__notion__*` tools are
|
|
7
|
+
* listed in the system prompt and each agent loads the ones it needs.
|
|
8
|
+
* @module @deepseek-ai/dsh-notion
|
|
9
|
+
*/
|
|
10
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
11
|
+
import z from '@deepseek-ai/schemastery';
|
|
12
|
+
export declare const name = "notion";
|
|
13
|
+
export declare const inject: string[];
|
|
14
|
+
/** Notion MCP endpoint and tool loading for the managed server entry. */
|
|
15
|
+
export interface Config {
|
|
16
|
+
/** Streamable HTTP MCP endpoint; defaults to Notion's hosted server. */
|
|
17
|
+
url: string;
|
|
18
|
+
/** `on-demand` (default) keeps Notion's tools hidden from each agent until it loads them; `eager` sends all of them. */
|
|
19
|
+
toolLoading: 'eager' | 'on-demand';
|
|
20
|
+
}
|
|
21
|
+
/** Runtime configuration schema for the Notion plugin. */
|
|
22
|
+
export declare const Config: z<Partial<Config>, Config>;
|
|
23
|
+
/**
|
|
24
|
+
* Register the Notion server, its naming guidance, and, while the account registry runs, its Plugins page account; all
|
|
25
|
+
* are withdrawn when the plugin unloads.
|
|
26
|
+
* @param ctx - Context carrying the MCP manager and system prompt.
|
|
27
|
+
* @param config - Notion endpoint and tool loading.
|
|
28
|
+
* @throws when another configured or registered server already uses the `notion` name or credential key.
|
|
29
|
+
*/
|
|
30
|
+
export declare function apply(ctx: Context, config: Config): void;
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAMxC,eAAO,MAAM,IAAI,WAAW,CAAA;AAC5B,eAAO,MAAM,MAAM,UAAiC,CAAA;AASpD,yEAAyE;AACzE,MAAM,WAAW,MAAM;IACrB,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAA;IACX,wHAAwH;IACxH,WAAW,EAAE,OAAO,GAAG,WAAW,CAAA;CACnC;AAED,0DAA0D;AAC1D,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAG5C,CAAA;AAEF;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAgBxD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAIxC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,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W,EAAE,yBAAyB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,8BAA8B,CAAC,CAAA;IAC7J,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The Plugins page text that names Notion; the shared account copy comes from the account surfaces' dictionary. */
|
|
2
|
+
import type { McpAccountCopy } from '@deepseek-ai/dsh-mcp-account';
|
|
3
|
+
/** Every language the Web app ships. */
|
|
4
|
+
type ShippedText = Readonly<Record<'zh' | 'en' | 'ja' | 'es' | 'fr' | 'de' | 'ru' | 'pt', string>>;
|
|
5
|
+
/** Notion's account text in every shipped language. */
|
|
6
|
+
export declare const COPY: McpAccountCopy<ShippedText>;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.d.ts","sourceRoot":"","sources":["../../src/locales.ts"],"names":[],"mappings":"AAAA,oHAAoH;AACpH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAA;AAElE,wCAAwC;AACxC,KAAK,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAA;AAElG,uDAAuD;AACvD,eAAO,MAAM,IAAI,EAAE,cAAc,CAAC,WAAW,CA+J5C,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"locales.js","sourceRoot":"","sources":["../../src/locales.ts"],"names":[],"mappings":"AAMA,uDAAuD;AACvD,MAAM,CAAC,MAAM,IAAI,GAAgC;IAC/C,KAAK,EAAE;QACL,EAAE,EAAE,WAAW;QACf,EAAE,EAAE,gBAAgB;QACpB,EAAE,EAAE,cAAc;QAClB,EAAE,EAAE,kBAAkB;QACtB,EAAE,EAAE,eAAe;QACnB,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AE,EAAE,qGAAqG;SAC1G;KACF;IACD,OAAO,EAAE;QACP,KAAK,EAAE;YACL,EAAE,EAAE,eAAe;YACnB,EAAE,EAAE,qBAAqB;YACzB,EAAE,EAAE,sBAAsB;YAC1B,EAAE,EAAE,2BAA2B;YAC/B,EAAE,EAAE,4BAA4B;YAChC,EAAE,EAAE,sBAAsB;YAC1B,EAAE,EAAE,kBAAkB;YACtB,EAAE,EAAE,iBAAiB;SACtB;QACD,IAAI,EAAE;YACJ,EAAE,EAAE,4EAA4E;YAChF,EAAE,EAAE,iKAAiK;YACrK,EAAE,EAAE,gGAAgG;YACpG,EAAE,EAAE,6LAA6L;YACjM,EAAE,EAAE,0LAA0L;YAC9L,EAAE,EAAE,8NAA8N;YAClO,EAAE,EAAE,mLAAmL;YACvL,EAAE,EAAE,8KAA8K;SACnL;KACF;IACD,MAAM,EAAE;QACN,SAAS,EAAE;YACT,EAAE,EAAE,YAAY;YAChB,EAAE,EAAE,kBAAkB;YACtB,EAAE,EAAE,gBAAgB;YACpB,EAAE,EAAE,kBAAkB;YACtB,EAAE,EAAE,iBAAiB;YACrB,EAAE,EAAE,kBAAkB;YACtB,EAAE,EAAE,kBAAkB;YACtB,EAAE,EAAE,kBAAkB;SACvB;QACD,SAAS,EAAE;YACT,EAAE,EAAE,eAAe;YACnB,EAAE,EAAE,sBAAsB;YAC1B,EAAE,EAAE,qBAAqB;YACzB,EAAE,EAAE,0BAA0B;YAC9B,EAAE,EAAE,sBAAsB;YAC1B,EAAE,EAAE,uBAAuB;YAC3B,EAAE,EAAE,0BAA0B;YAC9B,EAAE,EAAE,qBAAqB;SAC1B;KACF;CACF,CAAA"}
|
package/locale/de.json
ADDED
package/locale/en.json
ADDED
package/locale/es.json
ADDED
package/locale/fr.json
ADDED
package/locale/ja.json
ADDED
package/locale/pt.json
ADDED
package/locale/ru.json
ADDED
package/locale/zh.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,67 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-notion",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Notion plugin: Notion's hosted MCP server, authorized through the shared MCP manager",
|
|
4
|
+
"version": "0.2.3-alpha.2",
|
|
5
|
+
"icon": "./icon.svg",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
12
|
+
"directory": "packages/connector/notion"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "lib/index.js",
|
|
16
|
+
"types": "lib/types/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./lib/types/index.d.ts",
|
|
20
|
+
"default": "./lib/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./locale/*.json": "./locale/*.json",
|
|
23
|
+
"./src/*": "./src/*",
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
"./cordis.patch.yml": "./cordis.patch.yml"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"icon.svg",
|
|
29
|
+
"locale/*.json",
|
|
30
|
+
"docs",
|
|
31
|
+
"lib/index.js",
|
|
32
|
+
"cordis.patch.yml",
|
|
33
|
+
"lib/types/**/*.d.ts",
|
|
34
|
+
"lib/types/**/*.d.ts.map",
|
|
35
|
+
"lib/**/*.js.map",
|
|
36
|
+
"src"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"dsh": {
|
|
40
|
+
"bundle": {
|
|
41
|
+
"patch": "./cordis.patch.yml"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@deepseek-ai/schemastery": "~3.20.0-alpha.1"
|
|
46
|
+
},
|
|
47
|
+
"peerDependencies": {
|
|
48
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@deepseek-ai/cordis": "~4.2.0-alpha.1",
|
|
52
|
+
"@deepseek-ai/dsh-agent": "0.2.3-alpha.2",
|
|
53
|
+
"@deepseek-ai/dsh-client-ui-connector-account": "0.2.3-alpha.2",
|
|
54
|
+
"@deepseek-ai/dsh-credentials": "0.2.3-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-llm": "0.2.3-alpha.2",
|
|
56
|
+
"@deepseek-ai/dsh-mcp-account": "0.2.3-alpha.2",
|
|
57
|
+
"@deepseek-ai/dsh-mcp-manager": "0.2.3-alpha.2",
|
|
58
|
+
"@deepseek-ai/dsh-mcp-resources": "0.2.3-alpha.2",
|
|
59
|
+
"@deepseek-ai/dsh-scope": "0.2.3-alpha.2",
|
|
60
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.3-alpha.2",
|
|
61
|
+
"@deepseek-ai/dsh-tool-testkit": "0.2.3-alpha.2"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"bundle": "tsdown",
|
|
65
|
+
"watch": "tsdown --watch"
|
|
66
|
+
}
|
|
6
67
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Notion plugin: registers Notion's hosted MCP server with the shared MCP
|
|
3
|
+
* manager for this plugin's lifetime, tells the model to call it the Notion
|
|
4
|
+
* plugin, and shows the account on the Plugins page while the account registry
|
|
5
|
+
* runs. The manager owns connection, OAuth authorization, saved grants, and
|
|
6
|
+
* sign-out; once a grant exists, the server's `mcp__notion__*` tools are
|
|
7
|
+
* listed in the system prompt and each agent loads the ones it needs.
|
|
8
|
+
* @module @deepseek-ai/dsh-notion
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { Context } from '@deepseek-ai/cordis'
|
|
12
|
+
import z from '@deepseek-ai/schemastery'
|
|
13
|
+
import type {} from '@deepseek-ai/dsh-mcp-account'
|
|
14
|
+
import type {} from '@deepseek-ai/dsh-mcp-manager'
|
|
15
|
+
import type {} from '@deepseek-ai/dsh-system-prompt'
|
|
16
|
+
import { COPY } from './locales.ts'
|
|
17
|
+
|
|
18
|
+
export const name = 'notion'
|
|
19
|
+
export const inject = ['mcpManager', 'systemPrompt']
|
|
20
|
+
|
|
21
|
+
// One shared account per Host: a fixed server name keeps tool names stable and
|
|
22
|
+
// a fixed credential key lets a reinstalled plugin reuse its saved grant.
|
|
23
|
+
const SERVER_NAME = 'notion'
|
|
24
|
+
const CREDENTIAL_KEY = 'mcp-client/notion'
|
|
25
|
+
const GUIDANCE = 'Tools named `mcp__notion__*` come from the Notion plugin. In user-facing replies, call it the Notion plugin (Notion 插件 in Chinese), not MCP.'
|
|
26
|
+
+ ' If no `mcp__notion__*` tool appears in your tool list, Notion is not connected yet; ask the user to connect it on the Notion plugin page in Plugins.'
|
|
27
|
+
|
|
28
|
+
/** Notion MCP endpoint and tool loading for the managed server entry. */
|
|
29
|
+
export interface Config {
|
|
30
|
+
/** Streamable HTTP MCP endpoint; defaults to Notion's hosted server. */
|
|
31
|
+
url: string
|
|
32
|
+
/** `on-demand` (default) keeps Notion's tools hidden from each agent until it loads them; `eager` sends all of them. */
|
|
33
|
+
toolLoading: 'eager' | 'on-demand'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Runtime configuration schema for the Notion plugin. */
|
|
37
|
+
export const Config: z<Partial<Config>, Config> = z.object({
|
|
38
|
+
url: z.string().default('https://mcp.notion.com/mcp'),
|
|
39
|
+
toolLoading: z.union(['eager', 'on-demand']).default('on-demand'),
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Register the Notion server, its naming guidance, and, while the account registry runs, its Plugins page account; all
|
|
44
|
+
* are withdrawn when the plugin unloads.
|
|
45
|
+
* @param ctx - Context carrying the MCP manager and system prompt.
|
|
46
|
+
* @param config - Notion endpoint and tool loading.
|
|
47
|
+
* @throws when another configured or registered server already uses the `notion` name or credential key.
|
|
48
|
+
*/
|
|
49
|
+
export function apply(ctx: Context, config: Config): void {
|
|
50
|
+
ctx.mcpManager.register(SERVER_NAME, {
|
|
51
|
+
transport: 'streamable-http',
|
|
52
|
+
url: config.url,
|
|
53
|
+
oauth: { credentialKey: CREDENTIAL_KEY },
|
|
54
|
+
toolLoading: config.toolLoading,
|
|
55
|
+
})
|
|
56
|
+
// Sections at one order sort by name, so `notion` follows every `mcp…` server section.
|
|
57
|
+
ctx.systemPrompt.section({
|
|
58
|
+
name: SERVER_NAME,
|
|
59
|
+
order: ctx.systemPrompt.getSectionOrder('MCP_SERVERS'),
|
|
60
|
+
text: GUIDANCE,
|
|
61
|
+
})
|
|
62
|
+
ctx.inject(['mcpAccounts'], (scope) => {
|
|
63
|
+
scope.effect(() => scope.mcpAccounts.register({ server: SERVER_NAME, packageName: '@deepseek-ai/dsh-notion', copy: COPY }), 'notion: Plugins page account')
|
|
64
|
+
})
|
|
65
|
+
}
|