erpnext-agent 2.3.2__tar.gz → 2.3.4__tar.gz

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.
Files changed (65) hide show
  1. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/PKG-INFO +3 -7
  2. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/__init__.py +17 -1
  3. erpnext_agent-2.3.4/erpnext_agent/__main__.py +4 -0
  4. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/api_client.py +4 -1
  5. erpnext_agent-2.3.4/erpnext_agent/connector_sources.py +139 -0
  6. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/kg_ingest.py +2 -1
  7. erpnext_agent-2.3.4/erpnext_agent/mcp_server.py +12 -0
  8. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/certification.json +5 -8
  9. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/erpnext.ttl +14 -14
  10. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/mappings/source.yaml +1 -1
  11. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/prompts/erp_operator.json +0 -2
  12. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent.egg-info/PKG-INFO +3 -7
  13. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent.egg-info/SOURCES.txt +2 -10
  14. erpnext_agent-2.3.4/erpnext_agent.egg-info/entry_points.txt +8 -0
  15. erpnext_agent-2.3.4/erpnext_agent.egg-info/requires.txt +8 -0
  16. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent.egg-info/top_level.txt +0 -1
  17. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/pyproject.toml +13 -18
  18. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/tests/test_kg_ingest.py +1 -1
  19. erpnext_agent-2.3.4/tests/test_mcp_server.py +11 -0
  20. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/tests/test_publication_workflow.py +1 -1
  21. erpnext_agent-2.3.2/erpnext_agent/__main__.py +0 -4
  22. erpnext_agent-2.3.2/erpnext_agent/connectors/__init__.py +0 -0
  23. erpnext_agent-2.3.2/erpnext_agent/connectors/mcp_source_presets.json +0 -48
  24. erpnext_agent-2.3.2/erpnext_agent/connectors/tool_schema_fingerprints.json +0 -8
  25. erpnext_agent-2.3.2/erpnext_agent/mcp_server.py +0 -67
  26. erpnext_agent-2.3.2/erpnext_agent/prompts/__init__.py +0 -0
  27. erpnext_agent-2.3.2/erpnext_agent/skills/__init__.py +0 -0
  28. erpnext_agent-2.3.2/erpnext_agent.egg-info/entry_points.txt +0 -17
  29. erpnext_agent-2.3.2/erpnext_agent.egg-info/requires.txt +0 -14
  30. erpnext_agent-2.3.2/scripts/security_sanitizer.py +0 -318
  31. erpnext_agent-2.3.2/tests/test_default_content_surfaces.py +0 -43
  32. erpnext_agent-2.3.2/tests/test_mcp_server.py +0 -32
  33. erpnext_agent-2.3.2/tests/test_startup.py +0 -9
  34. erpnext_agent-2.3.2/tests/test_version.py +0 -18
  35. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/LICENSE +0 -0
  36. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/README.md +0 -0
  37. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/api/__init__.py +0 -0
  38. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/api/api_client_base.py +0 -0
  39. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/api/api_client_resource.py +0 -0
  40. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/auth.py +0 -0
  41. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/mcp/__init__.py +0 -0
  42. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/mcp/mcp_authentication.py +0 -0
  43. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/mcp/mcp_ingest.py +0 -0
  44. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/mcp/mcp_resource.py +0 -0
  45. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/mcp_config.json +0 -0
  46. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/models.py +0 -0
  47. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/__init__.py +0 -0
  48. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/access_contracts.ttl +0 -0
  49. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/fixtures/records.json +0 -0
  50. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/migrations/manifest.json +0 -0
  51. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/ontology/shapes/connector.shacl.ttl +0 -0
  52. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-accounting/SKILL.md +0 -0
  53. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-accounting/WORKFLOW.md +0 -0
  54. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-agent-operations/SKILL.md +0 -0
  55. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-agent-operations/agents/openai.yaml +0 -0
  56. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-agent-operations/references/catalog.md +0 -0
  57. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-hr/SKILL.md +0 -0
  58. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-hr/WORKFLOW.md +0 -0
  59. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-inventory/SKILL.md +0 -0
  60. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent/skills/erpnext-inventory/WORKFLOW.md +0 -0
  61. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/erpnext_agent.egg-info/dependency_links.txt +0 -0
  62. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/setup.cfg +0 -0
  63. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/tests/conftest.py +0 -0
  64. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/tests/test_api_client.py +0 -0
  65. {erpnext_agent-2.3.2 → erpnext_agent-2.3.4}/tests/test_init_dynamics.py +0 -0
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: erpnext-agent
3
- Version: 2.3.2
3
+ Version: 2.3.4
4
4
  Summary: ERPNext and Frappe REST/RPC MCP Server for Agentic AI!
5
- Author-email: Project Maintainers <maintainers@users.noreply.github.com>
5
+ Author-email: Repository Maintainers <maintainers@knuckles.team>
6
6
  License: MIT
7
7
  Classifier: Development Status :: 4 - Beta
8
8
  Classifier: License :: OSI Approved :: MIT License
@@ -12,12 +12,8 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: <3.15,>=3.12
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.18
15
+ Requires-Dist: agent-connector-sdk[mcp]<0.6.0,>=0.5.4
16
16
  Requires-Dist: requests>=2.34.2
17
- Provides-Extra: mcp
18
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.18; extra == "mcp"
19
- Provides-Extra: all
20
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.18; extra == "all"
21
17
  Provides-Extra: test
22
18
  Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
23
19
  Requires-Dist: pytest>=9.1.1; extra == "test"
@@ -4,7 +4,6 @@ import importlib
4
4
  import inspect
5
5
  from typing import Any
6
6
 
7
- __version__ = "2.3.2"
8
7
  __all__: list[str] = []
9
8
 
10
9
  CORE_MODULES = ["erpnext_agent.api_client"]
@@ -80,3 +79,20 @@ def __getattr__(name: str) -> Any:
80
79
 
81
80
  def __dir__() -> list[str]:
82
81
  return sorted(list(globals().keys()) + __all__)
82
+
83
+
84
+ from agent_connector_sdk.connector import Connector
85
+
86
+ from erpnext_agent.api_client import Api
87
+ from erpnext_agent.auth import get_client
88
+
89
+ connector = Connector(
90
+ api=Api,
91
+ get_client=get_client,
92
+ tools="erpnext_agent.mcp_server",
93
+ instructions="ERPNext Agent MCP Server - Managed dynamic operations.",
94
+ transports=(
95
+ "stdio",
96
+ "streamable-http",
97
+ ),
98
+ )
@@ -0,0 +1,4 @@
1
+ from agent_connector_sdk import run
2
+
3
+ if __name__ == "__main__":
4
+ run()
@@ -1,9 +1,12 @@
1
1
  """CONCEPT:EN-OS.governance.erpn Dynamic client facade orchestration and resource mappings."""
2
2
 
3
3
  #!/usr/bin/env python
4
- from erpnext_agent import __version__ # single source: package __init__
4
+ from importlib.metadata import version as _v
5
+
5
6
  from erpnext_agent.api.api_client_resource import Api as ResourceApi
6
7
 
8
+ __version__ = _v("erpnext-agent")
9
+
7
10
  __all__ = ["Api", "__version__"]
8
11
 
9
12
 
@@ -0,0 +1,139 @@
1
+ """Data sources of this connector, declared by tool name (generated by connector-ontology-map migrate).
2
+
3
+ Served live as ``connector://resources``. Regenerate by editing the declarations, not the tools.
4
+ """
5
+
6
+ # ruff: noqa: E501
7
+ from __future__ import annotations
8
+
9
+ from agent_connector_sdk.ingest.live_declaration import source_meta
10
+
11
+ SOURCES = (
12
+ source_meta(
13
+ tool="erpnext_list_documents",
14
+ source_id="erpnext-sales-orders",
15
+ record_type="erpnext_sales_order",
16
+ id_field="name",
17
+ cursor_field="transaction_date",
18
+ preset={
19
+ "arguments": {
20
+ "doctype": "Sales Order",
21
+ "fields": [
22
+ "name",
23
+ "customer",
24
+ "grand_total",
25
+ "docstatus",
26
+ "transaction_date",
27
+ "status",
28
+ ],
29
+ },
30
+ "doc_type": "erpnext_sales_order",
31
+ "page_param": "limit_start",
32
+ "page_size_param": "limit_page_length",
33
+ "pagination": "offset",
34
+ "params_style": "args",
35
+ },
36
+ records_path="data",
37
+ server="erpnext-mcp",
38
+ text_field="status",
39
+ title_field="name",
40
+ ),
41
+ )
42
+
43
+ SCHEMA_VERSION = 2
44
+
45
+ FIELD_SETS = {
46
+ "fields_1": {
47
+ "docStatus": "xsd:integer",
48
+ "employeeName": "xsd:string",
49
+ "grandTotal": "xsd:float",
50
+ "postingDate": "xsd:date",
51
+ },
52
+ }
53
+
54
+ SCHEMA_MAPPINGS = {
55
+ "Customer": {
56
+ "field_sets": ["fields_1"],
57
+ "ontology_class": None,
58
+ },
59
+ "Employee": {
60
+ "field_sets": ["fields_1"],
61
+ "ontology_class": "Person",
62
+ },
63
+ "ErpNextIssue": {
64
+ "field_sets": ["fields_1"],
65
+ "ontology_class": "Incident",
66
+ },
67
+ "Invoice": {
68
+ "field_sets": ["fields_1"],
69
+ "ontology_class": None,
70
+ },
71
+ "Item": {
72
+ "field_sets": ["fields_1"],
73
+ "ontology_class": None,
74
+ },
75
+ "OrgUnit": {
76
+ "field_sets": ["fields_1"],
77
+ "ontology_class": "Organization",
78
+ },
79
+ "PurchaseOrder": {
80
+ "field_sets": ["fields_1"],
81
+ "ontology_class": None,
82
+ },
83
+ "SalesOrder": {
84
+ "field_sets": ["fields_1"],
85
+ "ontology_class": None,
86
+ },
87
+ "Supplier": {
88
+ "field_sets": ["fields_1"],
89
+ "ontology_class": None,
90
+ },
91
+ }
92
+
93
+ RESOURCES = (
94
+ {
95
+ "id_prefix": "customer",
96
+ "label": "Customer",
97
+ "name": "Customer",
98
+ },
99
+ {
100
+ "id_prefix": "employee",
101
+ "label": "Employee",
102
+ "name": "Employee",
103
+ },
104
+ {
105
+ "id_prefix": "erpnextissue",
106
+ "label": "ERPNext Issue",
107
+ "name": "ErpNextIssue",
108
+ },
109
+ {
110
+ "id_prefix": "invoice",
111
+ "label": "Invoice",
112
+ "name": "Invoice",
113
+ },
114
+ {
115
+ "id_prefix": "item",
116
+ "label": "Item",
117
+ "name": "Item",
118
+ },
119
+ {
120
+ "id_prefix": "orgunit",
121
+ "label": "Organizational Unit",
122
+ "name": "OrgUnit",
123
+ },
124
+ {
125
+ "id_prefix": "purchaseorder",
126
+ "label": "Purchase Order",
127
+ "name": "PurchaseOrder",
128
+ },
129
+ {
130
+ "id_prefix": "salesorder",
131
+ "label": "Sales Order",
132
+ "name": "SalesOrder",
133
+ },
134
+ {
135
+ "id_prefix": "supplier",
136
+ "label": "Supplier",
137
+ "name": "Supplier",
138
+ },
139
+ )
@@ -10,6 +10,7 @@ from __future__ import annotations
10
10
 
11
11
  from typing import Any
12
12
 
13
+ from agent_connector_sdk.connector_identity import connector_name
13
14
  from agent_connector_sdk.ingest import (
14
15
  ChangeSet,
15
16
  Document,
@@ -22,7 +23,7 @@ from agent_connector_sdk.ingest import (
22
23
  current_ingest,
23
24
  )
24
25
 
25
- _SOURCE = "erpnext-agent"
26
+ _SOURCE = connector_name("erpnext_agent")
26
27
  _DOMAIN = "erpnext"
27
28
 
28
29
  _BINDING = IngestBinding(connector=_SOURCE, stream=_DOMAIN)
@@ -0,0 +1,12 @@
1
+ """Main FastMCP server and tool registration."""
2
+
3
+ from erpnext_agent.mcp.mcp_authentication import register_authentication_tools
4
+ from erpnext_agent.mcp.mcp_ingest import register_ingest_tools
5
+ from erpnext_agent.mcp.mcp_resource import register_resource_tools
6
+
7
+ # (tag, env-toggle, registrar) — env names are the framework-derived <TAG>TOOL form.
8
+ TOOL_REGISTRY = [
9
+ ("authentication", "AUTHENTICATIONTOOL", register_authentication_tools),
10
+ ("resource", "RESOURCETOOL", register_resource_tools),
11
+ ("ingest", "INGESTTOOL", register_ingest_tools),
12
+ ]
@@ -1,12 +1,9 @@
1
1
  {
2
- "api_version": "arbora.io/v1",
2
+ "api_version": "graphos.io/v1",
3
3
  "artifacts": {
4
- "connector_manifest.yml": "2bae393c345f60b5ffccbd5233df49394e939cd38e5858b62f645772fcec7c3f",
5
- "erpnext_agent/connectors/mcp_source_presets.json": "55d699734419f1c788be8580d4df2529315c7c9c4681fa98b4751153bb47dbcb",
6
- "erpnext_agent/connectors/tool_schema_fingerprints.json": "167663e3a1444a10b05520ea5ce21597b3a330727bedf72b7d3962a384b2bf45",
7
- "erpnext_agent/ontology/erpnext.ttl": "a0358fb9371646207a3edc1c8b978cffc2684272fc7ca9ca6b1847cb6dd63f94",
4
+ "erpnext_agent/ontology/erpnext.ttl": "bc66355cb22bc28100bd59e1293a00b43fd6d8403211b68df6fe5d7a654fe806",
8
5
  "erpnext_agent/ontology/fixtures/records.json": "83e8cef1e7f213089b1d32bc6f52a88727ab54536d4d0cbe5406f1c4b9a4320e",
9
- "erpnext_agent/ontology/mappings/source.yaml": "7c5a262ea6ce4e26bb98475774d0d35f3755cdd52759e3053ed240b21fe7eac8",
6
+ "erpnext_agent/ontology/mappings/source.yaml": "1b15542375512ac854fa75ae8b5294e3afa8754451a12fc6bd410671e3e35be4",
10
7
  "erpnext_agent/ontology/migrations/manifest.json": "53142e60f360540935470d9d395ac161bd9c1d37aaedb6d16e4fc9b3b094d6fc",
11
8
  "erpnext_agent/ontology/shapes/connector.shacl.ttl": "968822565eda2f64b443aa9f9ac2ffec6eaab02c1bbaaf10a2481dbacf3e0725"
12
9
  },
@@ -18,7 +15,7 @@
18
15
  "synthetic_fixture_contract": "passed"
19
16
  },
20
17
  "compatibility": {
21
- "agent_connector_sdk": ">=2.5.0,<3",
18
+ "agent_utilities": ">=2.5.0,<3",
22
19
  "bundle_schema": "2",
23
20
  "epistemic_graph": ">=2.27.0,<3"
24
21
  },
@@ -32,5 +29,5 @@
32
29
  "signer": "UNSIGNED-PREVIEW",
33
30
  "signing_public_key": "",
34
31
  "status": "source-validated",
35
- "validated_at": "2026-08-26T13:42:55Z"
32
+ "validated_at": "2026-10-24T12:09:45Z"
36
33
  }
@@ -22,9 +22,8 @@
22
22
  rdfs:label "Customer" ;
23
23
  rdfs:comment "A party that places sales orders (Frappe Customer doctype)." .
24
24
 
25
- :Supplier a owl:Class ;
26
- rdfs:label "Supplier" ;
27
- rdfs:comment "A party that goods/services are purchased from (Frappe Supplier doctype)." .
25
+ :Supplier a owl:Class .
26
+
28
27
 
29
28
  :Item a owl:Class ;
30
29
  rdfs:label "Item" ;
@@ -42,20 +41,15 @@
42
41
  rdfs:label "Invoice" ;
43
42
  rdfs:comment "A billing document (Frappe Sales Invoice / Purchase Invoice doctype)." .
44
43
 
45
- :Employee a owl:Class ;
46
- rdfs:label "Employee" ;
47
- rdfs:comment "A person employed by the organization (Frappe Employee doctype)." .
44
+ :Employee a owl:Class .
45
+
48
46
 
49
47
  :OrgUnit a owl:Class ;
50
48
  rdfs:label "Organizational Unit" ;
51
49
  rdfs:comment "A department or organizational unit an employee belongs to (Frappe Department doctype)." .
52
50
 
53
- :ErpNextIssue a owl:Class ;
54
- rdfs:label "ERPNext Issue" ;
55
- rdfs:comment """A Frappe/ERPNext Issue doctype record — the ERPNext analogue
56
- of a ServiceNow incident (helpdesk/support ITSM ticket). Crosswalked to the
57
- canonical :ApplicationEvent in ontology_archimate.ttl, so it is
58
- interchangeable with ServiceNow incidents in cross-vendor queries.""" .
51
+ :ErpNextIssue a owl:Class .
52
+
59
53
 
60
54
  # --- links (owl:ObjectProperty) ---
61
55
 
@@ -120,5 +114,11 @@
120
114
  rdfs:comment """ERP entities sourced from an ERPNext (Frappe) instance — customers,
121
115
  suppliers, items, sales and purchase orders, invoices, employees and org units — with
122
116
  their ordering, supply, line-item and billing relationships, federated into the
123
- agent-connector-sdk knowledge-graph hub over the enterprise layer.""" ;
124
- owl:imports <http://knuckles.team/kg/enterprise> .
117
+ agent-connector-sdk knowledge-graph hub over the enterprise layer.""" .
118
+
119
+ # ontology-codemod R3
120
+ <http://knuckles.team/kg#PurchaseOrder> rdfs:subClassOf <http://knuckles.team/kg#Order> .
121
+ <http://knuckles.team/kg#SalesOrder> rdfs:subClassOf <http://knuckles.team/kg#Order> .
122
+
123
+ # ontology-codemod R4
124
+ <http://knuckles.team/kg#Invoice> rdfs:subClassOf <http://knuckles.team/kg#Document> .
@@ -1,5 +1,5 @@
1
1
  schema_version: '1'
2
- connector: erpnext-agent
2
+ connector: erpnext-mcp
3
3
  ontology_source: erpnext
4
4
  sync:
5
5
  - preset: erpnext-items
@@ -4,8 +4,6 @@
4
4
  "schema_version": "1.0",
5
5
  "prompt_version": "0.1.0",
6
6
  "source": "erpnext-agent",
7
- "extends": "agent-connector-sdk:base",
8
- "compose": "append",
9
7
  "description": "ERPNext ERP operator: order-to-cash, procure-to-pay, inventory and HR over the erpnext-agent (Frappe) MCP server, with native knowledge-graph ingestion.",
10
8
  "metadata": {
11
9
  "topic": "ERPNext ERP operations",
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: erpnext-agent
3
- Version: 2.3.2
3
+ Version: 2.3.4
4
4
  Summary: ERPNext and Frappe REST/RPC MCP Server for Agentic AI!
5
- Author-email: Project Maintainers <maintainers@users.noreply.github.com>
5
+ Author-email: Repository Maintainers <maintainers@knuckles.team>
6
6
  License: MIT
7
7
  Classifier: Development Status :: 4 - Beta
8
8
  Classifier: License :: OSI Approved :: MIT License
@@ -12,12 +12,8 @@ Classifier: Programming Language :: Python :: 3
12
12
  Requires-Python: <3.15,>=3.12
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.18
15
+ Requires-Dist: agent-connector-sdk[mcp]<0.6.0,>=0.5.4
16
16
  Requires-Dist: requests>=2.34.2
17
- Provides-Extra: mcp
18
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.18; extra == "mcp"
19
- Provides-Extra: all
20
- Requires-Dist: agent-connector-sdk[mcp]<1.0.0,>=0.3.18; extra == "all"
21
17
  Provides-Extra: test
22
18
  Requires-Dist: pytest-xdist>=3.8.0; extra == "test"
23
19
  Requires-Dist: pytest>=9.1.1; extra == "test"
@@ -5,6 +5,7 @@ erpnext_agent/__init__.py
5
5
  erpnext_agent/__main__.py
6
6
  erpnext_agent/api_client.py
7
7
  erpnext_agent/auth.py
8
+ erpnext_agent/connector_sources.py
8
9
  erpnext_agent/kg_ingest.py
9
10
  erpnext_agent/mcp_config.json
10
11
  erpnext_agent/mcp_server.py
@@ -18,9 +19,6 @@ erpnext_agent.egg-info/top_level.txt
18
19
  erpnext_agent/api/__init__.py
19
20
  erpnext_agent/api/api_client_base.py
20
21
  erpnext_agent/api/api_client_resource.py
21
- erpnext_agent/connectors/__init__.py
22
- erpnext_agent/connectors/mcp_source_presets.json
23
- erpnext_agent/connectors/tool_schema_fingerprints.json
24
22
  erpnext_agent/mcp/__init__.py
25
23
  erpnext_agent/mcp/mcp_authentication.py
26
24
  erpnext_agent/mcp/mcp_ingest.py
@@ -33,9 +31,7 @@ erpnext_agent/ontology/fixtures/records.json
33
31
  erpnext_agent/ontology/mappings/source.yaml
34
32
  erpnext_agent/ontology/migrations/manifest.json
35
33
  erpnext_agent/ontology/shapes/connector.shacl.ttl
36
- erpnext_agent/prompts/__init__.py
37
34
  erpnext_agent/prompts/erp_operator.json
38
- erpnext_agent/skills/__init__.py
39
35
  erpnext_agent/skills/erpnext-accounting/SKILL.md
40
36
  erpnext_agent/skills/erpnext-accounting/WORKFLOW.md
41
37
  erpnext_agent/skills/erpnext-agent-operations/SKILL.md
@@ -45,13 +41,9 @@ erpnext_agent/skills/erpnext-hr/SKILL.md
45
41
  erpnext_agent/skills/erpnext-hr/WORKFLOW.md
46
42
  erpnext_agent/skills/erpnext-inventory/SKILL.md
47
43
  erpnext_agent/skills/erpnext-inventory/WORKFLOW.md
48
- scripts/security_sanitizer.py
49
44
  tests/conftest.py
50
45
  tests/test_api_client.py
51
- tests/test_default_content_surfaces.py
52
46
  tests/test_init_dynamics.py
53
47
  tests/test_kg_ingest.py
54
48
  tests/test_mcp_server.py
55
- tests/test_publication_workflow.py
56
- tests/test_startup.py
57
- tests/test_version.py
49
+ tests/test_publication_workflow.py
@@ -0,0 +1,8 @@
1
+ [agent_connector_sdk.connector]
2
+ erpnext-mcp = erpnext_agent:connector
3
+
4
+ [agent_connector_sdk.prompt_providers]
5
+ erpnext-agent = erpnext_agent.prompts
6
+
7
+ [console_scripts]
8
+ erpnext-mcp = agent_connector_sdk.cli:serve
@@ -0,0 +1,8 @@
1
+ agent-connector-sdk[mcp]<0.6.0,>=0.5.4
2
+ requests>=2.34.2
3
+
4
+ [test]
5
+ pytest-xdist>=3.8.0
6
+ pytest>=9.1.1
7
+ pytest-asyncio>=1.4.0
8
+ pytest-cov>=7.1.0
@@ -4,6 +4,5 @@ dist-sdist
4
4
  docker
5
5
  docs
6
6
  erpnext_agent
7
- scripts
8
7
  specs
9
8
  tests
@@ -4,29 +4,24 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "erpnext-agent"
7
- version = "2.3.2"
7
+ version = "2.3.4"
8
8
  description = "ERPNext and Frappe REST/RPC MCP Server for Agentic AI!"
9
9
  readme = "README.md"
10
10
  classifiers = [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Environment :: Console", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3",]
11
11
  requires-python = ">=3.12, <3.15"
12
- dependencies = [ "agent-connector-sdk[mcp]>=0.3.18,<1.0.0", "requests>=2.34.2",]
12
+ dependencies = [ "agent-connector-sdk[mcp]>=0.5.4,<0.6.0", "requests>=2.34.2",]
13
13
  [[project.authors]]
14
- name = "Project Maintainers"
15
- email = "maintainers@users.noreply.github.com"
14
+ name = "Repository Maintainers"
15
+ email = "maintainers@knuckles.team"
16
16
 
17
17
  [project.license]
18
18
  text = "MIT"
19
19
 
20
20
  [project.optional-dependencies]
21
- mcp = [ "agent-connector-sdk[mcp]>=0.3.18,<1.0.0",]
22
- all = [ "agent-connector-sdk[mcp]>=0.3.18,<1.0.0",]
23
21
  test = [ "pytest-xdist>=3.8.0", "pytest>=9.1.1", "pytest-asyncio>=1.4.0", "pytest-cov>=7.1.0",]
24
22
 
25
23
  [project.scripts]
26
- erpnext-mcp = "erpnext_agent.mcp_server:mcp_server"
27
-
28
- [project.entry-points."agent_connector_sdk.skill_providers"]
29
- erpnext-agent = "erpnext_agent.skills"
24
+ erpnext-mcp = "agent_connector_sdk.cli:serve"
30
25
 
31
26
  [project.entry-points."agent_connector_sdk.prompt_providers"]
32
27
  erpnext-agent = "erpnext_agent.prompts"
@@ -34,17 +29,10 @@ erpnext-agent = "erpnext_agent.prompts"
34
29
  # CONCEPT:AU-KG.ontology.package-federation-migration — federate this package's OWL/RDF ontology module into the
35
30
  # agent-connector-sdk hub (DocTypes, customers, sales orders). Resolved via
36
31
  # iter_provider_dirs like the skill/prompt providers.
37
- [project.entry-points."agent_connector_sdk.ontology_providers"]
38
- erpnext-agent = "erpnext_agent.ontology"
39
-
40
- # CONCEPT:AU-KG.ingest.mcp-tool-connector — in-repo Tier-1 mcp_tool source preset so the
41
- # package syncs Frappe DocTypes into the KG via source_sync with no agent-connector-sdk code.
42
- [project.entry-points."agent_connector_sdk.source_connector_providers"]
43
- erpnext-agent = "erpnext_agent.connectors"
44
32
 
45
33
  # The one declared connector identity: the fleet name (SDK-CONNECTOR-CONTROL-R071).
46
34
  [project.entry-points."agent_connector_sdk.connector"]
47
- erpnext-mcp = "erpnext_agent"
35
+ erpnext-mcp = "erpnext_agent:connector"
48
36
 
49
37
  [tool.uv.workspace]
50
38
  members = ["."]
@@ -85,3 +73,10 @@ exempt = ["specs/*", "specs/**/*"]
85
73
 
86
74
  [tool.pytest.ini_options]
87
75
  markers = ["concept(id): associates a test with an existing concept identifier"]
76
+
77
+ [tool.pipelines.container]
78
+ limits = {"mcp" = {"memory_limit_env" = "AGENT_CONTAINER_MEMORY_LIMIT", "memory_limit" = "4g", "cpu_limit_env" = "AGENT_CONTAINER_CPU_LIMIT", "cpu_limit" = "2.0"}}
79
+ compose_env = ["ERPNEXT_URL", "ERPNEXT_TOKEN"]
80
+
81
+ [tool.pipelines.codespell]
82
+ exclude = [".specify"]
@@ -71,7 +71,7 @@ async def test_ingest_entities_writes_nodes_and_edges(ingest):
71
71
  acme = next(r for r in request.records if r.record_id == "erpnext:customer:acme")
72
72
  assert acme.payload["name"] == "Acme"
73
73
  assert request.relationships[0].relation_reference.endswith(
74
- "resources/SalesOrder/relations/orderedBy"
74
+ "relations/SalesOrder/orderedBy"
75
75
  )
76
76
 
77
77
 
@@ -0,0 +1,11 @@
1
+ import pytest
2
+
3
+
4
+ @pytest.mark.concept("EN-OS.identity.erpn")
5
+ def test_mcp_server_security_context(monkeypatch):
6
+ """CONCEPT:EN-OS.identity.erpn Verify that the server registers with correct security credentials."""
7
+ from erpnext_agent.auth import get_client
8
+
9
+ monkeypatch.setenv("ERPNEXT_URL", "https://service.invalid")
10
+ client = get_client()
11
+ assert client is not None
@@ -69,7 +69,7 @@ def test_release_hook_inherits_catalogue_policy():
69
69
  assert len(matches) == 1
70
70
  repo, hook = matches[0]
71
71
  assert repo["repo"] == "https://github.com/Knuckles-Team/pipelines"
72
- assert repo["rev"] == CONTRACT
72
+ assert repo["rev"] == "main"
73
73
  assert hook == {"id": "dependency-readiness"}
74
74
 
75
75
 
@@ -1,4 +0,0 @@
1
- from erpnext_agent.mcp_server import mcp_server
2
-
3
- if __name__ == "__main__":
4
- mcp_server()
File without changes
@@ -1,48 +0,0 @@
1
- {
2
- "_comment": "Tier-1 mcp_tool source presets for erpnext-agent (AU-KG.ingest.mcp-tool-connector). Sync Frappe DocTypes into the KG as documents via the erpnext-agent MCP server's condensed resource tool. Each preset pins a doctype through params; records come back under the response 'data' key. For typed-node ingestion prefer the native erpnext_ingest tool / erpnext_agent.kg_ingest. Contributed presets win over the central MCP_TOOL_PRESETS.",
3
- "erpnext-sales-orders": {
4
- "server": "erpnext-mcp",
5
- "tool": "erpnext_list_documents",
6
- "records_path": "data",
7
- "id_field": "name",
8
- "title_field": "name",
9
- "text_field": "status",
10
- "updated_field": "transaction_date",
11
- "pagination": "offset",
12
- "page_param": "limit_start",
13
- "page_size_param": "limit_page_length",
14
- "doc_type": "erpnext_sales_order",
15
- "params_style": "args",
16
- "arguments": {
17
- "doctype": "Sales Order",
18
- "fields": [
19
- "name",
20
- "customer",
21
- "grand_total",
22
- "docstatus",
23
- "transaction_date",
24
- "status"
25
- ]
26
- }
27
- },
28
- "erpnext-items": {
29
- "server": "erpnext-mcp",
30
- "tool": "erpnext_list_documents",
31
- "records_path": "data",
32
- "id_field": "name",
33
- "title_field": "item_name",
34
- "text_field": "description",
35
- "doc_type": "erpnext_item",
36
- "params_style": "args",
37
- "arguments": {
38
- "doctype": "Item",
39
- "fields": [
40
- "name",
41
- "item_code",
42
- "item_name",
43
- "item_group",
44
- "description"
45
- ]
46
- }
47
- }
48
- }
@@ -1,8 +0,0 @@
1
- {
2
- "algorithm": "agent-connector-sdk:mcp-tool-contract-compat:v2",
3
- "connector": "erpnext-mcp",
4
- "schema_version": "1",
5
- "tools": {
6
- "erpnext_list_documents": "f23509b7a5a1fc30a1f5bf2efb71a0b3cec1bbd8a0685061aad0f730634a5494"
7
- }
8
- }
@@ -1,67 +0,0 @@
1
- """Main FastMCP server and tool registration."""
2
-
3
- import sys
4
- from typing import Any
5
-
6
- from agent_connector_sdk.config import load_config
7
- from agent_connector_sdk.mcp.server import create_mcp_server
8
- from agent_connector_sdk.mcp.tool_surface import register_tool_surface
9
- from fastmcp.utilities.logging import get_logger
10
- from starlette.requests import Request
11
- from starlette.responses import JSONResponse
12
-
13
- from erpnext_agent import __version__ # single source: package __init__
14
- from erpnext_agent.api_client import Api
15
- from erpnext_agent.auth import get_client
16
- from erpnext_agent.mcp.mcp_authentication import register_authentication_tools
17
- from erpnext_agent.mcp.mcp_ingest import register_ingest_tools
18
- from erpnext_agent.mcp.mcp_resource import register_resource_tools
19
-
20
- logger = get_logger(name="erpnext_agent")
21
-
22
- # (tag, env-toggle, registrar) — env names are the framework-derived <TAG>TOOL form.
23
- TOOL_REGISTRY = [
24
- ("authentication", "AUTHENTICATIONTOOL", register_authentication_tools),
25
- ("resource", "RESOURCETOOL", register_resource_tools),
26
- ("ingest", "INGESTTOOL", register_ingest_tools),
27
- ]
28
-
29
-
30
- def get_mcp_instance() -> tuple[Any, ...]:
31
- load_config()
32
- args, mcp, middlewares = create_mcp_server(
33
- name="ERPNext Agent MCP",
34
- version=__version__,
35
- instructions="ERPNext Agent MCP Server - Managed dynamic operations.",
36
- )
37
-
38
- @mcp.custom_route("/health", methods=["GET"])
39
- async def health_check(request: Request) -> JSONResponse:
40
- return JSONResponse({"status": "OK"})
41
-
42
- register_tool_surface(
43
- mcp,
44
- client_cls=Api,
45
- get_client=get_client,
46
- service="erpnext-agent",
47
- tool_registry=TOOL_REGISTRY,
48
- )
49
-
50
- for mw in middlewares:
51
- mcp.add_middleware(mw)
52
- return mcp, args, middlewares
53
-
54
-
55
- def mcp_server() -> None:
56
- mcp, args, middlewares = get_mcp_instance()
57
- print(f"ERPNext Agent MCP v{__version__}", file=sys.stderr)
58
- if args.transport == "stdio":
59
- mcp.run(transport="stdio")
60
- elif args.transport == "streamable-http":
61
- mcp.run(transport="streamable-http", host=args.host, port=args.port)
62
- else:
63
- mcp.run(transport="stdio")
64
-
65
-
66
- if __name__ == "__main__":
67
- mcp_server()
File without changes
File without changes
@@ -1,17 +0,0 @@
1
- [agent_connector_sdk.connector]
2
- erpnext-mcp = erpnext_agent
3
-
4
- [agent_connector_sdk.ontology_providers]
5
- erpnext-agent = erpnext_agent.ontology
6
-
7
- [agent_connector_sdk.prompt_providers]
8
- erpnext-agent = erpnext_agent.prompts
9
-
10
- [agent_connector_sdk.skill_providers]
11
- erpnext-agent = erpnext_agent.skills
12
-
13
- [agent_connector_sdk.source_connector_providers]
14
- erpnext-agent = erpnext_agent.connectors
15
-
16
- [console_scripts]
17
- erpnext-mcp = erpnext_agent.mcp_server:mcp_server
@@ -1,14 +0,0 @@
1
- agent-connector-sdk[mcp]<1.0.0,>=0.3.18
2
- requests>=2.34.2
3
-
4
- [all]
5
- agent-connector-sdk[mcp]<1.0.0,>=0.3.18
6
-
7
- [mcp]
8
- agent-connector-sdk[mcp]<1.0.0,>=0.3.18
9
-
10
- [test]
11
- pytest-xdist>=3.8.0
12
- pytest>=9.1.1
13
- pytest-asyncio>=1.4.0
14
- pytest-cov>=7.1.0
@@ -1,318 +0,0 @@
1
- #!/usr/bin/env python3
2
- import os
3
- import re
4
- import subprocess
5
- import sys
6
- from pathlib import Path
7
-
8
- MAX_SCAN_BYTES = 8 * 1024 * 1024
9
-
10
- # Config
11
- # llms.txt is the deliberate root-level AI entry index (llms-txt convention,
12
- # like robots.txt) shipped by the docs/day-0 work — not garbage.
13
- # overrides.txt is the sanctioned uv dependency-override file (UV_OVERRIDE in
14
- # docker/Dockerfile, mirroring [tool.uv] override-dependencies) shipped by the
15
- # pydantic-ai v2 migration — a canonical packaging input, not scratch.
16
- # .security-audit-allow.txt is the OSV dependency-audit risk-acceptance ledger
17
- # (scripts/audit_dependencies.py, wired into the dependency-audit pre-commit hook)
18
- # — a committed, actively-read governance input, not scratch/garbage.
19
- ALLOWED_TXT_NAMES = {
20
- "requirements.txt",
21
- "requirements-dev.txt",
22
- "llms.txt",
23
- "overrides.txt",
24
- ".security-audit-allow.txt",
25
- }
26
- TRANSIENT_PY_PATTERNS = [
27
- re.compile(r"^test_.*\.py$"),
28
- re.compile(r"^fix_.*\.py$"),
29
- re.compile(r"^debug_.*\.py$"),
30
- re.compile(r"^scratch_.*\.py$"),
31
- re.compile(r"^temp_.*\.py$"),
32
- ]
33
-
34
- SECRET_PATTERNS = [
35
- ("GitHub PAT", re.compile(r"ghp_[A-Za-z0-9_]{36,255}")),
36
- ("GitHub Fine-grained PAT", re.compile(r"github_pat_[A-Za-z0-9_]{82,255}")),
37
- ("GitLab PAT", re.compile(r"glpat-[A-Za-z0-9\-]{20,255}")),
38
- ("Private key", re.compile(r"-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----")),
39
- ("AWS access key", re.compile(r"\b(?:AKIA|ASIA)[A-Z0-9]{16}\b")),
40
- ("Slack token", re.compile(r"\bxox[baprs]-[A-Za-z0-9-]{20,}\b")),
41
- ("Langfuse secret", re.compile(r"\bsk-lf-[A-Za-z0-9_-]{16,}\b")),
42
- (
43
- "Generic Secret Assignment",
44
- re.compile(
45
- r"secret[A-Za-z0-9_]*\s*[:=]\s*['\"][A-Za-z0-9_\-\.\~\*]{16,255}['\"]",
46
- re.IGNORECASE,
47
- ),
48
- ),
49
- (
50
- "Generic Token Assignment",
51
- re.compile(
52
- r"token\s*[:=]\s*['\"][A-Za-z0-9_\-\.\~\*]{16,255}['\"]", re.IGNORECASE
53
- ),
54
- ),
55
- ]
56
-
57
- EXCLUDED_DIRS = {
58
- ".git",
59
- ".venv",
60
- "venv",
61
- "node_modules",
62
- "build",
63
- "dist",
64
- "__pycache__",
65
- ".tox",
66
- ".specify",
67
- ".mypy_cache",
68
- ".pytest_cache",
69
- ".ruff_cache",
70
- ".cache",
71
- }
72
- EXCLUDED_EXTENSIONS = {
73
- ".png",
74
- ".jpg",
75
- ".jpeg",
76
- ".gif",
77
- ".webp",
78
- ".ico",
79
- ".pyc",
80
- ".db",
81
- ".kuzu",
82
- ".sqlite",
83
- ".sqlite3",
84
- ".zip",
85
- ".tar.gz",
86
- ".tgz",
87
- ".bz2",
88
- ".xz",
89
- ".pdf",
90
- ".bin",
91
- ".exe",
92
- ".dll",
93
- ".so",
94
- ".dylib",
95
- ".woff",
96
- ".woff2",
97
- ".eot",
98
- ".ttf",
99
- ".mp4",
100
- ".mp3",
101
- ".wav",
102
- ".lock",
103
- ".svg",
104
- }
105
-
106
- # Placeholder / Mock indicators
107
- PLACEHOLDER_VALUES = {
108
- "1234567890",
109
- "abcdef12345",
110
- "abc123youandme",
111
- "askdfalskdvjas",
112
- "test_token",
113
- "test_secret",
114
- "glpat-askdfalskdvjas",
115
- "github_pat_12345",
116
- "glpat-abc123youandme",
117
- "github_pat_...",
118
- "glpat-*************",
119
- "ghp_*************",
120
- "github_pat_*************",
121
- "token_*************",
122
- "secret_*************",
123
- "glpat-abc",
124
- "ghp_abc",
125
- "github_pat_abc",
126
- "${env:",
127
- }
128
- PLACEHOLDER_PREFIXES = ("your_", "your-", "dummy", "example", "mock")
129
-
130
-
131
- def is_placeholder(match_str: str) -> bool:
132
- # Generic assignment patterns include the variable name. Judge only the
133
- # quoted value so names such as ``secret_example`` cannot suppress a real
134
- # credential finding.
135
- assignment = re.search(r"['\"]([^'\"]+)['\"]\s*$", match_str)
136
- candidate = assignment.group(1) if assignment else match_str
137
- candidate_lower = candidate.strip().lower()
138
- if candidate_lower in PLACEHOLDER_VALUES or candidate_lower.startswith(
139
- PLACEHOLDER_PREFIXES
140
- ):
141
- return True
142
-
143
- # Check if match is mostly asterisks or single repeated char
144
- cleaned = candidate.replace("'", "").replace('"', "").strip()
145
- if not cleaned:
146
- return True
147
-
148
- # Check if there are sequences of asterisks indicating masked values
149
- if "*" in cleaned:
150
- # e.g., glpat-*************
151
- return True
152
-
153
- compact = re.sub(r"[^A-Za-z0-9]", "", cleaned).lower()
154
- if len(compact) >= 8 and len(set(compact)) == 1:
155
- return True
156
-
157
- return False
158
-
159
-
160
- def _is_excluded_relative_path(relative: Path) -> bool:
161
- if relative.is_absolute() or ".." in relative.parts:
162
- raise ValueError("unsafe source inventory path")
163
- return any(part in EXCLUDED_DIRS for part in relative.parts)
164
-
165
-
166
- def _git_tracked_files(repo_path: Path):
167
- result = subprocess.run(
168
- ["git", "ls-files", "--cached", "--others", "--exclude-standard"],
169
- cwd=str(repo_path),
170
- capture_output=True,
171
- text=True,
172
- check=True,
173
- timeout=30,
174
- )
175
- files = []
176
- for line in result.stdout.splitlines():
177
- if not line.strip():
178
- continue
179
- relative = Path(line.strip())
180
- # Avoid files inside excluded directories
181
- if not _is_excluded_relative_path(relative):
182
- files.append(repo_path / relative)
183
- return files
184
-
185
-
186
- def _walk_tracked_files(repo_path: Path):
187
- # Fallback to manual recursive scan
188
- files = []
189
- for root, dirs, walk_files in os.walk(str(repo_path)):
190
- # Hidden source/config directories (for example ``.github``) can
191
- # contain credentials and must not disappear merely because Git
192
- # inventory was unavailable. Exclude only known generated trees.
193
- dirs[:] = [d for d in dirs if d not in EXCLUDED_DIRS]
194
- for file in walk_files:
195
- files.append(Path(root) / file)
196
- return files
197
-
198
-
199
- def get_repo_files(repo_path: Path):
200
- try:
201
- return _git_tracked_files(repo_path)
202
- except (OSError, subprocess.SubprocessError, ValueError):
203
- return _walk_tracked_files(repo_path)
204
-
205
-
206
- def _root_naming_violations(file_path: Path):
207
- violations = []
208
- if file_path.suffix == ".txt":
209
- if file_path.name.lower() not in ALLOWED_TXT_NAMES:
210
- violations.append(
211
- "Non-standard root-level text file detected: "
212
- f"'{file_path.name}'. Only {sorted(ALLOWED_TXT_NAMES)} "
213
- "are allowed."
214
- )
215
- elif file_path.suffix == ".py":
216
- for pattern in TRANSIENT_PY_PATTERNS:
217
- if pattern.match(file_path.name):
218
- violations.append(
219
- "Transient/temporary script detected in root: "
220
- f"'{file_path.name}'. Please move it to a subfolder "
221
- "or delete it."
222
- )
223
- break
224
- return violations
225
-
226
-
227
- def _should_secret_scan(file_path: Path) -> bool:
228
- if file_path.suffix.lower() in EXCLUDED_EXTENSIONS:
229
- return False
230
- if file_path.name == "security_sanitizer.py":
231
- return False
232
- return True
233
-
234
-
235
- def _secret_violations_in_line(line: str, rel_path: Path, idx: int):
236
- violations = []
237
- for label, pattern in SECRET_PATTERNS:
238
- for match in pattern.findall(line):
239
- match_str = match[0] if isinstance(match, tuple) else match
240
- if not is_placeholder(match_str):
241
- violations.append(
242
- f"Potential unmasked secret ({label}) detected in "
243
- f"{rel_path}:{idx}"
244
- )
245
- return violations
246
-
247
-
248
- def _secret_scan_violations(file_path: Path, repo_path: Path):
249
- rel_path = file_path.relative_to(repo_path)
250
- if file_path.stat().st_size > MAX_SCAN_BYTES:
251
- return [
252
- f"Source file exceeds security scan boundary: '{rel_path}'",
253
- ]
254
-
255
- # Decode strictly. Silently discarding invalid bytes can splice a
256
- # credential around the discarded byte and make a fail-open scan.
257
- content = file_path.read_text(encoding="utf-8")
258
- violations = []
259
- for idx, line in enumerate(content.splitlines(), 1):
260
- violations.extend(_secret_violations_in_line(line, rel_path, idx))
261
- return violations
262
-
263
-
264
- def _scan_one_file(file_path: Path, repo_path: Path):
265
- violations = []
266
-
267
- # 1. Check root level naming constraints
268
- if file_path.parent == repo_path:
269
- violations.extend(_root_naming_violations(file_path))
270
-
271
- # 2. Check for secrets
272
- if not _should_secret_scan(file_path):
273
- return violations
274
-
275
- try:
276
- violations.extend(_secret_scan_violations(file_path, repo_path))
277
- except (OSError, UnicodeError):
278
- violations.append(
279
- f"Source file could not be inspected: "
280
- f"'{file_path.relative_to(repo_path)}'"
281
- )
282
- return violations
283
-
284
-
285
- def scan_repository(repo_path: Path):
286
- violations = []
287
-
288
- for file_path in get_repo_files(repo_path):
289
- if not file_path.is_file():
290
- continue
291
- if file_path.is_symlink():
292
- # Git tracks the link target text, not the target contents. Never
293
- # follow a repository symlink into machine-local material.
294
- continue
295
- violations.extend(_scan_one_file(file_path, repo_path))
296
-
297
- return violations
298
-
299
-
300
- def main():
301
- repo_path = Path.cwd()
302
-
303
- print("🔒 Running Security and Garbage Sanitizer...")
304
- violations = scan_repository(repo_path)
305
-
306
- if violations:
307
- print("\n❌ SECURITY AND GARBAGE VALIDATION FAILED!")
308
- print("Please correct the following issues before committing:")
309
- for idx, violation in enumerate(violations, 1):
310
- print(f"\n[{idx}] {violation}")
311
- sys.exit(1)
312
-
313
- print("✅ All checks passed! No root garbage or unmasked secrets detected.")
314
- sys.exit(0)
315
-
316
-
317
- if __name__ == "__main__":
318
- main()
@@ -1,43 +0,0 @@
1
- """CONN-ERPNEXT-AGENT-CONNECTOR-CONTENT-R001: the server lists its packaged skills, ontology and prompts by default."""
2
-
3
- from __future__ import annotations
4
-
5
- import asyncio
6
- import importlib
7
- from pathlib import Path
8
-
9
- import pytest
10
- from fastmcp import Client
11
-
12
- PACKAGE = "erpnext_agent"
13
- ROOT = Path(list(importlib.import_module(PACKAGE).__path__)[0])
14
-
15
- pytestmark = pytest.mark.spec("CONN-ERPNEXT-AGENT-CONNECTOR-CONTENT-R001")
16
-
17
-
18
- def _server():
19
- namespace = {"__name__": PACKAGE + ".mcp_server"}
20
- exec(
21
- "from agent_connector_sdk.mcp.server import create_mcp_server\n"
22
- "result = create_mcp_server('erpnext-mcp', version='0', command_args=[])",
23
- namespace,
24
- )
25
- return namespace["result"][1]
26
-
27
-
28
- async def _listings():
29
- async with Client(_server()) as client:
30
- resources = {str(r.uri) for r in await client.list_resources()}
31
- prompts = {p.name for p in await client.list_prompts()}
32
- return resources, prompts
33
-
34
-
35
- def test_default_content_surfaces() -> None:
36
- resources, prompts = asyncio.run(_listings())
37
- if list(ROOT.glob("skills/*/SKILL.md")):
38
- assert any(u.startswith("skill://") for u in resources)
39
- if list(ROOT.glob("ontology/*.ttl")):
40
- assert any(u.startswith("ontology://erpnext-mcp/") for u in resources)
41
- for path in ROOT.glob("prompts/*.json"):
42
- if not path.name.startswith("_"):
43
- assert path.stem in prompts
@@ -1,32 +0,0 @@
1
- import pytest
2
-
3
- from erpnext_agent.mcp_server import get_mcp_instance
4
-
5
-
6
- @pytest.mark.concept("EN-OS.governance.erpn-2")
7
- @pytest.mark.asyncio
8
- async def test_mcp_server_registration():
9
- """CONCEPT:EN-OS.governance.erpn-2 Test that one tool per operation registers."""
10
- res = get_mcp_instance()
11
- mcp = res[0] if isinstance(res, tuple) else res
12
- assert mcp is not None
13
-
14
- assert len(mcp._local_provider._components) > 0
15
-
16
- tools = {t.name: t for t in await mcp.list_tools()}
17
- for name in ("erpnext_login", "erpnext_list_documents", "erpnext_create_document"):
18
- assert name in tools
19
- assert "action" not in tools[name].parameters.get("properties", {})
20
- assert "erpnext_agent_authentication" not in tools
21
- assert tools["erpnext_list_documents"].annotations.readOnlyHint is True
22
- assert tools["erpnext_delete_document"].annotations.destructiveHint is True
23
-
24
-
25
- @pytest.mark.concept("EN-OS.identity.erpn")
26
- def test_mcp_server_security_context(monkeypatch):
27
- """CONCEPT:EN-OS.identity.erpn Verify that the server registers with correct security credentials."""
28
- from erpnext_agent.auth import get_client
29
-
30
- monkeypatch.setenv("ERPNEXT_URL", "https://service.invalid")
31
- client = get_client()
32
- assert client is not None
@@ -1,9 +0,0 @@
1
- import pytest
2
-
3
-
4
- @pytest.mark.concept("ERPN-002")
5
- def test_startup():
6
- # Basic import test
7
- import erpnext_agent
8
-
9
- assert erpnext_agent.__version__ # value is checked in test_version.py
@@ -1,18 +0,0 @@
1
- import importlib
2
- import tomllib
3
- from pathlib import Path
4
-
5
- import erpnext_agent
6
-
7
-
8
- def test_reported_version_matches_the_released_package():
9
- pyproject = tomllib.loads(
10
- (Path(__file__).parents[1] / "pyproject.toml").read_text()
11
- )
12
- assert erpnext_agent.__version__ == pyproject["project"]["version"]
13
-
14
-
15
- def test_every_module_reports_the_same_version():
16
- for name in ("api_client", "mcp_server"):
17
- module = importlib.import_module(f"erpnext_agent.{name}")
18
- assert module.__version__ == erpnext_agent.__version__, name
File without changes
File without changes
File without changes