sienge-ecbiesek-mcp 1.2.0__py3-none-any.whl → 1.2.2__py3-none-any.whl
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.
Potentially problematic release.
This version of sienge-ecbiesek-mcp might be problematic. Click here for more details.
- {sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/METADATA +2 -23
- sienge_ecbiesek_mcp-1.2.2.dist-info/RECORD +11 -0
- sienge_mcp/__init__.py +4 -4
- sienge_mcp/server.py +110 -53
- sienge_mcp/server2.py +110 -53
- sienge_ecbiesek_mcp-1.2.0.dist-info/RECORD +0 -11
- {sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/WHEEL +0 -0
- {sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/entry_points.txt +0 -0
- {sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/licenses/LICENSE +0 -0
- {sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/top_level.txt +0 -0
|
@@ -1,30 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sienge-ecbiesek-mcp
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: 🏗️ Model Context Protocol (MCP) server for Sienge API integration - Brazilian construction ERP system. Connect Claude AI to Sienge with 50+ powerful tools for comprehensive business management including financials, projects, and operations.
|
|
5
5
|
Author-email: ECBIESEK <ti@ecbiesek.com>
|
|
6
|
-
License: MIT
|
|
7
|
-
|
|
8
|
-
Copyright (c) 2025 Sienge MCP Contributors
|
|
9
|
-
|
|
10
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
-
in the Software without restriction, including without limitation the rights
|
|
13
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
-
furnished to do so, subject to the following conditions:
|
|
16
|
-
|
|
17
|
-
The above copyright notice and this permission notice shall be included in all
|
|
18
|
-
copies or substantial portions of the Software.
|
|
19
|
-
|
|
20
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
-
SOFTWARE.
|
|
27
|
-
|
|
6
|
+
License: MIT
|
|
28
7
|
Project-URL: Homepage, https://github.com/INOTECH-ecbiesek/Sienge-MCP
|
|
29
8
|
Project-URL: Documentation, https://github.com/INOTECH-ecbiesek/Sienge-MCP#readme
|
|
30
9
|
Project-URL: Repository, https://github.com/INOTECH-ecbiesek/Sienge-MCP.git
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
sienge_ecbiesek_mcp-1.2.2.dist-info/licenses/LICENSE,sha256=leWD46QLXsQ43M8fE_KgOo5Sf0YB9_X8EVqGdV0Dsc0,1101
|
|
2
|
+
sienge_mcp/__init__.py,sha256=LgXn5BfGLTWmLi5p1JbweikNexTc_1wLHBfGJBxwX7M,297
|
|
3
|
+
sienge_mcp/metadata.py,sha256=wN_XSjUkHJ0QA38CaCtAR7ImsYndSvBPrTmRe8gSLdM,1109
|
|
4
|
+
sienge_mcp/server.py,sha256=2pAJcpF29bjOM4rd6rc-yzWYIdGWjYr5BlVc3pxsD8E,102160
|
|
5
|
+
sienge_mcp/server2.py,sha256=2pAJcpF29bjOM4rd6rc-yzWYIdGWjYr5BlVc3pxsD8E,102160
|
|
6
|
+
sienge_mcp/utils/logger.py,sha256=3Ty7SGcpxAC3vruoRJEK78iZb7wxnDv__EESYQrIMB4,5712
|
|
7
|
+
sienge_ecbiesek_mcp-1.2.2.dist-info/METADATA,sha256=8s5o0xPW1E4d-bp9qL7VZ08bx1JgfhbgTOFIFtXTYdo,11406
|
|
8
|
+
sienge_ecbiesek_mcp-1.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
sienge_ecbiesek_mcp-1.2.2.dist-info/entry_points.txt,sha256=jxEu6gvTw3ci0mjDfqbi0rBLRpeuscwwRk9-H-UOnO8,63
|
|
10
|
+
sienge_ecbiesek_mcp-1.2.2.dist-info/top_level.txt,sha256=FCvuhB9JQPKGY0Q8aKoVc7akqG5htoJyfj-eJvVUmWM,11
|
|
11
|
+
sienge_ecbiesek_mcp-1.2.2.dist-info/RECORD,,
|
sienge_mcp/__init__.py
CHANGED
|
@@ -3,7 +3,7 @@ Sienge MCP Server Package
|
|
|
3
3
|
Model Context Protocol integration for Sienge API
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
__version__ = "1.
|
|
7
|
-
__author__ = "
|
|
8
|
-
__email__ = "
|
|
9
|
-
__description__ = "
|
|
6
|
+
__version__ = "1.2.2"
|
|
7
|
+
__author__ = "ECBIESEK"
|
|
8
|
+
__email__ = "ti@ecbiesek.com"
|
|
9
|
+
__description__ = "🏗️ Model Context Protocol (MCP) server for Sienge API integration - Brazilian construction ERP system"
|
sienge_mcp/server.py
CHANGED
|
@@ -660,7 +660,7 @@ async def _svc_get_purchase_invoices(*, limit: int = 50, date_from: str = None)
|
|
|
660
660
|
|
|
661
661
|
|
|
662
662
|
@mcp.tool
|
|
663
|
-
async def test_sienge_connection() -> Dict:
|
|
663
|
+
async def test_sienge_connection(_meta: Optional[Dict] = None) -> Dict:
|
|
664
664
|
"""Testa a conexão com a API do Sienge"""
|
|
665
665
|
try:
|
|
666
666
|
# Usar serviço interno
|
|
@@ -701,7 +701,8 @@ async def test_sienge_connection() -> Dict:
|
|
|
701
701
|
|
|
702
702
|
@mcp.tool
|
|
703
703
|
async def get_sienge_customers(
|
|
704
|
-
limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None, customer_type_id: Optional[str] = None
|
|
704
|
+
limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None, customer_type_id: Optional[str] = None,
|
|
705
|
+
_meta: Optional[Dict] = None
|
|
705
706
|
) -> Dict:
|
|
706
707
|
"""
|
|
707
708
|
Busca clientes no Sienge com filtros
|
|
@@ -750,7 +751,7 @@ async def get_sienge_customers(
|
|
|
750
751
|
|
|
751
752
|
|
|
752
753
|
@mcp.tool
|
|
753
|
-
async def get_sienge_customer_types() -> Dict:
|
|
754
|
+
async def get_sienge_customer_types(_meta: Optional[Dict] = None) -> Dict:
|
|
754
755
|
"""Lista tipos de clientes disponíveis"""
|
|
755
756
|
# Usar serviço interno
|
|
756
757
|
result = await _svc_get_customer_types()
|
|
@@ -785,8 +786,8 @@ async def get_sienge_customer_types() -> Dict:
|
|
|
785
786
|
|
|
786
787
|
@mcp.tool
|
|
787
788
|
async def get_sienge_enterprises(
|
|
788
|
-
limit: int = 100, offset: int = 0, company_id: int = None, enterprise_type: int = None
|
|
789
|
-
) -> Dict:
|
|
789
|
+
limit: int = 100, offset: int = 0, company_id: int = None, enterprise_type: int = None,
|
|
790
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
790
791
|
"""
|
|
791
792
|
ALIAS: get_sienge_projects → get_sienge_enterprises
|
|
792
793
|
Busca empreendimentos/obras (compatibilidade com checklist)
|
|
@@ -803,8 +804,8 @@ async def get_sienge_enterprises(
|
|
|
803
804
|
async def get_sienge_suppliers(
|
|
804
805
|
limit: int = 50,
|
|
805
806
|
offset: int = 0,
|
|
806
|
-
search: str = None
|
|
807
|
-
) -> Dict:
|
|
807
|
+
search: str = None,
|
|
808
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
808
809
|
"""
|
|
809
810
|
ALIAS: get_sienge_creditors → get_sienge_suppliers
|
|
810
811
|
Busca fornecedores (compatibilidade com checklist)
|
|
@@ -874,8 +875,8 @@ async def search_sienge_finances(
|
|
|
874
875
|
@mcp.tool
|
|
875
876
|
async def get_sienge_accounts_payable(
|
|
876
877
|
start_date: str = None, end_date: str = None, creditor_id: str = None,
|
|
877
|
-
status: str = None, limit: int = 50
|
|
878
|
-
) -> Dict:
|
|
878
|
+
status: str = None, limit: int = 50,
|
|
879
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
879
880
|
"""
|
|
880
881
|
ALIAS: get_sienge_bills → get_sienge_accounts_payable
|
|
881
882
|
Busca contas a pagar (compatibilidade com checklist)
|
|
@@ -890,7 +891,8 @@ async def get_sienge_accounts_payable(
|
|
|
890
891
|
|
|
891
892
|
|
|
892
893
|
@mcp.tool
|
|
893
|
-
async def list_sienge_purchase_invoices(limit: int = 50, date_from: str = None
|
|
894
|
+
async def list_sienge_purchase_invoices(limit: int = 50, date_from: str = None,
|
|
895
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
894
896
|
"""
|
|
895
897
|
Lista notas fiscais de compra (versão list/plural esperada pelo checklist)
|
|
896
898
|
|
|
@@ -929,7 +931,8 @@ async def list_sienge_purchase_invoices(limit: int = 50, date_from: str = None)
|
|
|
929
931
|
|
|
930
932
|
|
|
931
933
|
@mcp.tool
|
|
932
|
-
async def list_sienge_purchase_requests(limit: int = 50, status: str = None
|
|
934
|
+
async def list_sienge_purchase_requests(limit: int = 50, status: str = None,
|
|
935
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
933
936
|
"""
|
|
934
937
|
Lista solicitações de compra (versão list/plural esperada pelo checklist)
|
|
935
938
|
|
|
@@ -971,7 +974,8 @@ async def list_sienge_purchase_requests(limit: int = 50, status: str = None) ->
|
|
|
971
974
|
|
|
972
975
|
|
|
973
976
|
@mcp.tool
|
|
974
|
-
async def get_sienge_creditors(limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None
|
|
977
|
+
async def get_sienge_creditors(limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None,
|
|
978
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
975
979
|
"""
|
|
976
980
|
Busca credores/fornecedores
|
|
977
981
|
|
|
@@ -1015,7 +1019,8 @@ async def get_sienge_creditors(limit: Optional[int] = 50, offset: Optional[int]
|
|
|
1015
1019
|
|
|
1016
1020
|
|
|
1017
1021
|
@mcp.tool
|
|
1018
|
-
async def get_sienge_creditor_bank_info(creditor_id: str
|
|
1022
|
+
async def get_sienge_creditor_bank_info(creditor_id: str,
|
|
1023
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1019
1024
|
"""
|
|
1020
1025
|
Consulta informações bancárias de um credor
|
|
1021
1026
|
|
|
@@ -1061,7 +1066,7 @@ async def get_sienge_accounts_receivable(
|
|
|
1061
1066
|
origins_ids: Optional[List[str]] = None,
|
|
1062
1067
|
bearers_id_in: Optional[List[int]] = None,
|
|
1063
1068
|
bearers_id_not_in: Optional[List[int]] = None,
|
|
1064
|
-
) -> Dict:
|
|
1069
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1065
1070
|
"""
|
|
1066
1071
|
Consulta parcelas do contas a receber via API bulk-data
|
|
1067
1072
|
MELHORADO: Suporte a polling assíncrono para requests 202
|
|
@@ -1140,8 +1145,8 @@ async def get_sienge_accounts_receivable(
|
|
|
1140
1145
|
|
|
1141
1146
|
@mcp.tool
|
|
1142
1147
|
async def get_sienge_accounts_receivable_by_bills(
|
|
1143
|
-
bills_ids: List[int], correction_indexer_id: Optional[int] = None, correction_date: Optional[str] = None
|
|
1144
|
-
) -> Dict:
|
|
1148
|
+
bills_ids: List[int], correction_indexer_id: Optional[int] = None, correction_date: Optional[str] = None,
|
|
1149
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1145
1150
|
"""
|
|
1146
1151
|
Consulta parcelas dos títulos informados via API bulk-data
|
|
1147
1152
|
MELHORADO: Suporte a polling assíncrono para requests 202
|
|
@@ -1205,7 +1210,7 @@ async def get_sienge_bills(
|
|
|
1205
1210
|
creditor_id: Optional[str] = None,
|
|
1206
1211
|
status: Optional[str] = None,
|
|
1207
1212
|
limit: Optional[int] = 50,
|
|
1208
|
-
) -> Dict:
|
|
1213
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1209
1214
|
"""
|
|
1210
1215
|
Consulta títulos a pagar (contas a pagar) - REQUER startDate obrigatório
|
|
1211
1216
|
|
|
@@ -1278,7 +1283,7 @@ async def get_sienge_purchase_orders(
|
|
|
1278
1283
|
status: Optional[str] = None,
|
|
1279
1284
|
date_from: Optional[str] = None,
|
|
1280
1285
|
limit: Optional[int] = 50,
|
|
1281
|
-
) -> Dict:
|
|
1286
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1282
1287
|
"""
|
|
1283
1288
|
Consulta pedidos de compra
|
|
1284
1289
|
|
|
@@ -1326,7 +1331,8 @@ async def get_sienge_purchase_orders(
|
|
|
1326
1331
|
|
|
1327
1332
|
|
|
1328
1333
|
@mcp.tool
|
|
1329
|
-
async def get_sienge_purchase_order_items(purchase_order_id: str
|
|
1334
|
+
async def get_sienge_purchase_order_items(purchase_order_id: str,
|
|
1335
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1330
1336
|
"""
|
|
1331
1337
|
Consulta itens de um pedido de compra específico
|
|
1332
1338
|
|
|
@@ -1356,7 +1362,8 @@ async def get_sienge_purchase_order_items(purchase_order_id: str) -> Dict:
|
|
|
1356
1362
|
|
|
1357
1363
|
|
|
1358
1364
|
@mcp.tool
|
|
1359
|
-
async def get_sienge_purchase_requests(purchase_request_id: Optional[str] = None, limit: Optional[int] = 50
|
|
1365
|
+
async def get_sienge_purchase_requests(purchase_request_id: Optional[str] = None, limit: Optional[int] = 50,
|
|
1366
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1360
1367
|
"""
|
|
1361
1368
|
Consulta solicitações de compra
|
|
1362
1369
|
|
|
@@ -1397,7 +1404,8 @@ async def get_sienge_purchase_requests(purchase_request_id: Optional[str] = None
|
|
|
1397
1404
|
|
|
1398
1405
|
|
|
1399
1406
|
@mcp.tool
|
|
1400
|
-
async def create_sienge_purchase_request(description: str, project_id: str, items: List[Dict[str, Any]]
|
|
1407
|
+
async def create_sienge_purchase_request(description: str, project_id: str, items: List[Dict[str, Any]],
|
|
1408
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1401
1409
|
"""
|
|
1402
1410
|
Cria nova solicitação de compra
|
|
1403
1411
|
|
|
@@ -1440,7 +1448,8 @@ async def create_sienge_purchase_request(description: str, project_id: str, item
|
|
|
1440
1448
|
|
|
1441
1449
|
|
|
1442
1450
|
@mcp.tool
|
|
1443
|
-
async def get_sienge_purchase_invoice(sequential_number: int
|
|
1451
|
+
async def get_sienge_purchase_invoice(sequential_number: int,
|
|
1452
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1444
1453
|
"""
|
|
1445
1454
|
Consulta nota fiscal de compra por número sequencial
|
|
1446
1455
|
|
|
@@ -1461,7 +1470,8 @@ async def get_sienge_purchase_invoice(sequential_number: int) -> Dict:
|
|
|
1461
1470
|
|
|
1462
1471
|
|
|
1463
1472
|
@mcp.tool
|
|
1464
|
-
async def get_sienge_purchase_invoice_items(sequential_number: int
|
|
1473
|
+
async def get_sienge_purchase_invoice_items(sequential_number: int,
|
|
1474
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1465
1475
|
"""
|
|
1466
1476
|
Consulta itens de uma nota fiscal de compra
|
|
1467
1477
|
|
|
@@ -1502,7 +1512,7 @@ async def create_sienge_purchase_invoice(
|
|
|
1502
1512
|
issue_date: str,
|
|
1503
1513
|
series: Optional[str] = None,
|
|
1504
1514
|
notes: Optional[str] = None,
|
|
1505
|
-
) -> Dict:
|
|
1515
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1506
1516
|
"""
|
|
1507
1517
|
Cadastra uma nova nota fiscal de compra
|
|
1508
1518
|
|
|
@@ -1552,7 +1562,7 @@ async def add_items_to_purchase_invoice(
|
|
|
1552
1562
|
copy_notes_purchase_orders: bool = True,
|
|
1553
1563
|
copy_notes_resources: bool = False,
|
|
1554
1564
|
copy_attachments_purchase_orders: bool = True,
|
|
1555
|
-
) -> Dict:
|
|
1565
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1556
1566
|
"""
|
|
1557
1567
|
Insere itens em uma nota fiscal a partir de entregas de pedidos de compra
|
|
1558
1568
|
|
|
@@ -1603,7 +1613,7 @@ async def get_sienge_purchase_invoices_deliveries_attended(
|
|
|
1603
1613
|
purchase_order_item_number: Optional[int] = None,
|
|
1604
1614
|
limit: Optional[int] = 100,
|
|
1605
1615
|
offset: Optional[int] = 0,
|
|
1606
|
-
) -> Dict:
|
|
1616
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1607
1617
|
"""
|
|
1608
1618
|
Lista entregas atendidas entre pedidos de compra e notas fiscais
|
|
1609
1619
|
|
|
@@ -1657,7 +1667,8 @@ async def get_sienge_purchase_invoices_deliveries_attended(
|
|
|
1657
1667
|
|
|
1658
1668
|
|
|
1659
1669
|
@mcp.tool
|
|
1660
|
-
async def get_sienge_stock_inventory(cost_center_id: str, resource_id: Optional[str] = None
|
|
1670
|
+
async def get_sienge_stock_inventory(cost_center_id: str, resource_id: Optional[str] = None,
|
|
1671
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1661
1672
|
"""
|
|
1662
1673
|
Consulta inventário de estoque por centro de custo
|
|
1663
1674
|
|
|
@@ -1694,7 +1705,8 @@ async def get_sienge_stock_inventory(cost_center_id: str, resource_id: Optional[
|
|
|
1694
1705
|
|
|
1695
1706
|
|
|
1696
1707
|
@mcp.tool
|
|
1697
|
-
async def get_sienge_stock_reservations(limit: Optional[int] = 50
|
|
1708
|
+
async def get_sienge_stock_reservations(limit: Optional[int] = 50,
|
|
1709
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1698
1710
|
"""
|
|
1699
1711
|
Lista reservas de estoque
|
|
1700
1712
|
|
|
@@ -1734,7 +1746,7 @@ async def get_sienge_projects(
|
|
|
1734
1746
|
enterprise_type: Optional[int] = None,
|
|
1735
1747
|
receivable_register: Optional[str] = None,
|
|
1736
1748
|
only_buildings_enabled: Optional[bool] = False,
|
|
1737
|
-
) -> Dict:
|
|
1749
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1738
1750
|
"""
|
|
1739
1751
|
Busca empreendimentos/obras no Sienge
|
|
1740
1752
|
CORRIGIDO: Mapeamento correto da chave de resposta
|
|
@@ -1792,7 +1804,8 @@ async def get_sienge_projects(
|
|
|
1792
1804
|
|
|
1793
1805
|
|
|
1794
1806
|
@mcp.tool
|
|
1795
|
-
async def get_sienge_enterprise_by_id(enterprise_id: int
|
|
1807
|
+
async def get_sienge_enterprise_by_id(enterprise_id: int,
|
|
1808
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1796
1809
|
"""
|
|
1797
1810
|
Busca um empreendimento específico por ID no Sienge
|
|
1798
1811
|
|
|
@@ -1813,7 +1826,8 @@ async def get_sienge_enterprise_by_id(enterprise_id: int) -> Dict:
|
|
|
1813
1826
|
|
|
1814
1827
|
|
|
1815
1828
|
@mcp.tool
|
|
1816
|
-
async def get_sienge_enterprise_groupings(enterprise_id: int
|
|
1829
|
+
async def get_sienge_enterprise_groupings(enterprise_id: int,
|
|
1830
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1817
1831
|
"""
|
|
1818
1832
|
Busca agrupamentos de unidades de um empreendimento específico
|
|
1819
1833
|
|
|
@@ -1840,7 +1854,8 @@ async def get_sienge_enterprise_groupings(enterprise_id: int) -> Dict:
|
|
|
1840
1854
|
|
|
1841
1855
|
|
|
1842
1856
|
@mcp.tool
|
|
1843
|
-
async def get_sienge_units(limit: Optional[int] = 50, offset: Optional[int] = 0
|
|
1857
|
+
async def get_sienge_units(limit: Optional[int] = 50, offset: Optional[int] = 0,
|
|
1858
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1844
1859
|
"""
|
|
1845
1860
|
Consulta unidades cadastradas no Sienge
|
|
1846
1861
|
|
|
@@ -1886,7 +1901,7 @@ async def get_sienge_unit_cost_tables(
|
|
|
1886
1901
|
description: Optional[str] = None,
|
|
1887
1902
|
status: Optional[str] = "Active",
|
|
1888
1903
|
integration_enabled: Optional[bool] = None,
|
|
1889
|
-
) -> Dict:
|
|
1904
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1890
1905
|
"""
|
|
1891
1906
|
Consulta tabelas de custos unitários
|
|
1892
1907
|
|
|
@@ -1934,8 +1949,8 @@ async def search_sienge_data(
|
|
|
1934
1949
|
query: str,
|
|
1935
1950
|
entity_type: Optional[str] = None,
|
|
1936
1951
|
limit: Optional[int] = 20,
|
|
1937
|
-
filters: Optional[Dict[str, Any]] = None
|
|
1938
|
-
) -> Dict:
|
|
1952
|
+
filters: Optional[Dict[str, Any]] = None,
|
|
1953
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1939
1954
|
"""
|
|
1940
1955
|
Busca universal no Sienge - compatível com ChatGPT/OpenAI MCP
|
|
1941
1956
|
|
|
@@ -2112,7 +2127,7 @@ async def _search_specific_entity(entity_type: str, query: str, limit: int, filt
|
|
|
2112
2127
|
|
|
2113
2128
|
|
|
2114
2129
|
@mcp.tool
|
|
2115
|
-
async def list_sienge_entities() -> Dict:
|
|
2130
|
+
async def list_sienge_entities(_meta: Optional[Dict] = None) -> Dict:
|
|
2116
2131
|
"""
|
|
2117
2132
|
Lista todas as entidades disponíveis no Sienge MCP para busca
|
|
2118
2133
|
|
|
@@ -2206,8 +2221,8 @@ async def get_sienge_data_paginated(
|
|
|
2206
2221
|
page: int = 1,
|
|
2207
2222
|
page_size: int = 20,
|
|
2208
2223
|
filters: Optional[Dict[str, Any]] = None,
|
|
2209
|
-
sort_by: Optional[str] = None
|
|
2210
|
-
) -> Dict:
|
|
2224
|
+
sort_by: Optional[str] = None,
|
|
2225
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
2211
2226
|
"""
|
|
2212
2227
|
Busca dados do Sienge com paginação avançada - compatível com ChatGPT
|
|
2213
2228
|
|
|
@@ -2328,8 +2343,8 @@ async def search_sienge_financial_data(
|
|
|
2328
2343
|
search_type: str = "both",
|
|
2329
2344
|
amount_min: Optional[float] = None,
|
|
2330
2345
|
amount_max: Optional[float] = None,
|
|
2331
|
-
customer_creditor_search: Optional[str] = None
|
|
2332
|
-
) -> Dict:
|
|
2346
|
+
customer_creditor_search: Optional[str] = None,
|
|
2347
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
2333
2348
|
"""
|
|
2334
2349
|
Busca avançada em dados financeiros do Sienge - Contas a Pagar e Receber
|
|
2335
2350
|
|
|
@@ -2479,13 +2494,50 @@ async def search_sienge_financial_data(
|
|
|
2479
2494
|
}
|
|
2480
2495
|
|
|
2481
2496
|
|
|
2497
|
+
async def _svc_test_connection() -> Dict:
|
|
2498
|
+
"""Serviço interno: testar conexão com a API do Sienge"""
|
|
2499
|
+
try:
|
|
2500
|
+
# Usar serviço interno
|
|
2501
|
+
result = await _svc_get_customer_types()
|
|
2502
|
+
|
|
2503
|
+
if result["success"]:
|
|
2504
|
+
auth_method = "Bearer Token" if SIENGE_API_KEY else "Basic Auth"
|
|
2505
|
+
return {
|
|
2506
|
+
"success": True,
|
|
2507
|
+
"message": "✅ Conexão com API do Sienge estabelecida com sucesso!",
|
|
2508
|
+
"api_status": "Online",
|
|
2509
|
+
"auth_method": auth_method,
|
|
2510
|
+
"timestamp": datetime.now().isoformat(),
|
|
2511
|
+
"request_id": result.get("request_id"),
|
|
2512
|
+
"latency_ms": result.get("latency_ms"),
|
|
2513
|
+
"cache": result.get("cache")
|
|
2514
|
+
}
|
|
2515
|
+
else:
|
|
2516
|
+
return {
|
|
2517
|
+
"success": False,
|
|
2518
|
+
"message": "❌ Falha ao conectar com API do Sienge",
|
|
2519
|
+
"error": result.get("error"),
|
|
2520
|
+
"details": result.get("message"),
|
|
2521
|
+
"timestamp": datetime.now().isoformat(),
|
|
2522
|
+
"request_id": result.get("request_id")
|
|
2523
|
+
}
|
|
2524
|
+
except Exception as e:
|
|
2525
|
+
return {
|
|
2526
|
+
"success": False,
|
|
2527
|
+
"message": "❌ Erro ao testar conexão",
|
|
2528
|
+
"error": str(e),
|
|
2529
|
+
"timestamp": datetime.now().isoformat(),
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
|
|
2482
2533
|
@mcp.tool
|
|
2483
|
-
async def
|
|
2484
|
-
"""
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2534
|
+
async def test_sienge_connection(_meta: Optional[Dict] = None) -> Dict:
|
|
2535
|
+
"""Testa a conexão com a API do Sienge"""
|
|
2536
|
+
return await _svc_test_connection()
|
|
2537
|
+
|
|
2538
|
+
|
|
2539
|
+
async def _svc_get_dashboard_summary() -> Dict:
|
|
2540
|
+
"""Serviço interno: obter resumo do dashboard"""
|
|
2489
2541
|
# Data atual e períodos
|
|
2490
2542
|
today = datetime.now()
|
|
2491
2543
|
current_month_start = today.replace(day=1).strftime("%Y-%m-%d")
|
|
@@ -2496,7 +2548,7 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2496
2548
|
|
|
2497
2549
|
# 1. Testar conexão
|
|
2498
2550
|
try:
|
|
2499
|
-
connection_test = await
|
|
2551
|
+
connection_test = await _svc_test_connection()
|
|
2500
2552
|
dashboard_data["connection"] = connection_test
|
|
2501
2553
|
except Exception as e:
|
|
2502
2554
|
errors.append(f"Teste de conexão: {str(e)}")
|
|
@@ -2504,16 +2556,14 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2504
2556
|
|
|
2505
2557
|
# 2. Contar clientes (amostra)
|
|
2506
2558
|
try:
|
|
2507
|
-
# CORRIGIDO: Usar serviço interno
|
|
2508
2559
|
customers_result = await _svc_get_customers(limit=1)
|
|
2509
|
-
dashboard_data["
|
|
2560
|
+
dashboard_data["customers_available"] = customers_result["success"]
|
|
2510
2561
|
except Exception as e:
|
|
2511
2562
|
errors.append(f"Clientes: {str(e)}")
|
|
2512
|
-
dashboard_data["
|
|
2563
|
+
dashboard_data["customers_available"] = False
|
|
2513
2564
|
|
|
2514
2565
|
# 3. Contar projetos (amostra)
|
|
2515
2566
|
try:
|
|
2516
|
-
# CORRIGIDO: Usar serviço interno
|
|
2517
2567
|
projects_result = await _svc_get_projects(limit=5)
|
|
2518
2568
|
if projects_result["success"]:
|
|
2519
2569
|
data = projects_result["data"]
|
|
@@ -2533,7 +2583,6 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2533
2583
|
|
|
2534
2584
|
# 4. Títulos a pagar do mês atual
|
|
2535
2585
|
try:
|
|
2536
|
-
# CORRIGIDO: Usar serviço interno
|
|
2537
2586
|
bills_result = await _svc_get_bills(
|
|
2538
2587
|
start_date=current_month_start,
|
|
2539
2588
|
end_date=current_month_end,
|
|
@@ -2557,7 +2606,6 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2557
2606
|
|
|
2558
2607
|
# 5. Tipos de clientes
|
|
2559
2608
|
try:
|
|
2560
|
-
# CORRIGIDO: Usar serviço interno
|
|
2561
2609
|
customer_types_result = await _svc_get_customer_types()
|
|
2562
2610
|
if customer_types_result["success"]:
|
|
2563
2611
|
data = customer_types_result["data"]
|
|
@@ -2594,6 +2642,15 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2594
2642
|
}
|
|
2595
2643
|
|
|
2596
2644
|
|
|
2645
|
+
@mcp.tool
|
|
2646
|
+
async def get_sienge_dashboard_summary(_meta: Optional[Dict] = None) -> Dict:
|
|
2647
|
+
"""
|
|
2648
|
+
Obtém um resumo tipo dashboard com informações gerais do Sienge
|
|
2649
|
+
Útil para visão geral rápida do sistema
|
|
2650
|
+
"""
|
|
2651
|
+
return await _svc_get_dashboard_summary()
|
|
2652
|
+
|
|
2653
|
+
|
|
2597
2654
|
# ============ UTILITÁRIOS ============
|
|
2598
2655
|
|
|
2599
2656
|
|
sienge_mcp/server2.py
CHANGED
|
@@ -660,7 +660,7 @@ async def _svc_get_purchase_invoices(*, limit: int = 50, date_from: str = None)
|
|
|
660
660
|
|
|
661
661
|
|
|
662
662
|
@mcp.tool
|
|
663
|
-
async def test_sienge_connection() -> Dict:
|
|
663
|
+
async def test_sienge_connection(_meta: Optional[Dict] = None) -> Dict:
|
|
664
664
|
"""Testa a conexão com a API do Sienge"""
|
|
665
665
|
try:
|
|
666
666
|
# Usar serviço interno
|
|
@@ -701,7 +701,8 @@ async def test_sienge_connection() -> Dict:
|
|
|
701
701
|
|
|
702
702
|
@mcp.tool
|
|
703
703
|
async def get_sienge_customers(
|
|
704
|
-
limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None, customer_type_id: Optional[str] = None
|
|
704
|
+
limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None, customer_type_id: Optional[str] = None,
|
|
705
|
+
_meta: Optional[Dict] = None
|
|
705
706
|
) -> Dict:
|
|
706
707
|
"""
|
|
707
708
|
Busca clientes no Sienge com filtros
|
|
@@ -750,7 +751,7 @@ async def get_sienge_customers(
|
|
|
750
751
|
|
|
751
752
|
|
|
752
753
|
@mcp.tool
|
|
753
|
-
async def get_sienge_customer_types() -> Dict:
|
|
754
|
+
async def get_sienge_customer_types(_meta: Optional[Dict] = None) -> Dict:
|
|
754
755
|
"""Lista tipos de clientes disponíveis"""
|
|
755
756
|
# Usar serviço interno
|
|
756
757
|
result = await _svc_get_customer_types()
|
|
@@ -785,8 +786,8 @@ async def get_sienge_customer_types() -> Dict:
|
|
|
785
786
|
|
|
786
787
|
@mcp.tool
|
|
787
788
|
async def get_sienge_enterprises(
|
|
788
|
-
limit: int = 100, offset: int = 0, company_id: int = None, enterprise_type: int = None
|
|
789
|
-
) -> Dict:
|
|
789
|
+
limit: int = 100, offset: int = 0, company_id: int = None, enterprise_type: int = None,
|
|
790
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
790
791
|
"""
|
|
791
792
|
ALIAS: get_sienge_projects → get_sienge_enterprises
|
|
792
793
|
Busca empreendimentos/obras (compatibilidade com checklist)
|
|
@@ -803,8 +804,8 @@ async def get_sienge_enterprises(
|
|
|
803
804
|
async def get_sienge_suppliers(
|
|
804
805
|
limit: int = 50,
|
|
805
806
|
offset: int = 0,
|
|
806
|
-
search: str = None
|
|
807
|
-
) -> Dict:
|
|
807
|
+
search: str = None,
|
|
808
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
808
809
|
"""
|
|
809
810
|
ALIAS: get_sienge_creditors → get_sienge_suppliers
|
|
810
811
|
Busca fornecedores (compatibilidade com checklist)
|
|
@@ -874,8 +875,8 @@ async def search_sienge_finances(
|
|
|
874
875
|
@mcp.tool
|
|
875
876
|
async def get_sienge_accounts_payable(
|
|
876
877
|
start_date: str = None, end_date: str = None, creditor_id: str = None,
|
|
877
|
-
status: str = None, limit: int = 50
|
|
878
|
-
) -> Dict:
|
|
878
|
+
status: str = None, limit: int = 50,
|
|
879
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
879
880
|
"""
|
|
880
881
|
ALIAS: get_sienge_bills → get_sienge_accounts_payable
|
|
881
882
|
Busca contas a pagar (compatibilidade com checklist)
|
|
@@ -890,7 +891,8 @@ async def get_sienge_accounts_payable(
|
|
|
890
891
|
|
|
891
892
|
|
|
892
893
|
@mcp.tool
|
|
893
|
-
async def list_sienge_purchase_invoices(limit: int = 50, date_from: str = None
|
|
894
|
+
async def list_sienge_purchase_invoices(limit: int = 50, date_from: str = None,
|
|
895
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
894
896
|
"""
|
|
895
897
|
Lista notas fiscais de compra (versão list/plural esperada pelo checklist)
|
|
896
898
|
|
|
@@ -929,7 +931,8 @@ async def list_sienge_purchase_invoices(limit: int = 50, date_from: str = None)
|
|
|
929
931
|
|
|
930
932
|
|
|
931
933
|
@mcp.tool
|
|
932
|
-
async def list_sienge_purchase_requests(limit: int = 50, status: str = None
|
|
934
|
+
async def list_sienge_purchase_requests(limit: int = 50, status: str = None,
|
|
935
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
933
936
|
"""
|
|
934
937
|
Lista solicitações de compra (versão list/plural esperada pelo checklist)
|
|
935
938
|
|
|
@@ -971,7 +974,8 @@ async def list_sienge_purchase_requests(limit: int = 50, status: str = None) ->
|
|
|
971
974
|
|
|
972
975
|
|
|
973
976
|
@mcp.tool
|
|
974
|
-
async def get_sienge_creditors(limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None
|
|
977
|
+
async def get_sienge_creditors(limit: Optional[int] = 50, offset: Optional[int] = 0, search: Optional[str] = None,
|
|
978
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
975
979
|
"""
|
|
976
980
|
Busca credores/fornecedores
|
|
977
981
|
|
|
@@ -1015,7 +1019,8 @@ async def get_sienge_creditors(limit: Optional[int] = 50, offset: Optional[int]
|
|
|
1015
1019
|
|
|
1016
1020
|
|
|
1017
1021
|
@mcp.tool
|
|
1018
|
-
async def get_sienge_creditor_bank_info(creditor_id: str
|
|
1022
|
+
async def get_sienge_creditor_bank_info(creditor_id: str,
|
|
1023
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1019
1024
|
"""
|
|
1020
1025
|
Consulta informações bancárias de um credor
|
|
1021
1026
|
|
|
@@ -1061,7 +1066,7 @@ async def get_sienge_accounts_receivable(
|
|
|
1061
1066
|
origins_ids: Optional[List[str]] = None,
|
|
1062
1067
|
bearers_id_in: Optional[List[int]] = None,
|
|
1063
1068
|
bearers_id_not_in: Optional[List[int]] = None,
|
|
1064
|
-
) -> Dict:
|
|
1069
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1065
1070
|
"""
|
|
1066
1071
|
Consulta parcelas do contas a receber via API bulk-data
|
|
1067
1072
|
MELHORADO: Suporte a polling assíncrono para requests 202
|
|
@@ -1140,8 +1145,8 @@ async def get_sienge_accounts_receivable(
|
|
|
1140
1145
|
|
|
1141
1146
|
@mcp.tool
|
|
1142
1147
|
async def get_sienge_accounts_receivable_by_bills(
|
|
1143
|
-
bills_ids: List[int], correction_indexer_id: Optional[int] = None, correction_date: Optional[str] = None
|
|
1144
|
-
) -> Dict:
|
|
1148
|
+
bills_ids: List[int], correction_indexer_id: Optional[int] = None, correction_date: Optional[str] = None,
|
|
1149
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1145
1150
|
"""
|
|
1146
1151
|
Consulta parcelas dos títulos informados via API bulk-data
|
|
1147
1152
|
MELHORADO: Suporte a polling assíncrono para requests 202
|
|
@@ -1205,7 +1210,7 @@ async def get_sienge_bills(
|
|
|
1205
1210
|
creditor_id: Optional[str] = None,
|
|
1206
1211
|
status: Optional[str] = None,
|
|
1207
1212
|
limit: Optional[int] = 50,
|
|
1208
|
-
) -> Dict:
|
|
1213
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1209
1214
|
"""
|
|
1210
1215
|
Consulta títulos a pagar (contas a pagar) - REQUER startDate obrigatório
|
|
1211
1216
|
|
|
@@ -1278,7 +1283,7 @@ async def get_sienge_purchase_orders(
|
|
|
1278
1283
|
status: Optional[str] = None,
|
|
1279
1284
|
date_from: Optional[str] = None,
|
|
1280
1285
|
limit: Optional[int] = 50,
|
|
1281
|
-
) -> Dict:
|
|
1286
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1282
1287
|
"""
|
|
1283
1288
|
Consulta pedidos de compra
|
|
1284
1289
|
|
|
@@ -1326,7 +1331,8 @@ async def get_sienge_purchase_orders(
|
|
|
1326
1331
|
|
|
1327
1332
|
|
|
1328
1333
|
@mcp.tool
|
|
1329
|
-
async def get_sienge_purchase_order_items(purchase_order_id: str
|
|
1334
|
+
async def get_sienge_purchase_order_items(purchase_order_id: str,
|
|
1335
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1330
1336
|
"""
|
|
1331
1337
|
Consulta itens de um pedido de compra específico
|
|
1332
1338
|
|
|
@@ -1356,7 +1362,8 @@ async def get_sienge_purchase_order_items(purchase_order_id: str) -> Dict:
|
|
|
1356
1362
|
|
|
1357
1363
|
|
|
1358
1364
|
@mcp.tool
|
|
1359
|
-
async def get_sienge_purchase_requests(purchase_request_id: Optional[str] = None, limit: Optional[int] = 50
|
|
1365
|
+
async def get_sienge_purchase_requests(purchase_request_id: Optional[str] = None, limit: Optional[int] = 50,
|
|
1366
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1360
1367
|
"""
|
|
1361
1368
|
Consulta solicitações de compra
|
|
1362
1369
|
|
|
@@ -1397,7 +1404,8 @@ async def get_sienge_purchase_requests(purchase_request_id: Optional[str] = None
|
|
|
1397
1404
|
|
|
1398
1405
|
|
|
1399
1406
|
@mcp.tool
|
|
1400
|
-
async def create_sienge_purchase_request(description: str, project_id: str, items: List[Dict[str, Any]]
|
|
1407
|
+
async def create_sienge_purchase_request(description: str, project_id: str, items: List[Dict[str, Any]],
|
|
1408
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1401
1409
|
"""
|
|
1402
1410
|
Cria nova solicitação de compra
|
|
1403
1411
|
|
|
@@ -1440,7 +1448,8 @@ async def create_sienge_purchase_request(description: str, project_id: str, item
|
|
|
1440
1448
|
|
|
1441
1449
|
|
|
1442
1450
|
@mcp.tool
|
|
1443
|
-
async def get_sienge_purchase_invoice(sequential_number: int
|
|
1451
|
+
async def get_sienge_purchase_invoice(sequential_number: int,
|
|
1452
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1444
1453
|
"""
|
|
1445
1454
|
Consulta nota fiscal de compra por número sequencial
|
|
1446
1455
|
|
|
@@ -1461,7 +1470,8 @@ async def get_sienge_purchase_invoice(sequential_number: int) -> Dict:
|
|
|
1461
1470
|
|
|
1462
1471
|
|
|
1463
1472
|
@mcp.tool
|
|
1464
|
-
async def get_sienge_purchase_invoice_items(sequential_number: int
|
|
1473
|
+
async def get_sienge_purchase_invoice_items(sequential_number: int,
|
|
1474
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1465
1475
|
"""
|
|
1466
1476
|
Consulta itens de uma nota fiscal de compra
|
|
1467
1477
|
|
|
@@ -1502,7 +1512,7 @@ async def create_sienge_purchase_invoice(
|
|
|
1502
1512
|
issue_date: str,
|
|
1503
1513
|
series: Optional[str] = None,
|
|
1504
1514
|
notes: Optional[str] = None,
|
|
1505
|
-
) -> Dict:
|
|
1515
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1506
1516
|
"""
|
|
1507
1517
|
Cadastra uma nova nota fiscal de compra
|
|
1508
1518
|
|
|
@@ -1552,7 +1562,7 @@ async def add_items_to_purchase_invoice(
|
|
|
1552
1562
|
copy_notes_purchase_orders: bool = True,
|
|
1553
1563
|
copy_notes_resources: bool = False,
|
|
1554
1564
|
copy_attachments_purchase_orders: bool = True,
|
|
1555
|
-
) -> Dict:
|
|
1565
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1556
1566
|
"""
|
|
1557
1567
|
Insere itens em uma nota fiscal a partir de entregas de pedidos de compra
|
|
1558
1568
|
|
|
@@ -1603,7 +1613,7 @@ async def get_sienge_purchase_invoices_deliveries_attended(
|
|
|
1603
1613
|
purchase_order_item_number: Optional[int] = None,
|
|
1604
1614
|
limit: Optional[int] = 100,
|
|
1605
1615
|
offset: Optional[int] = 0,
|
|
1606
|
-
) -> Dict:
|
|
1616
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1607
1617
|
"""
|
|
1608
1618
|
Lista entregas atendidas entre pedidos de compra e notas fiscais
|
|
1609
1619
|
|
|
@@ -1657,7 +1667,8 @@ async def get_sienge_purchase_invoices_deliveries_attended(
|
|
|
1657
1667
|
|
|
1658
1668
|
|
|
1659
1669
|
@mcp.tool
|
|
1660
|
-
async def get_sienge_stock_inventory(cost_center_id: str, resource_id: Optional[str] = None
|
|
1670
|
+
async def get_sienge_stock_inventory(cost_center_id: str, resource_id: Optional[str] = None,
|
|
1671
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1661
1672
|
"""
|
|
1662
1673
|
Consulta inventário de estoque por centro de custo
|
|
1663
1674
|
|
|
@@ -1694,7 +1705,8 @@ async def get_sienge_stock_inventory(cost_center_id: str, resource_id: Optional[
|
|
|
1694
1705
|
|
|
1695
1706
|
|
|
1696
1707
|
@mcp.tool
|
|
1697
|
-
async def get_sienge_stock_reservations(limit: Optional[int] = 50
|
|
1708
|
+
async def get_sienge_stock_reservations(limit: Optional[int] = 50,
|
|
1709
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1698
1710
|
"""
|
|
1699
1711
|
Lista reservas de estoque
|
|
1700
1712
|
|
|
@@ -1734,7 +1746,7 @@ async def get_sienge_projects(
|
|
|
1734
1746
|
enterprise_type: Optional[int] = None,
|
|
1735
1747
|
receivable_register: Optional[str] = None,
|
|
1736
1748
|
only_buildings_enabled: Optional[bool] = False,
|
|
1737
|
-
) -> Dict:
|
|
1749
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1738
1750
|
"""
|
|
1739
1751
|
Busca empreendimentos/obras no Sienge
|
|
1740
1752
|
CORRIGIDO: Mapeamento correto da chave de resposta
|
|
@@ -1792,7 +1804,8 @@ async def get_sienge_projects(
|
|
|
1792
1804
|
|
|
1793
1805
|
|
|
1794
1806
|
@mcp.tool
|
|
1795
|
-
async def get_sienge_enterprise_by_id(enterprise_id: int
|
|
1807
|
+
async def get_sienge_enterprise_by_id(enterprise_id: int,
|
|
1808
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1796
1809
|
"""
|
|
1797
1810
|
Busca um empreendimento específico por ID no Sienge
|
|
1798
1811
|
|
|
@@ -1813,7 +1826,8 @@ async def get_sienge_enterprise_by_id(enterprise_id: int) -> Dict:
|
|
|
1813
1826
|
|
|
1814
1827
|
|
|
1815
1828
|
@mcp.tool
|
|
1816
|
-
async def get_sienge_enterprise_groupings(enterprise_id: int
|
|
1829
|
+
async def get_sienge_enterprise_groupings(enterprise_id: int,
|
|
1830
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1817
1831
|
"""
|
|
1818
1832
|
Busca agrupamentos de unidades de um empreendimento específico
|
|
1819
1833
|
|
|
@@ -1840,7 +1854,8 @@ async def get_sienge_enterprise_groupings(enterprise_id: int) -> Dict:
|
|
|
1840
1854
|
|
|
1841
1855
|
|
|
1842
1856
|
@mcp.tool
|
|
1843
|
-
async def get_sienge_units(limit: Optional[int] = 50, offset: Optional[int] = 0
|
|
1857
|
+
async def get_sienge_units(limit: Optional[int] = 50, offset: Optional[int] = 0,
|
|
1858
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1844
1859
|
"""
|
|
1845
1860
|
Consulta unidades cadastradas no Sienge
|
|
1846
1861
|
|
|
@@ -1886,7 +1901,7 @@ async def get_sienge_unit_cost_tables(
|
|
|
1886
1901
|
description: Optional[str] = None,
|
|
1887
1902
|
status: Optional[str] = "Active",
|
|
1888
1903
|
integration_enabled: Optional[bool] = None,
|
|
1889
|
-
) -> Dict:
|
|
1904
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1890
1905
|
"""
|
|
1891
1906
|
Consulta tabelas de custos unitários
|
|
1892
1907
|
|
|
@@ -1934,8 +1949,8 @@ async def search_sienge_data(
|
|
|
1934
1949
|
query: str,
|
|
1935
1950
|
entity_type: Optional[str] = None,
|
|
1936
1951
|
limit: Optional[int] = 20,
|
|
1937
|
-
filters: Optional[Dict[str, Any]] = None
|
|
1938
|
-
) -> Dict:
|
|
1952
|
+
filters: Optional[Dict[str, Any]] = None,
|
|
1953
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
1939
1954
|
"""
|
|
1940
1955
|
Busca universal no Sienge - compatível com ChatGPT/OpenAI MCP
|
|
1941
1956
|
|
|
@@ -2112,7 +2127,7 @@ async def _search_specific_entity(entity_type: str, query: str, limit: int, filt
|
|
|
2112
2127
|
|
|
2113
2128
|
|
|
2114
2129
|
@mcp.tool
|
|
2115
|
-
async def list_sienge_entities() -> Dict:
|
|
2130
|
+
async def list_sienge_entities(_meta: Optional[Dict] = None) -> Dict:
|
|
2116
2131
|
"""
|
|
2117
2132
|
Lista todas as entidades disponíveis no Sienge MCP para busca
|
|
2118
2133
|
|
|
@@ -2206,8 +2221,8 @@ async def get_sienge_data_paginated(
|
|
|
2206
2221
|
page: int = 1,
|
|
2207
2222
|
page_size: int = 20,
|
|
2208
2223
|
filters: Optional[Dict[str, Any]] = None,
|
|
2209
|
-
sort_by: Optional[str] = None
|
|
2210
|
-
) -> Dict:
|
|
2224
|
+
sort_by: Optional[str] = None,
|
|
2225
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
2211
2226
|
"""
|
|
2212
2227
|
Busca dados do Sienge com paginação avançada - compatível com ChatGPT
|
|
2213
2228
|
|
|
@@ -2328,8 +2343,8 @@ async def search_sienge_financial_data(
|
|
|
2328
2343
|
search_type: str = "both",
|
|
2329
2344
|
amount_min: Optional[float] = None,
|
|
2330
2345
|
amount_max: Optional[float] = None,
|
|
2331
|
-
customer_creditor_search: Optional[str] = None
|
|
2332
|
-
) -> Dict:
|
|
2346
|
+
customer_creditor_search: Optional[str] = None,
|
|
2347
|
+
_meta: Optional[Dict] = None) -> Dict:
|
|
2333
2348
|
"""
|
|
2334
2349
|
Busca avançada em dados financeiros do Sienge - Contas a Pagar e Receber
|
|
2335
2350
|
|
|
@@ -2479,13 +2494,50 @@ async def search_sienge_financial_data(
|
|
|
2479
2494
|
}
|
|
2480
2495
|
|
|
2481
2496
|
|
|
2497
|
+
async def _svc_test_connection() -> Dict:
|
|
2498
|
+
"""Serviço interno: testar conexão com a API do Sienge"""
|
|
2499
|
+
try:
|
|
2500
|
+
# Usar serviço interno
|
|
2501
|
+
result = await _svc_get_customer_types()
|
|
2502
|
+
|
|
2503
|
+
if result["success"]:
|
|
2504
|
+
auth_method = "Bearer Token" if SIENGE_API_KEY else "Basic Auth"
|
|
2505
|
+
return {
|
|
2506
|
+
"success": True,
|
|
2507
|
+
"message": "✅ Conexão com API do Sienge estabelecida com sucesso!",
|
|
2508
|
+
"api_status": "Online",
|
|
2509
|
+
"auth_method": auth_method,
|
|
2510
|
+
"timestamp": datetime.now().isoformat(),
|
|
2511
|
+
"request_id": result.get("request_id"),
|
|
2512
|
+
"latency_ms": result.get("latency_ms"),
|
|
2513
|
+
"cache": result.get("cache")
|
|
2514
|
+
}
|
|
2515
|
+
else:
|
|
2516
|
+
return {
|
|
2517
|
+
"success": False,
|
|
2518
|
+
"message": "❌ Falha ao conectar com API do Sienge",
|
|
2519
|
+
"error": result.get("error"),
|
|
2520
|
+
"details": result.get("message"),
|
|
2521
|
+
"timestamp": datetime.now().isoformat(),
|
|
2522
|
+
"request_id": result.get("request_id")
|
|
2523
|
+
}
|
|
2524
|
+
except Exception as e:
|
|
2525
|
+
return {
|
|
2526
|
+
"success": False,
|
|
2527
|
+
"message": "❌ Erro ao testar conexão",
|
|
2528
|
+
"error": str(e),
|
|
2529
|
+
"timestamp": datetime.now().isoformat(),
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
|
|
2482
2533
|
@mcp.tool
|
|
2483
|
-
async def
|
|
2484
|
-
"""
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2534
|
+
async def test_sienge_connection(_meta: Optional[Dict] = None) -> Dict:
|
|
2535
|
+
"""Testa a conexão com a API do Sienge"""
|
|
2536
|
+
return await _svc_test_connection()
|
|
2537
|
+
|
|
2538
|
+
|
|
2539
|
+
async def _svc_get_dashboard_summary() -> Dict:
|
|
2540
|
+
"""Serviço interno: obter resumo do dashboard"""
|
|
2489
2541
|
# Data atual e períodos
|
|
2490
2542
|
today = datetime.now()
|
|
2491
2543
|
current_month_start = today.replace(day=1).strftime("%Y-%m-%d")
|
|
@@ -2496,7 +2548,7 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2496
2548
|
|
|
2497
2549
|
# 1. Testar conexão
|
|
2498
2550
|
try:
|
|
2499
|
-
connection_test = await
|
|
2551
|
+
connection_test = await _svc_test_connection()
|
|
2500
2552
|
dashboard_data["connection"] = connection_test
|
|
2501
2553
|
except Exception as e:
|
|
2502
2554
|
errors.append(f"Teste de conexão: {str(e)}")
|
|
@@ -2504,16 +2556,14 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2504
2556
|
|
|
2505
2557
|
# 2. Contar clientes (amostra)
|
|
2506
2558
|
try:
|
|
2507
|
-
# CORRIGIDO: Usar serviço interno
|
|
2508
2559
|
customers_result = await _svc_get_customers(limit=1)
|
|
2509
|
-
dashboard_data["
|
|
2560
|
+
dashboard_data["customers_available"] = customers_result["success"]
|
|
2510
2561
|
except Exception as e:
|
|
2511
2562
|
errors.append(f"Clientes: {str(e)}")
|
|
2512
|
-
dashboard_data["
|
|
2563
|
+
dashboard_data["customers_available"] = False
|
|
2513
2564
|
|
|
2514
2565
|
# 3. Contar projetos (amostra)
|
|
2515
2566
|
try:
|
|
2516
|
-
# CORRIGIDO: Usar serviço interno
|
|
2517
2567
|
projects_result = await _svc_get_projects(limit=5)
|
|
2518
2568
|
if projects_result["success"]:
|
|
2519
2569
|
data = projects_result["data"]
|
|
@@ -2533,7 +2583,6 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2533
2583
|
|
|
2534
2584
|
# 4. Títulos a pagar do mês atual
|
|
2535
2585
|
try:
|
|
2536
|
-
# CORRIGIDO: Usar serviço interno
|
|
2537
2586
|
bills_result = await _svc_get_bills(
|
|
2538
2587
|
start_date=current_month_start,
|
|
2539
2588
|
end_date=current_month_end,
|
|
@@ -2557,7 +2606,6 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2557
2606
|
|
|
2558
2607
|
# 5. Tipos de clientes
|
|
2559
2608
|
try:
|
|
2560
|
-
# CORRIGIDO: Usar serviço interno
|
|
2561
2609
|
customer_types_result = await _svc_get_customer_types()
|
|
2562
2610
|
if customer_types_result["success"]:
|
|
2563
2611
|
data = customer_types_result["data"]
|
|
@@ -2594,6 +2642,15 @@ async def get_sienge_dashboard_summary() -> Dict:
|
|
|
2594
2642
|
}
|
|
2595
2643
|
|
|
2596
2644
|
|
|
2645
|
+
@mcp.tool
|
|
2646
|
+
async def get_sienge_dashboard_summary(_meta: Optional[Dict] = None) -> Dict:
|
|
2647
|
+
"""
|
|
2648
|
+
Obtém um resumo tipo dashboard com informações gerais do Sienge
|
|
2649
|
+
Útil para visão geral rápida do sistema
|
|
2650
|
+
"""
|
|
2651
|
+
return await _svc_get_dashboard_summary()
|
|
2652
|
+
|
|
2653
|
+
|
|
2597
2654
|
# ============ UTILITÁRIOS ============
|
|
2598
2655
|
|
|
2599
2656
|
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
sienge_ecbiesek_mcp-1.2.0.dist-info/licenses/LICENSE,sha256=leWD46QLXsQ43M8fE_KgOo5Sf0YB9_X8EVqGdV0Dsc0,1101
|
|
2
|
-
sienge_mcp/__init__.py,sha256=Pjl4hgBCWhVJ_BBZXaP7SuZfH7Z1JWZbSs8MV5sUle8,287
|
|
3
|
-
sienge_mcp/metadata.py,sha256=wN_XSjUkHJ0QA38CaCtAR7ImsYndSvBPrTmRe8gSLdM,1109
|
|
4
|
-
sienge_mcp/server.py,sha256=dAFYZ7G1610JhAqBFTZ1ZXaCPl8cfiq66gK09MC50JY,99522
|
|
5
|
-
sienge_mcp/server2.py,sha256=dAFYZ7G1610JhAqBFTZ1ZXaCPl8cfiq66gK09MC50JY,99522
|
|
6
|
-
sienge_mcp/utils/logger.py,sha256=3Ty7SGcpxAC3vruoRJEK78iZb7wxnDv__EESYQrIMB4,5712
|
|
7
|
-
sienge_ecbiesek_mcp-1.2.0.dist-info/METADATA,sha256=giTZJyOFa04_qgy_245TInCOnTSEchdQ5nzXObVwfh8,12672
|
|
8
|
-
sienge_ecbiesek_mcp-1.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
sienge_ecbiesek_mcp-1.2.0.dist-info/entry_points.txt,sha256=jxEu6gvTw3ci0mjDfqbi0rBLRpeuscwwRk9-H-UOnO8,63
|
|
10
|
-
sienge_ecbiesek_mcp-1.2.0.dist-info/top_level.txt,sha256=FCvuhB9JQPKGY0Q8aKoVc7akqG5htoJyfj-eJvVUmWM,11
|
|
11
|
-
sienge_ecbiesek_mcp-1.2.0.dist-info/RECORD,,
|
|
File without changes
|
{sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/entry_points.txt
RENAMED
|
File without changes
|
{sienge_ecbiesek_mcp-1.2.0.dist-info → sienge_ecbiesek_mcp-1.2.2.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
|
File without changes
|