integram-mcp 0.7.149 → 0.7.151

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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/integram-mcp)](https://www.npmjs.com/package/integram-mcp)
4
4
 
5
- MCP-сервер для Integram — даёт доступ к 778 инструментам (таблицы, документы, отчёты, автоматизации, портал, Telegram-боты, граф знаний и т.д.) из Claude Code, Claude Desktop и Cursor.
5
+ MCP-сервер для Integram — даёт доступ к 779 инструментам (таблицы, документы, отчёты, автоматизации, портал, Telegram-боты, граф знаний и т.д.) из Claude Code, Claude Desktop и Cursor.
6
6
 
7
7
  Работает с облачным Integram на **ai2o.online** или с локальным сервером.
8
8
 
@@ -15,7 +15,7 @@ claude mcp add integram \
15
15
  -e INTEGRAM_URL=https://ai2o.online \
16
16
  -e INTEGRAM_EMAIL=you@example.com \
17
17
  -e INTEGRAM_PASSWORD=secret \
18
- -- npx -y integram-mcp@0.7.149
18
+ -- npx -y integram-mcp@0.7.151
19
19
  ```
20
20
 
21
21
  Ставить ничего не нужно: `npx` скачает пакет сам.
@@ -49,7 +49,7 @@ claude mcp add integram \
49
49
  -e INTEGRAM_URL=http://localhost:8081 \
50
50
  -e INTEGRAM_EMAIL=you@example.com \
51
51
  -e INTEGRAM_PASSWORD=secret \
52
- -- npx -y integram-mcp@0.7.149
52
+ -- npx -y integram-mcp@0.7.151
53
53
  ```
54
54
 
55
55
  Удалить: `claude mcp remove integram`
@@ -63,7 +63,7 @@ claude mcp add integram \
63
63
  "mcpServers": {
64
64
  "integram": {
65
65
  "command": "npx",
66
- "args": ["-y", "integram-mcp@0.7.149"],
66
+ "args": ["-y", "integram-mcp@0.7.151"],
67
67
  "env": {
68
68
  "INTEGRAM_URL": "https://ai2o.online",
69
69
  "INTEGRAM_EMAIL": "you@example.com",
@@ -83,7 +83,7 @@ claude mcp add integram \
83
83
  "mcpServers": {
84
84
  "integram": {
85
85
  "command": "npx",
86
- "args": ["-y", "integram-mcp@0.7.149"],
86
+ "args": ["-y", "integram-mcp@0.7.151"],
87
87
  "env": {
88
88
  "INTEGRAM_URL": "https://ai2o.online",
89
89
  "INTEGRAM_EMAIL": "you@example.com",
@@ -180,7 +180,7 @@ claude mcp add integram -e INTEGRAM_URL=... -e INTEGRAM_EMAIL=... -e INTEGRAM_PA
180
180
  | **nightcall** | Нормативная спецификация и проверяемая генерация: требования, обязательства, свидетельства, базовые линии | 44 |
181
181
  | **codespace** | Git-репозитории: ветки, коммиты, файлы, точечная правка (`patch_file`), pull requests; запись с `baseCommit` сливается с чужими изменениями вместо перезаписи | 37 |
182
182
  | **schema** | Таблицы, колонки, кнопки (AI/HTTP/script), вычисляемые колонки, валидация | 36 |
183
- | **memory** | Память агента, инсайты, процедуры, противоречия | 29 |
183
+ | **memory** | Память агента, инсайты, процедуры, противоречия | 30 |
184
184
  | **orgs** | Организации: участники, области, приглашения | 29 |
185
185
  | **meta-kb** | Дебаты: параллельные эксперты, LLM-синтез, курирование знаний | 25 |
186
186
  | **core** | CRUD объектов, поиск, справочник платформы (docs_map/docs_search), граф, комментарии, bulk-операции | 21 |
package/auth-token.js ADDED
@@ -0,0 +1,18 @@
1
+ // mcp-server/auth-token.js
2
+ // PM-1003: refresh-токен живёт в Set-Cookie (iam/router.js:20-27), тело ответа
3
+ // login его вырезает. refresh-маршрут принимает токен из ТЕЛА — поэтому клиент
4
+ // хранит куку сам и шлёт её значение в теле. Ротация: после каждого refresh
5
+ // перечитываем и тело, и куку (повтор старого токена > 30 c отзывает family).
6
+ export function pickAccessToken(data) {
7
+ return data?.accessToken || data?.data?.accessToken || data?.data?.token || null;
8
+ }
9
+
10
+ export function extractRefreshToken(body, setCookie) {
11
+ if (body?.refreshToken) return body.refreshToken;
12
+ const cookies = setCookie || [];
13
+ for (const line of cookies) {
14
+ const m = /(?:^|;\s*)refresh_token=([^;\s]+)/.exec(line);
15
+ if (m && m[1]) return decodeURIComponent(m[1]);
16
+ }
17
+ return null;
18
+ }
package/index.js CHANGED
@@ -26,6 +26,7 @@ import { createRequire } from 'module';
26
26
  import { rememberActivation as rememberActivationIn, applyActivation, forgetActivation } from './activation-memory.js';
27
27
  import { startOrphanWatchdog } from './orphan-watchdog.js';
28
28
  import { enqueuePending, takePending } from './pending-hitl.js';
29
+ import { extractRefreshToken, pickAccessToken } from './auth-token.js';
29
30
 
30
31
  // Own identity — read from package.json, never hardcoded: a hardcoded copy drifts
31
32
  // (it sat at 0.5.0 through the 0.6.0 and 0.7.0 releases).
@@ -85,15 +86,18 @@ export function toolErrorResult(err) {
85
86
 
86
87
  async function login() {
87
88
  if (!EMAIL || !PASSWORD) throw new Error('INTEGRAM_EMAIL and INTEGRAM_PASSWORD are required');
88
- const data = await apiFetch('/api/v2/iam/login', {
89
+ const res = await fetch(`${BASE_URL}/api/v2/iam/login`, {
89
90
  method: 'POST',
91
+ headers: { 'Content-Type': 'application/json' },
90
92
  body: JSON.stringify({ email: EMAIL, password: PASSWORD }),
91
93
  });
94
+ const data = await res.json().catch(() => ({}));
92
95
  if (!data.ok) throw new Error(`Login failed: ${JSON.stringify(data.error)}`);
93
- accessToken = data.accessToken || data.data?.accessToken || data.data?.token;
94
- refreshToken = data.refreshToken || data.data?.refreshToken;
96
+ accessToken = pickAccessToken(data);
97
+ // PM-1003: refresh-токен приезжает только Set-Cookie'ем — читаем его.
98
+ refreshToken = extractRefreshToken(data, res.headers.getSetCookie?.() ?? []);
95
99
  tokenExp = decodeExp(accessToken);
96
- log(`Logged in as ${EMAIL}, token expires ${new Date(tokenExp * 1000).toISOString()}`);
100
+ log(`Logged in as ${EMAIL}, token expires ${new Date(tokenExp * 1000).toISOString()}, refresh: ${refreshToken ? 'captured' : 'none'}`);
97
101
  }
98
102
 
99
103
  async function ensureAuth() {
@@ -105,13 +109,18 @@ async function ensureAuth() {
105
109
  _authPromise = (async () => {
106
110
  if (refreshToken) {
107
111
  try {
108
- const data = await apiFetch('/api/v2/iam/refresh', {
112
+ const rres = await fetch(`${BASE_URL}/api/v2/iam/refresh`, {
109
113
  method: 'POST',
114
+ headers: { 'Content-Type': 'application/json' },
110
115
  body: JSON.stringify({ refreshToken }),
111
116
  });
117
+ const data = await rres.json().catch(() => ({}));
112
118
  if (data.ok) {
113
- accessToken = data.accessToken || data.data?.accessToken || data.data?.token;
114
- refreshToken = data.refreshToken || data.data?.refreshToken || refreshToken;
119
+ const nextAccess = pickAccessToken(data);
120
+ const nextRefresh = extractRefreshToken(data, rres.headers.getSetCookie?.() ?? []);
121
+ accessToken = nextAccess;
122
+ // Ротация: берём НОВЫЙ токен; старый мёртв — fallback на старый замаскировал бы потерю.
123
+ refreshToken = nextRefresh;
115
124
  tokenExp = decodeExp(accessToken);
116
125
  log('Token refreshed');
117
126
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "integram-mcp",
3
- "version": "0.7.149",
3
+ "version": "0.7.151",
4
4
  "type": "module",
5
5
  "description": "MCP server for Integram — connect AI assistants to your workspace via Model Context Protocol",
6
6
  "mcpName": "io.github.judas-priest/integram",
@@ -27,7 +27,8 @@
27
27
  "index.js",
28
28
  "activation-memory.js",
29
29
  "pending-hitl.js",
30
- "orphan-watchdog.js"
30
+ "orphan-watchdog.js",
31
+ "auth-token.js"
31
32
  ],
32
33
  "dependencies": {
33
34
  "@modelcontextprotocol/sdk": "^1.12.1",