biaws-mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Fabiano Bondia
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,323 @@
1
+ # Bondia Workspaces MCP
2
+
3
+ Servidor MCP para agentes consultarem e atualizarem, de forma controlada, a base de conhecimento operacional mantida pelo `biaws-api`.
4
+
5
+ O servidor separa os domínios:
6
+
7
+ - `workspaces_*`, `applications_*`, `components_*`, `repositories_*`,
8
+ `servers_*`, `deployments_*` e `runtimes_*`: catálogo de aplicações e
9
+ topologia operacional.
10
+ - `issues_*`: chamados, incidentes, requisições operacionais, taxonomia e classificação.
11
+ - `demands_*`: melhorias, especificações, jornadas, prazos e contexto para desenvolvimento.
12
+ - `procedures_*`: procedimentos operacionais em Markdown, com tags e classificação taxonômica compartilhadas com issues.
13
+ - `documents_*`: regras, decisões, guidelines, features e referências técnicas
14
+ relacionado a aplicações e componentes.
15
+ - `knowledge_context_load`: regras ativas e decisões aceitas para o contexto
16
+ solicitado.
17
+ - `attachments_*`: envio, download, classificação e exclusão de arquivos de
18
+ chamados, melhorias, tarefas e procedimentos.
19
+ - `secrets_*`: consulta e registro de metadados de segredos, sem acesso aos valores.
20
+ - `monitoring_templates_*` e `runtime_active_monitors_*`: administração
21
+ versionada de templates e configuração de monitoramentos ativos dos runtimes.
22
+ - `resource_collections_*` e `*_move_to_collection`: organização hierárquica
23
+ de aplicações, regras, decisões, procedimentos, segredos, skills e servidores.
24
+
25
+ O carregamento de ambiente é autocontido no pacote. Em um checkout, ele preserva
26
+ o fallback para o `.env` da raiz; no pacote publicado, usa o `.env` local ou o
27
+ arquivo indicado por `BIAWS_ENV_FILE`. O MCP conversa com a `biaws-api` por HTTP
28
+ e não acessa diretamente o mecanismo de armazenamento.
29
+
30
+ Em instalações multi-instância, `BIAWS_ENV_FILE` aponta para
31
+ `instances/<nome>/.env`. Esse arquivo tem precedência sobre o `.env` da raiz e
32
+ permite que várias instâncias compartilhem o mesmo clone do código. Ele contém
33
+ a URL e a credencial da instância, mas não seleciona o workspace.
34
+
35
+ Por padrão, a API é buscada em `http://127.0.0.1:3100`. Para apontar para outro endereço, use uma das variáveis:
36
+
37
+ - `ISSUE_API_URL`
38
+ - `ISSUE_API_BASE_URL`
39
+ - `VITE_ISSUE_API_URL`
40
+
41
+ Defina obrigatoriamente `ISSUE_API_KEY`. O bootstrap open source cria uma
42
+ identidade técnica e grava sua chave no `.env` local; uma chave também pode ser
43
+ criada manualmente pela UI. O MCP a envia como `Authorization: Bearer`.
44
+
45
+ Defina `ISSUE_WORKSPACE_ID` no bloco `env` do servidor MCP local ao projeto. O
46
+ MCP preserva esse valor mesmo ao carregar `BIAWS_ENV_FILE` e o envia como
47
+ `X-Biaws-Workspace-Id`; argumentos das tools não ampliam esse escopo. A chave
48
+ precisa pertencer ao workspace — selecionar o ID não concede permissões.
49
+
50
+ Chamadas HTTP são interrompidas após 15 segundos por padrão. Defina
51
+ `BIAWS_MCP_HTTP_TIMEOUT_MS` para alterar esse limite, até o máximo de 120
52
+ segundos. O timeout cobre tanto a conexão quanto a leitura do corpo da resposta.
53
+ Leituras com falhas transitórias (`429`, `502`, `503` ou `504`) recebem até duas
54
+ novas tentativas com backoff; `BIAWS_MCP_HTTP_RETRIES` configura esse número
55
+ entre zero e três. Escritas, autenticação, autorização e validação nunca são
56
+ repetidas automaticamente.
57
+
58
+ Arquivos enviados ou baixados pelo MCP têm limite padrão de 10 MiB. Defina
59
+ `BIAWS_MCP_MAX_ATTACHMENT_BYTES` para reduzir ou elevar esse limite, respeitado
60
+ o teto de 50 MiB do MCP e o limite independente configurado na API.
61
+
62
+ ## Instalação e execução
63
+
64
+ O pacote público expõe o executável `biaws-mcp`. Clientes configurados pelo CLI
65
+ usam uma versão fixada por meio do cache local do npm:
66
+
67
+ ```bash
68
+ npx --yes biaws-mcp@0.1.0
69
+ ```
70
+
71
+ Também é possível instalá-lo explicitamente:
72
+
73
+ ```bash
74
+ npm install --global biaws-mcp@0.1.0
75
+ biaws-mcp
76
+ ```
77
+
78
+ O processo continua usando transporte MCP `stdio`; somente as chamadas para a
79
+ `biaws-api` atravessam a rede.
80
+
81
+ ### Desenvolvimento pelo checkout
82
+
83
+ Suba a `biaws-api` em outro terminal e execute:
84
+
85
+ ```bash
86
+ npm run check
87
+ npm start
88
+ ```
89
+
90
+ Em um cliente MCP, configure o comando:
91
+
92
+ ```bash
93
+ npx --yes biaws-mcp@0.1.0
94
+ ```
95
+
96
+ O fluxo recomendado é gerar a configuração completa com:
97
+
98
+ ```bash
99
+ BIAWS_ENV_FILE=/caminho/para/instances/minha-instancia/.env \
100
+ node /caminho/para/biaws/biaws-cli/src/index.js \
101
+ agent configure codex --project /caminho/do/projeto --workspace id-do-workspace
102
+ ```
103
+
104
+ O processo de publicação e rollback está em
105
+ [`docs/releasing.md`](docs/releasing.md).
106
+
107
+ ## Ferramentas
108
+
109
+ ### Catálogo e contexto de aplicações
110
+
111
+ As consultas do catálogo são:
112
+
113
+ - `workspaces_list` e `workspaces_get`;
114
+ - `applications_list`, `applications_get` e
115
+ `applications_get_context`;
116
+ - `components_list` e `components_get`;
117
+ - `integrations_list` e `integrations_get`;
118
+ - `repositories_list` e `repositories_get`;
119
+ - `servers_list` e `servers_get`;
120
+ - `deployments_list` e `deployments_get`;
121
+ - `runtimes_list` e `runtimes_get`.
122
+
123
+ As escritas estruturadas são:
124
+
125
+ - `applications_create` e `applications_update`;
126
+ - `components_create` e `components_update`;
127
+ - `integrations_create` e `integrations_update`;
128
+ - `repositories_create` e `repositories_update`;
129
+ - `servers_create` e `servers_update`;
130
+ - `deployments_create` e `deployments_update`;
131
+ - `runtimes_create` e `runtimes_update`.
132
+
133
+ As ferramentas de escrita usam `POST` ou `PATCH` da API e, portanto, herdam
134
+ suas validações de escopo, relações, permissões e auditoria. Integrações
135
+ apontam para outra aplicação ativa do mesmo workspace e preservam o destino
136
+ imutável. Arquivamento não
137
+ é exposto pelo MCP nesta fase.
138
+
139
+ ### Monitoramento
140
+
141
+ Templates de monitoramento usam o workspace selecionado na configuração do
142
+ servidor MCP e preservam as permissões, validações e auditoria da API:
143
+
144
+ - `monitoring_templates_list` e `monitoring_templates_get`: consultam templates
145
+ e versões;
146
+ - `monitoring_templates_preview`: testa uma definição com uma amostra JSON sem
147
+ persistir;
148
+ - `monitoring_templates_create` e `monitoring_templates_create_version`: criam
149
+ a versão inicial ou uma nova versão em rascunho;
150
+ - `monitoring_templates_get_usage` e `monitoring_templates_get_contract`:
151
+ consultam uso e contrato público;
152
+ - `monitoring_templates_validate`: avalia uma amostra com uma versão persistida
153
+ sem registrar observação;
154
+ - `monitoring_templates_activate` e `monitoring_templates_deactivate`: alteram
155
+ o estado da versão;
156
+ - `monitoring_templates_archive`: arquiva somente uma versão sem uso, conforme
157
+ validação da API.
158
+
159
+ Monitoramentos ativos são configurados por referência pública ou ID do runtime:
160
+
161
+ - `runtime_active_monitors_list`;
162
+ - `runtime_active_monitors_create`;
163
+ - `runtime_active_monitors_update`;
164
+ - `runtime_active_monitors_archive`.
165
+
166
+ As tools não aceitam `workspaceId`; o escopo vem exclusivamente de
167
+ `ISSUE_WORKSPACE_ID`. Configurações REST podem referenciar segredos apenas por
168
+ identificadores públicos em `headerRefs`; valores de credenciais não pertencem
169
+ ao MCP. Templates são permitidos somente para o provider REST. Para preparar um
170
+ monitor antes de provisionar o executor, crie-o com `enabled: false`.
171
+
172
+ ### Coleções de recursos
173
+
174
+ - `resource_collections_list`: lista a árvore de um tipo de recurso;
175
+ - `resource_collections_create`: cria uma coleção na raiz ou sob outra coleção;
176
+ - `resource_collections_update`: renomeia ou reparenta uma coleção;
177
+ - `resource_collections_delete`: exclui somente uma coleção vazia, sem
178
+ subcoleções nem itens vinculados;
179
+ - `applications_move_to_collection`, `servers_move_to_collection`,
180
+ `secrets_move_to_collection`, `skills_move_to_collection` e
181
+ `procedures_move_to_collection`: movem um item para uma coleção validada ou
182
+ para a raiz quando `collectionId` é vazio.
183
+
184
+ As quatro ferramentas `resource_collections_*` aceitam `resourceType` com os
185
+ valores `applications`, `procedures`, `secrets`, `skills` ou `servers`.
186
+ Procedimentos usam sua árvore própria na API; os demais recursos usam a árvore
187
+ compartilhada por tipo. Todas as mutações mantêm as validações contra ciclos,
188
+ escopo do workspace, permissões e auditoria da API.
189
+
190
+ `applications_get_context` entrega, em uma única consulta, a aplicação,
191
+ integrações, componentes, repositórios, deployments, runtimes, servidores referenciados e
192
+ resumos de issues, melhorias e procedimentos associados. O argumento `limit`
193
+ vale separadamente para cada grupo, tem teto de 100 e padrão 25. O resultado
194
+ informa totais e truncamentos e não contém credenciais, endereços dos
195
+ servidores, metadata dos runtimes, anexos nem os textos extensos da base de
196
+ conhecimento.
197
+
198
+ ### Issues / chamados
199
+
200
+ - `issues_search`: busca issues com os mesmos filtros principais da
201
+ `biaws-api`, inclusive por workspace, aplicação e componente afetado.
202
+ - `issues_get`: obtém uma issue com comentários e metadados dos anexos.
203
+ - `issues_get_classification_catalog`: obtém a árvore taxonômica e os grupos de tags válidos; opcionalmente inclui listas achatadas de IDs e caminhos.
204
+ - `issues_create_taxonomy_item`: inclui um item na raiz ou sob outro item,
205
+ opcionalmente configurando seu escopo por aplicações.
206
+ - `issues_update_taxonomy_item`: altera o nome ou o escopo por aplicações de
207
+ um item existente, preservando seu ID e seus descendentes.
208
+ - `issues_summary`: retorna agregados por dia, semana, mês, ano, tipo, status e taxonomia.
209
+ - `issues_aggregate`: retorna uma agregação específica.
210
+ - `issues_create`: cria uma issue manual com origem `mcp`; `applicationId` é
211
+ obrigatório.
212
+ - `issues_import_eml`: analisa ou importa um EML enviado em Base64; `dryRun` é `true` por padrão.
213
+ - `issues_update_state`: altera status e/ou tipo de uma issue.
214
+ - `issues_suggest_taxonomy`: sugere taxonomias aderentes ao texto da issue.
215
+ - `issues_classify`: grava classificação/KB em `issues.classification`.
216
+ - `issues_by_taxonomy`: busca issues por assunto/taxonomia, incluindo todos os
217
+ seus descendentes e filtros opcionais de contexto.
218
+
219
+ ### Melhorias
220
+
221
+ - `demands_list`: lista melhorias com filtros simples e de contexto.
222
+ - `demands_get`: obtém uma melhoria estruturada.
223
+ - `demands_create`: cria uma melhoria com dados cadastrais, especificação,
224
+ checklist e planejamento; `applicationId` é obrigatório.
225
+ - `demands_journey_calendar`: consolida jornadas previstas e executadas por mês.
226
+ - `demands_deadlines`: consolida prazos e situação por melhoria.
227
+ - `demands_implementation_context`: extrai contexto de especificação e tarefas para agentes de desenvolvimento.
228
+ - `demands_add_note`: adiciona anotação a uma melhoria.
229
+ - `demands_update_description`: atualiza a descrição sucinta da melhoria.
230
+ - `demands_list_tasks`: lista tarefas, com filtro opcional por status.
231
+ - `demands_create_task`: inclui uma tarefa.
232
+ - `demands_update_task`: altera código, título, status, datas, situação, descrição ou especificação de uma tarefa.
233
+ - `demands_update_task_status`: altera somente o status de uma tarefa.
234
+ - `demands_delete_task`: exclui uma tarefa.
235
+ - `demands_add_task_note`: adiciona uma nota de execução a uma tarefa.
236
+ - `demands_update_task_note`: altera uma nota de execução.
237
+ - `demands_delete_task_note`: exclui uma nota de execução.
238
+
239
+ ### Anexos
240
+
241
+ - `attachments_upload`: envia até dez arquivos, fornecidos em
242
+ `files[].contentBase64`, para uma entidade;
243
+ - `attachments_download`: devolve nome, MIME type, tamanho e conteúdo integral
244
+ do arquivo em `contentBase64`;
245
+ - `attachments_update_tags`: substitui as tags de classificação do arquivo;
246
+ - `attachments_delete`: exclui permanentemente o registro do anexo e seu
247
+ conteúdo armazenado.
248
+
249
+ As quatro ferramentas aceitam `entityType` com `issue`, `demand`, `task` ou
250
+ `procedure`. `entityId` identifica o chamado, melhoria ou procedimento. Para
251
+ `task`, `entityId` deve ser o ID da melhoria pai e `taskId` deve identificar a
252
+ tarefa por ID ou código.
253
+
254
+ Como a API ainda não possui uma rota própria de anexos de tarefas, o MCP mantém
255
+ o contrato vigente da UI: armazena o arquivo na melhoria e associa a tarefa por
256
+ uma tag igual ao seu código. O MCP valida essa associação antes de baixar,
257
+ alterar tags ou excluir o arquivo e nunca remove a tag da tarefa por meio de
258
+ `attachments_update_tags`.
259
+
260
+ Os arquivos trafegam exclusivamente em Base64 no protocolo MCP. O servidor não
261
+ aceita caminhos locais, URLs para download remoto ou referências ao filesystem
262
+ do processo. Todas as operações passam pelas rotas autenticadas da
263
+ `biaws-api`, preservando autorização, escopo e auditoria por domínio.
264
+ Em instalações novas, o grupo padrão `agent-operator` inclui as permissões de
265
+ leitura, criação, alteração de tags e exclusão de anexos nesses três domínios
266
+ raiz. Matrizes de grupos já existentes são preservadas durante atualizações;
267
+ quando essas permissões tiverem sido removidas ou ainda não existirem, um
268
+ administrador deverá concedê-las. Operações no contexto de tarefa usam as
269
+ permissões de anexos da melhoria pai.
270
+
271
+ ### Procedimentos
272
+
273
+ - `procedures_search`: pesquisa por ID, texto (título, sumário e conteúdo),
274
+ taxonomia (incluindo descendentes), tag e contexto.
275
+ - `procedures_get_classification_catalog`: obtém a árvore taxonômica e os grupos de tags; opcionalmente inclui listas achatadas de IDs válidos.
276
+ - `procedures_create`: cria um procedimento com título, sumário, conteúdo,
277
+ classificação e contexto opcionais.
278
+ - `procedures_update`: atualiza parcialmente título, sumário, conteúdo,
279
+ classificação ou contexto.
280
+
281
+ ### Metadados de segredos
282
+
283
+ - `secrets_list`: lista metadados, com filtros por aplicação, ambiente, estado
284
+ de provisionamento e estado de arquivamento;
285
+ - `secrets_get`: consulta os metadados de um registro;
286
+ - `secrets_register`: registra uma necessidade de segredo com identificação,
287
+ descrição, tipo, formato esperado, aplicação, ambiente e coleção opcionais.
288
+
289
+ `secrets_register` cria um item com `provisioningStatus: pending`, sem provider,
290
+ versão ou conteúdo. Um usuário autorizado deve completar o registro pela UI,
291
+ usando **Cadastrar valor** ou **Enviar arquivo**. A primeira gravação cria a
292
+ versão 1 e altera o estado para `ready`.
293
+
294
+ O grupo padrão `agent-operator` recebe `secrets.metadata.read` e
295
+ `secrets.metadata.create`, mas não recebe `secrets.value.write` ou
296
+ `secrets.value.reveal`.
297
+
298
+ Issues e melhorias criadas pelo MCP sempre pertencem a uma aplicação e podem
299
+ informar `affectedComponentIds`. Procedimentos podem permanecer gerais ao
300
+ workspace ou ser vinculados opcionalmente a uma aplicação e seus componentes.
301
+ Nas ferramentas de consulta, os filtros comuns são `workspaceId`,
302
+ `applicationId` e `componentId`.
303
+
304
+ ## Segurança operacional
305
+
306
+ Este MCP não expõe uma ferramenta genérica de armazenamento. As escritas disponíveis são intencionais, estruturadas, limitadas ao domínio e passam pela `biaws-api`. As ferramentas `attachments_*` aceitam somente os quatro tipos de entidade declarados e não podem ser usadas para segredos. As ferramentas `secrets_*` não possuem campos para valor, arquivo ou conteúdo codificado.
307
+
308
+ O MCP não acessa MongoDB, não executa shell, SSH, deploy ou sincronização Git e
309
+ não recebe valores de senhas, tokens, chaves privadas, kubeconfig ou connection
310
+ strings. A `ISSUE_API_KEY` é a única credencial do processo e
311
+ é usada exclusivamente no cabeçalho HTTP.
312
+
313
+ Erros da API mantêm o status e o código funcional para que o agente diferencie
314
+ falta de autenticação (`401`), falta de permissão (`403`), recurso inexistente
315
+ (`404`), conflito (`409`) e payload ou relação inválida (`422`). Erros de
316
+ execução são devolvidos como resultado MCP com `isError: true`, conteúdo textual
317
+ e `structuredContent.error`; não são convertidos em erro de protocolo JSON-RPC.
318
+ Quando disponíveis, o resultado também preserva `requiredPermissions`, erros
319
+ por campo, `requestId` e a indicação `retryable`. Chamadas simultâneas são
320
+ isoladas, e `notifications/cancelled` interrompe o HTTP associado sem bloquear
321
+ as demais ferramentas.
322
+
323
+ Para `issues_import_eml`, o agente deve fornecer `filename` e o conteúdo integral em `contentBase64`. Para efetivar a escrita, deve informar explicitamente `dryRun: false`; caso contrário, a ferramenta apenas retorna a issue, os comentários e os anexos que seriam importados.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import "../src/index.js";
@@ -0,0 +1,50 @@
1
+ # Publicação e rollback do MCP
2
+
3
+ ## Publicar no npm
4
+
5
+ O pacote e seu executável chamam-se `biaws-mcp`. Antes de publicar, autentique
6
+ a conta npm que controlará o pacote:
7
+
8
+ ```bash
9
+ npm login
10
+ npm whoami
11
+ ```
12
+
13
+ Da raiz do repositório, valide testes, metadados, conteúdo e handshake do
14
+ tarball sem alterar o registry:
15
+
16
+ ```bash
17
+ ./scripts/publish-biaws-mcp.sh
18
+ ```
19
+
20
+ Atualize `version` em `biaws-mcp/package.json` e no respectivo lock, mantenha a
21
+ árvore Git limpa e publique:
22
+
23
+ ```bash
24
+ ./scripts/publish-biaws-mcp.sh --publish
25
+ ```
26
+
27
+ Toda versão referenciada pelo CLI precisa ser publicada antes da versão do CLI
28
+ que passa a referenciá-la. Atualize também `MCP_PACKAGE_VERSION` em
29
+ `biaws-cli/src/commands/agent.js` e execute os dois `release:check`.
30
+
31
+ ## Validar uma instalação limpa
32
+
33
+ ```bash
34
+ cd biaws-mcp
35
+ package_file="$(npm pack --pack-destination /tmp)"
36
+ npm install --global --prefix /tmp/biaws-mcp-global "/tmp/${package_file}"
37
+ printf '%s\n' \
38
+ '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{}}}' \
39
+ '{"jsonrpc":"2.0","method":"notifications/initialized","params":{}}' \
40
+ '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' \
41
+ | /tmp/biaws-mcp-global/bin/biaws-mcp
42
+ ```
43
+
44
+ Depois da publicação, valide também `npx --yes biaws-mcp@<versão>` com o mesmo
45
+ handshake.
46
+
47
+ ## Rollback
48
+
49
+ Prefira `npm deprecate biaws-mcp@<versão> "mensagem"` a `npm unpublish`.
50
+ Publique uma versão corretiva e faça o CLI apontar explicitamente para ela.
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "biaws-mcp",
3
+ "version": "0.1.0",
4
+ "description": "Servidor MCP de domínio para o Bondia Workspaces",
5
+ "license": "Apache-2.0",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/fbondia/biaws.git",
9
+ "directory": "biaws-mcp"
10
+ },
11
+ "homepage": "https://github.com/fbondia/biaws#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/fbondia/biaws/issues"
14
+ },
15
+ "keywords": [
16
+ "biaws",
17
+ "bondia-workspaces",
18
+ "mcp",
19
+ "model-context-protocol"
20
+ ],
21
+ "type": "module",
22
+ "bin": {
23
+ "biaws-mcp": "bin/biaws-mcp.js"
24
+ },
25
+ "files": [
26
+ "bin",
27
+ "docs",
28
+ "LICENSE",
29
+ "src",
30
+ "README.md"
31
+ ],
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "engines": {
36
+ "node": ">=20.19.0"
37
+ },
38
+ "scripts": {
39
+ "start": "node src/index.js",
40
+ "format": "prettier --config ../prettier/.prettierrc --ignore-path ../.prettierignore --write .",
41
+ "format:check": "prettier --config ../prettier/.prettierrc --ignore-path ../.prettierignore --check .",
42
+ "check": "find bin src test scripts -type f \\( -name '*.js' -o -name '*.mjs' \\) -exec node --check {} \\;",
43
+ "test": "node --test",
44
+ "package:verify": "node scripts/verify-package.mjs",
45
+ "release:check": "npm run format:check && npm run check && npm test && npm run package:verify",
46
+ "publish:npm": "../scripts/publish-biaws-mcp.sh",
47
+ "prepack": "npm run package:verify"
48
+ },
49
+ "devDependencies": {
50
+ "prettier": "^3.7.4"
51
+ }
52
+ }