vault-go 0.6.0 → 0.7.0

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
@@ -14,6 +14,42 @@ bun --version
14
14
 
15
15
  ## Instalação MCP
16
16
 
17
+ ### Opção remota somente leitura
18
+
19
+ Para pesquisa e contexto, é possível usar diretamente o endpoint Streamable
20
+ HTTP da plataforma, sem instalar runtime ou banco local. Crie em **Segurança >
21
+ Chaves de API** uma chave apenas com `memory:read` e configure:
22
+
23
+ ```sh
24
+ export VAULT_GO_TOKEN='<chave-memory-read>'
25
+ codex mcp add vault-go \
26
+ --url https://vault.resolveup.com.br/api/mcp \
27
+ --bearer-token-env-var VAULT_GO_TOKEN
28
+ ```
29
+
30
+ Configuração genérica para clientes com transporte HTTP:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "vault-go": {
36
+ "type": "http",
37
+ "url": "https://vault.resolveup.com.br/api/mcp",
38
+ "headers": {
39
+ "Authorization": "Bearer ${VAULT_GO_TOKEN}"
40
+ }
41
+ }
42
+ }
43
+ }
44
+ ```
45
+
46
+ O endpoint remoto expõe somente projetos, busca, contexto, recentes, feed,
47
+ linha do tempo, contexto de arquivos, estatísticas, estado vetorial e consultas
48
+ às bases de conhecimento. Para captura automática, criação/reconstrução de
49
+ bases, escrita, importação ou exclusão, use o cliente Bun completo abaixo.
50
+
51
+ ### Opção Bun completa
52
+
17
53
  Execução direta:
18
54
 
19
55
  ```sh
@@ -51,9 +87,13 @@ possível apontar outro diretório:
51
87
  }
52
88
  ```
53
89
 
54
- Para ambientes efêmeros, `VAULT_GO_TOKEN` aceita um access token e
55
- `VAULT_GO_API_URL` troca o endpoint. Prefira o login normal, porque ele permite
56
- renovação automática da sessão.
90
+ Para ambientes efêmeros, `VAULT_GO_TOKEN` aceita um access token de sessão ou
91
+ uma chave `vg_live_...` criada na tela **Segurança > Chaves de API**. Use
92
+ somente os escopos necessários: `memory:read` para pesquisa/contexto,
93
+ `memory:write` para eventos e lembranças e `memory:delete` para exclusão.
94
+ `VAULT_GO_API_URL` troca o endpoint. O login normal permite renovação
95
+ automática; a chave de API é indicada para automações com prazo e escopo
96
+ limitados.
57
97
 
58
98
  ## Ferramentas MCP
59
99
 
@@ -72,10 +112,21 @@ renovação automática da sessão.
72
112
  - `vault_go_job_retry` e `vault_go_job_cancel`: controle idempotente do processamento.
73
113
  - `vault_go_export` e `vault_go_import`: transporte JSON tenant-scoped, atômico e idempotente.
74
114
  - `vault_go_embedding_status` e `vault_go_embedding_backfill`: busca híbrida e fila vetorial, sem expor chaves.
115
+ - `vault_go_feed`: pagina memórias recentes por projeto, tipo e origem.
116
+ - `vault_go_knowledge_bases` e `vault_go_knowledge_base`: lista e abre bases focadas.
117
+ - `vault_go_knowledge_build` e `vault_go_knowledge_rebuild`: cria ou atualiza uma base a partir de filtros.
118
+ - `vault_go_knowledge_query`: recupera contexto fundamentado e citações dentro da base.
119
+ - `vault_go_knowledge_delete`: remove a base e preserva as memórias originais.
75
120
  - `vault_go_forget`: exclusão explícita de uma memória.
76
121
 
77
122
  O recurso `vault-go://status` fornece o resumo sanitizado em JSON.
78
123
 
124
+ As bases, filtros, vínculos e feed ficam exclusivamente no PostgreSQL da
125
+ plataforma. A consulta retorna evidências e `synthesisAvailable: false`; o
126
+ cliente MCP faz a síntese, evitando respostas inventadas e chaves ocultas no
127
+ servidor. A síntese do servidor só será habilitada quando um provedor semântico
128
+ for configurado explicitamente.
129
+
79
130
  ## Fluxo integrado
80
131
 
81
132
  ```text
package/dist/cloud.d.ts CHANGED
@@ -19,6 +19,13 @@ export interface VaultMemoryApi {
19
19
  importMemories(input: Record<string, unknown>): Promise<unknown>;
20
20
  embeddingStatus(): Promise<unknown>;
21
21
  embeddingBackfill(): Promise<unknown>;
22
+ feed(input: Record<string, unknown>): Promise<unknown>;
23
+ knowledgeBases(): Promise<unknown>;
24
+ knowledgeBase(id: string): Promise<unknown>;
25
+ buildKnowledgeBase(input: Record<string, unknown>): Promise<unknown>;
26
+ rebuildKnowledgeBase(id: string): Promise<unknown>;
27
+ queryKnowledgeBase(id: string, input: Record<string, unknown>): Promise<unknown>;
28
+ deleteKnowledgeBase(id: string): Promise<unknown>;
22
29
  }
23
30
  export declare class VaultCloudClient implements VaultMemoryApi {
24
31
  private readonly home;
@@ -44,6 +51,13 @@ export declare class VaultCloudClient implements VaultMemoryApi {
44
51
  importMemories(input: Record<string, unknown>): Promise<unknown>;
45
52
  embeddingStatus(): Promise<unknown>;
46
53
  embeddingBackfill(): Promise<unknown>;
54
+ feed(input: Record<string, unknown>): Promise<unknown>;
55
+ knowledgeBases(): Promise<unknown>;
56
+ knowledgeBase(id: string): Promise<unknown>;
57
+ buildKnowledgeBase(input: Record<string, unknown>): Promise<unknown>;
58
+ rebuildKnowledgeBase(id: string): Promise<unknown>;
59
+ queryKnowledgeBase(id: string, input: Record<string, unknown>): Promise<unknown>;
60
+ deleteKnowledgeBase(id: string): Promise<unknown>;
47
61
  private endpoint;
48
62
  private accessToken;
49
63
  private request;
package/dist/cloud.js CHANGED
@@ -78,6 +78,34 @@ export class VaultCloudClient {
78
78
  async embeddingBackfill() {
79
79
  return this.request('/memory/embeddings/backfill', { method: 'POST' });
80
80
  }
81
+ async feed(input) {
82
+ return this.request('/memory/feed', { query: input });
83
+ }
84
+ async knowledgeBases() {
85
+ return this.request('/memory/knowledge-bases');
86
+ }
87
+ async knowledgeBase(id) {
88
+ return this.request(`/memory/knowledge-bases/${encodeURIComponent(id)}`);
89
+ }
90
+ async buildKnowledgeBase(input) {
91
+ return this.request('/memory/knowledge-bases', { method: 'POST', body: input });
92
+ }
93
+ async rebuildKnowledgeBase(id) {
94
+ return this.request(`/memory/knowledge-bases/${encodeURIComponent(id)}/rebuild`, {
95
+ method: 'POST',
96
+ });
97
+ }
98
+ async queryKnowledgeBase(id, input) {
99
+ return this.request(`/memory/knowledge-bases/${encodeURIComponent(id)}/query`, {
100
+ method: 'POST',
101
+ body: input,
102
+ });
103
+ }
104
+ async deleteKnowledgeBase(id) {
105
+ return this.request(`/memory/knowledge-bases/${encodeURIComponent(id)}`, {
106
+ method: 'DELETE',
107
+ });
108
+ }
81
109
  endpoint(path) {
82
110
  const base = validateApiUrl(loadConfig(this.home).apiUrl);
83
111
  const prefix = base.pathname.replace(/\/$/u, '');
@@ -128,7 +156,13 @@ export class VaultCloudClient {
128
156
  };
129
157
  if (options.body)
130
158
  request.body = JSON.stringify(options.body);
131
- const response = await this.cloudFetch(this.endpoint(path), request);
159
+ const endpoint = this.endpoint(path);
160
+ for (const [key, value] of Object.entries(options.query ?? {})) {
161
+ if (value !== undefined && value !== null && value !== '') {
162
+ endpoint.searchParams.set(key, String(value));
163
+ }
164
+ }
165
+ const response = await this.cloudFetch(endpoint, request);
132
166
  if (response.status === 401 && options.authenticated !== false && !options.retried) {
133
167
  return this.request(path, { ...options, retried: true });
134
168
  }
package/dist/server.js CHANGED
@@ -26,6 +26,17 @@ async function run(operation) {
26
26
  }
27
27
  }
28
28
  const uuid = z.string().uuid();
29
+ const knowledgeFilters = z.object({
30
+ projectId: uuid.optional(),
31
+ kinds: z.array(z.string().trim().min(1).max(100)).max(20).default([]),
32
+ memoryTypes: z.array(z.string().trim().min(1).max(100)).max(20).default([]),
33
+ concepts: z.array(z.string().trim().min(1).max(500)).max(50).default([]),
34
+ files: z.array(z.string().trim().min(1).max(2_000)).max(50).default([]),
35
+ query: z.string().trim().max(1_000).optional(),
36
+ dateStartEpoch: z.number().int().positive().optional(),
37
+ dateEndEpoch: z.number().int().positive().optional(),
38
+ limit: z.number().int().min(1).max(2_000).default(200),
39
+ });
29
40
  export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudClient(home)) {
30
41
  const server = new McpServer({ name: 'vault-go', version: VERSION });
31
42
  server.registerTool('vault_go_status', {
@@ -50,7 +61,7 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
50
61
  title: 'Criar projeto',
51
62
  description: 'Cria um projeto de memória no Vault.',
52
63
  inputSchema: {
53
- name: z.string().trim().min(1).max(200),
64
+ name: z.string().trim().min(3).max(80),
54
65
  rootPath: z.string().trim().max(2_000).optional(),
55
66
  },
56
67
  annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true },
@@ -158,6 +169,68 @@ export function createVaultGoServer(home = vaultHome(), cloud = new VaultCloudCl
158
169
  inputSchema: {},
159
170
  annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
160
171
  }, async () => run(() => cloud.stats()));
172
+ server.registerTool('vault_go_feed', {
173
+ title: 'Feed de memórias',
174
+ description: 'Lista memórias recentes com paginação estável por cursor.',
175
+ inputSchema: {
176
+ projectId: uuid.optional(),
177
+ kind: z.string().trim().max(100).optional(),
178
+ memoryType: z.string().trim().max(100).optional(),
179
+ platformSource: z.string().trim().max(100).optional(),
180
+ cursor: z.string().trim().max(200).optional(),
181
+ limit: z.number().int().min(1).max(200).default(20),
182
+ },
183
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
184
+ }, async (input) => run(() => cloud.feed(input)));
185
+ server.registerTool('vault_go_knowledge_bases', {
186
+ title: 'Listar bases de conhecimento',
187
+ description: 'Lista bases filtradas e persistidas na plataforma Vault.',
188
+ inputSchema: {},
189
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
190
+ }, async () => run(() => cloud.knowledgeBases()));
191
+ server.registerTool('vault_go_knowledge_base', {
192
+ title: 'Abrir base de conhecimento',
193
+ description: 'Retorna a configuração e as memórias vinculadas a uma base.',
194
+ inputSchema: { id: uuid },
195
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
196
+ }, async ({ id }) => run(() => cloud.knowledgeBase(id)));
197
+ server.registerTool('vault_go_knowledge_build', {
198
+ title: 'Criar base de conhecimento',
199
+ description: 'Cria uma base PostgreSQL a partir de filtros explícitos.',
200
+ inputSchema: {
201
+ name: z.string().trim().min(1).max(200),
202
+ description: z.string().trim().max(2_000).optional(),
203
+ filters: knowledgeFilters,
204
+ },
205
+ annotations: { readOnlyHint: false, idempotentHint: false, openWorldHint: true },
206
+ }, async (input) => run(() => cloud.buildKnowledgeBase(input)));
207
+ server.registerTool('vault_go_knowledge_rebuild', {
208
+ title: 'Reconstruir base de conhecimento',
209
+ description: 'Reaplica os filtros salvos para incluir as memórias atuais.',
210
+ inputSchema: { id: uuid },
211
+ annotations: { readOnlyHint: false, idempotentHint: true, openWorldHint: true },
212
+ }, async ({ id }) => run(() => cloud.rebuildKnowledgeBase(id)));
213
+ server.registerTool('vault_go_knowledge_query', {
214
+ title: 'Consultar base de conhecimento',
215
+ description: 'Retorna contexto fundamentado e citações para síntese pelo cliente MCP.',
216
+ inputSchema: {
217
+ id: uuid,
218
+ question: z.string().trim().min(1).max(1_000),
219
+ limit: z.number().int().min(1).max(100).default(20),
220
+ },
221
+ annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: true },
222
+ }, async ({ id, ...input }) => run(() => cloud.queryKnowledgeBase(id, input)));
223
+ server.registerTool('vault_go_knowledge_delete', {
224
+ title: 'Excluir base de conhecimento',
225
+ description: 'Exclui a base e seus vínculos, preservando as memórias originais.',
226
+ inputSchema: { id: uuid },
227
+ annotations: {
228
+ readOnlyHint: false,
229
+ destructiveHint: true,
230
+ idempotentHint: true,
231
+ openWorldHint: true,
232
+ },
233
+ }, async ({ id }) => run(() => cloud.deleteKnowledgeBase(id)));
161
234
  server.registerTool('vault_go_jobs', {
162
235
  title: 'Fila de processamento',
163
236
  description: 'Lista jobs da conta sem expor o conteúdo dos eventos.',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vault-go",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Servidor MCP Bun para pesquisar e registrar memória na plataforma Vault.",
5
5
  "type": "module",
6
6
  "bin": {