k3cloud-query-mcp 1.0.0__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.
@@ -0,0 +1,16 @@
1
+ # 金蝶云星空 API 配置
2
+ KD_ACCT_ID=your_acct_id
3
+ KD_USERNAME=your_username
4
+ KD_APP_ID=your_app_id
5
+ KD_APP_SEC=your_app_secret
6
+ KD_SERVER_URL=https://your-server/k3cloud/
7
+ KD_LCID=2052
8
+ KD_ORG_NUM=
9
+
10
+ # SSE 传输模式(仅 --transport sse 时生效)
11
+ # FASTMCP_HOST=127.0.0.1 # 绑定地址(0.0.0.0 可远程访问)
12
+ # FASTMCP_PORT=8000 # 端口
13
+
14
+ # Bearer Token 鉴权(仅 SSE/streamable-http 模式生效)
15
+ # MCP_API_KEY=your-secret-api-key # 不设置则不启用鉴权
16
+ # MCP_ISSUER_URL=http://127.0.0.1:8000 # 与客户端连接地址一致(默认 http://localhost:8000)
@@ -0,0 +1,57 @@
1
+ # ============================================================
2
+ # 凭证与敏感配置(绝对不能提交)
3
+ # ============================================================
4
+ .env
5
+ .env.*
6
+ !.env.example
7
+ *.env
8
+ secrets/
9
+ credentials/
10
+
11
+ # ============================================================
12
+ # Python
13
+ # ============================================================
14
+ __pycache__/
15
+ *.py[cod]
16
+ *$py.class
17
+ *.so
18
+ *.egg
19
+ *.egg-info/
20
+ dist/
21
+ build/
22
+ .eggs/
23
+
24
+ # 虚拟环境
25
+ .venv/
26
+ venv/
27
+ env/
28
+ ENV/
29
+
30
+ # 测试与覆盖率
31
+ .pytest_cache/
32
+ .coverage
33
+ htmlcov/
34
+
35
+ # uv
36
+ .python-version
37
+
38
+ # ============================================================
39
+ # 编辑器与 IDE
40
+ # ============================================================
41
+ .vscode/
42
+ .idea/
43
+ *.swp
44
+ *.swo
45
+ *~
46
+
47
+ # ============================================================
48
+ # macOS
49
+ # ============================================================
50
+ .DS_Store
51
+ .AppleDouble
52
+ ._*
53
+
54
+ # ============================================================
55
+ # Claude Code 本地配置
56
+ # ============================================================
57
+ .claude/
@@ -0,0 +1,183 @@
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.
54
+
55
+ "Contributor" shall mean Licensor and any individual or Legal Entity
56
+ on behalf of whom a Contribution has been received by Licensor and
57
+ subsequently incorporated within the Work.
58
+
59
+ 2. Grant of Copyright License. Subject to the terms and conditions of
60
+ this License, each Contributor hereby grants to You a perpetual,
61
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
62
+ copyright license to reproduce, prepare Derivative Works of,
63
+ publicly display, publicly perform, sublicense, and distribute the
64
+ Work and such Derivative Works in Source or Object form.
65
+
66
+ 3. Grant of Patent 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
+ (except as stated in this section) patent license to make, have made,
70
+ use, offer to sell, sell, import, and otherwise transfer the Work,
71
+ where such license applies only to those patent claims licensable
72
+ by such Contributor that are necessarily infringed by their
73
+ Contribution(s) alone or by combination of their Contribution(s)
74
+ with the Work to which such Contribution(s) was submitted. If You
75
+ institute patent litigation against any entity (including a
76
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
77
+ or a Contribution incorporated within the Work constitutes direct
78
+ or contributory patent infringement, then any patent licenses
79
+ granted to You under this License for that Work shall terminate
80
+ as of the date such litigation is filed.
81
+
82
+ 4. Redistribution. You may reproduce and distribute copies of the
83
+ Work or Derivative Works thereof in any medium, with or without
84
+ modifications, and in Source or Object form, provided that You
85
+ meet the following conditions:
86
+
87
+ (a) You must give any other recipients of the Work or
88
+ Derivative Works a copy of this License; and
89
+
90
+ (b) You must cause any modified files to carry prominent notices
91
+ stating that You changed the files; and
92
+
93
+ (c) You must retain, in the Source form of any Derivative Works
94
+ that You distribute, all copyright, patent, trademark, and
95
+ attribution notices from the Source form of the Work,
96
+ excluding those notices that do not pertain to any part of
97
+ the Derivative Works; and
98
+
99
+ (d) If the Work includes a "NOTICE" text file as part of its
100
+ distribution, then any Derivative Works that You distribute must
101
+ include a readable copy of the attribution notices contained
102
+ within such NOTICE file, excluding those notices that do not
103
+ pertain to any part of the Derivative Works, in at least one
104
+ of the following places: within a NOTICE text file distributed
105
+ as part of the Derivative Works; within the Source form or
106
+ documentation, if provided along with the Derivative Works; or,
107
+ within a display generated by the Derivative Works, if and
108
+ wherever such third-party notices normally appear. The contents
109
+ of the NOTICE file are for informational purposes only and
110
+ do not modify the License. You may add Your own attribution
111
+ notices within Derivative Works that You distribute, alongside
112
+ or as an addendum to the NOTICE text from the Work, provided
113
+ that such additional attribution notices cannot be construed
114
+ as modifying the License.
115
+
116
+ You may add Your own copyright statement to Your modifications and
117
+ may provide additional or different license terms and conditions
118
+ for use, reproduction, or distribution of Your modifications, or
119
+ for any such Derivative Works as a whole, provided Your use,
120
+ reproduction, and distribution of the Work otherwise complies with
121
+ the conditions stated in this License.
122
+
123
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
124
+ any Contribution intentionally submitted for inclusion in the Work
125
+ by You to the Licensor shall be under the terms and conditions of
126
+ this License, without any additional terms or conditions.
127
+ Notwithstanding the above, nothing herein shall supersede or modify
128
+ the terms of any separate license agreement you may have executed
129
+ with Licensor regarding such Contributions.
130
+
131
+ 6. Trademarks. This License does not grant permission to use the trade
132
+ names, trademarks, service marks, or product names of the Licensor,
133
+ except as required for reasonable and customary use in describing the
134
+ origin of the Work and reproducing the content of the NOTICE file.
135
+
136
+ 7. Disclaimer of Warranty. Unless required by applicable law or
137
+ agreed to in writing, Licensor provides the Work (and each
138
+ Contributor provides its Contributions) on an "AS IS" BASIS,
139
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
140
+ implied, including, without limitation, any warranties or conditions
141
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
142
+ PARTICULAR PURPOSE. You are solely responsible for determining the
143
+ appropriateness of using or redistributing the Work and assume any
144
+ risks associated with Your exercise of permissions under this License.
145
+
146
+ 8. Limitation of Liability. In no event and under no legal theory,
147
+ whether in tort (including negligence), contract, or otherwise,
148
+ unless required by applicable law (such as deliberate and grossly
149
+ negligent acts) or agreed to in writing, shall any Contributor be
150
+ liable to You for damages, including any direct, indirect, special,
151
+ incidental, or consequential damages of any character arising as a
152
+ result of this License or out of the use or inability to use the
153
+ Work (including but not limited to damages for loss of goodwill,
154
+ work stoppage, computer failure or malfunction, or any and all
155
+ other commercial damages or losses), even if such Contributor
156
+ has been advised of the possibility of such damages.
157
+
158
+ 9. Accepting Warranty or Additional Liability. While redistributing
159
+ the Work or Derivative Works thereof, You may choose to offer,
160
+ and charge a fee for, acceptance of support, warranty, indemnity,
161
+ or other liability obligations and/or rights consistent with this
162
+ License. However, in accepting such obligations, You may act only
163
+ on Your own behalf and on Your sole responsibility, not on behalf
164
+ of any other Contributor, and only if You agree to indemnify,
165
+ defend, and hold each Contributor harmless for any liability
166
+ incurred by, or claims asserted against, such Contributor by reason
167
+ of your accepting any such warranty or additional liability.
168
+
169
+ END OF TERMS AND CONDITIONS
170
+
171
+ Copyright 2026 Nxr Team
172
+
173
+ Licensed under the Apache License, Version 2.0 (the "License");
174
+ you may not use this file except in compliance with the License.
175
+ You may obtain a copy of the License at
176
+
177
+ http://www.apache.org/licenses/LICENSE-2.0
178
+
179
+ Unless required by applicable law or agreed to in writing, software
180
+ distributed under the License is distributed on an "AS IS" BASIS,
181
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
182
+ See the License for the specific language governing permissions and
183
+ limitations under the License.
@@ -0,0 +1,19 @@
1
+ .PHONY: test lint format build dev
2
+
3
+ test:
4
+ uv run pytest --cov=src --cov-report=term-missing
5
+
6
+ lint:
7
+ uv run ruff check src/ tests/
8
+ uv run mypy src/
9
+
10
+ format:
11
+ uv run ruff format src/ tests/
12
+ uv run ruff check src/ tests/ --fix
13
+
14
+ build:
15
+ uv build
16
+ uv run --with twine twine check dist/*
17
+
18
+ dev:
19
+ uv run python -m k3cloud_query_mcp
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: k3cloud-query-mcp
3
+ Version: 1.0.0
4
+ Summary: Nxr K3Cloud Query MCP Server — 金蝶云星空纯查询 MCP 服务,仅提供只读查询工具
5
+ Project-URL: Homepage, https://github.com/nxr/k3cloud-query-mcp
6
+ Project-URL: Repository, https://github.com/nxr/k3cloud-query-mcp
7
+ Author: Nxr Team
8
+ License: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: erp,k3cloud,kingdee,mcp,mcp-server,nxr,query,金蝶
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Office/Business
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.10
23
+ Requires-Dist: kingdee-cdp-webapi-sdk<9.0.0,>=8.2.0
24
+ Requires-Dist: mcp<2,>=1.26.0
25
+ Requires-Dist: python-dotenv<2,>=1.2.1
26
+ Description-Content-Type: text/markdown
27
+
28
+ # k3cloud-query-mcp
29
+
30
+ 金蝶云星空 K3Cloud MCP 查询服务(纯查询版)—— 让 AI 助手通过自然语言查询金蝶 ERP 数据。
31
+
32
+ ## 特性
33
+
34
+ | 特性 | k3cloud-query-mcp |
35
+ |------|----------------------|
36
+ | 查询工具 | ✅ 8 个 |
37
+ | 写入/操作工具 | ❌ 已移除 |
38
+ | 适用场景 | 纯查询 |
39
+
40
+ ## 查询工具列表
41
+
42
+ | 工具 | 说明 |
43
+ |------|------|
44
+ | `query_bill` | 查询单据数据(二维数组) |
45
+ | `query_bill_json` | 查询单据数据(JSON 对象数组) |
46
+ | `count_bill` | 估算查询条件下的数据行数 |
47
+ | `query_bill_all` | 自动翻页查询(≤ 数千行) |
48
+ | `query_bill_to_file` | 大数据量流式导出到文件 |
49
+ | `query_bill_range` | 按日期分片查询(跨月/跨年) |
50
+ | `view_bill` | 查看单条记录完整详情 |
51
+ | `query_metadata` | 查询表单字段元数据 |
52
+
53
+ ## 安装
54
+
55
+ ```bash
56
+ pip install k3cloud-query-mcp
57
+ ```
58
+
59
+ 或使用 uv:
60
+
61
+ ```bash
62
+ uv add k3cloud-query-mcp
63
+ ```
64
+
65
+ ## 配置
66
+
67
+ 在项目根目录创建 `.env` 文件:
68
+
69
+ ```env
70
+ KD_ACCT_ID=your_acct_id
71
+ KD_USERNAME=your_username
72
+ KD_APP_ID=your_app_id
73
+ KD_APP_SEC=your_app_secret
74
+ KD_SERVER_URL=https://your-server/k3cloud/
75
+ KD_LCID=2052
76
+ ```
77
+
78
+ ## 使用
79
+
80
+ ### Claude Desktop 配置
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "k3cloud-query": {
86
+ "command": "uvx",
87
+ "args": ["k3cloud-query-mcp"],
88
+ "env": {
89
+ "KD_ACCT_ID": "your_acct_id",
90
+ "KD_USERNAME": "your_username",
91
+ "KD_APP_ID": "your_app_id",
92
+ "KD_APP_SEC": "your_app_secret",
93
+ "KD_SERVER_URL": "https://your-server/k3cloud/"
94
+ }
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### SSE 模式
101
+
102
+ ```bash
103
+ k3cloud-query-mcp --transport sse
104
+ ```
105
+
106
+ ### 开发
107
+
108
+ ```bash
109
+ # 安装依赖
110
+ uv sync
111
+
112
+ # 运行
113
+ uv run k3cloud-query-mcp
114
+
115
+ # 测试
116
+ make test
117
+
118
+ # 代码检查
119
+ make lint
120
+
121
+ # 格式化
122
+ make format
123
+ ```
@@ -0,0 +1,96 @@
1
+ # k3cloud-query-mcp
2
+
3
+ 金蝶云星空 K3Cloud MCP 查询服务(纯查询版)—— 让 AI 助手通过自然语言查询金蝶 ERP 数据。
4
+
5
+ ## 特性
6
+
7
+ | 特性 | k3cloud-query-mcp |
8
+ |------|----------------------|
9
+ | 查询工具 | ✅ 8 个 |
10
+ | 写入/操作工具 | ❌ 已移除 |
11
+ | 适用场景 | 纯查询 |
12
+
13
+ ## 查询工具列表
14
+
15
+ | 工具 | 说明 |
16
+ |------|------|
17
+ | `query_bill` | 查询单据数据(二维数组) |
18
+ | `query_bill_json` | 查询单据数据(JSON 对象数组) |
19
+ | `count_bill` | 估算查询条件下的数据行数 |
20
+ | `query_bill_all` | 自动翻页查询(≤ 数千行) |
21
+ | `query_bill_to_file` | 大数据量流式导出到文件 |
22
+ | `query_bill_range` | 按日期分片查询(跨月/跨年) |
23
+ | `view_bill` | 查看单条记录完整详情 |
24
+ | `query_metadata` | 查询表单字段元数据 |
25
+
26
+ ## 安装
27
+
28
+ ```bash
29
+ pip install k3cloud-query-mcp
30
+ ```
31
+
32
+ 或使用 uv:
33
+
34
+ ```bash
35
+ uv add k3cloud-query-mcp
36
+ ```
37
+
38
+ ## 配置
39
+
40
+ 在项目根目录创建 `.env` 文件:
41
+
42
+ ```env
43
+ KD_ACCT_ID=your_acct_id
44
+ KD_USERNAME=your_username
45
+ KD_APP_ID=your_app_id
46
+ KD_APP_SEC=your_app_secret
47
+ KD_SERVER_URL=https://your-server/k3cloud/
48
+ KD_LCID=2052
49
+ ```
50
+
51
+ ## 使用
52
+
53
+ ### Claude Desktop 配置
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "k3cloud-query": {
59
+ "command": "uvx",
60
+ "args": ["k3cloud-query-mcp"],
61
+ "env": {
62
+ "KD_ACCT_ID": "your_acct_id",
63
+ "KD_USERNAME": "your_username",
64
+ "KD_APP_ID": "your_app_id",
65
+ "KD_APP_SEC": "your_app_secret",
66
+ "KD_SERVER_URL": "https://your-server/k3cloud/"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### SSE 模式
74
+
75
+ ```bash
76
+ k3cloud-query-mcp --transport sse
77
+ ```
78
+
79
+ ### 开发
80
+
81
+ ```bash
82
+ # 安装依赖
83
+ uv sync
84
+
85
+ # 运行
86
+ uv run k3cloud-query-mcp
87
+
88
+ # 测试
89
+ make test
90
+
91
+ # 代码检查
92
+ make lint
93
+
94
+ # 格式化
95
+ make format
96
+ ```
@@ -0,0 +1,79 @@
1
+ [project]
2
+ name = "k3cloud-query-mcp"
3
+ version = "1.0.0"
4
+ description = "Nxr K3Cloud Query MCP Server — 金蝶云星空纯查询 MCP 服务,仅提供只读查询工具"
5
+ readme = "README.md"
6
+ license = { text = "Apache-2.0" }
7
+ requires-python = ">=3.10"
8
+ authors = [{ name = "Nxr Team" }]
9
+ keywords = ["mcp", "mcp-server", "kingdee", "金蝶", "k3cloud", "erp", "query", "nxr"]
10
+ classifiers = [
11
+ "Development Status :: 4 - Beta",
12
+ "Intended Audience :: Developers",
13
+ "License :: OSI Approved :: Apache Software License",
14
+ "Operating System :: OS Independent",
15
+ "Programming Language :: Python :: 3",
16
+ "Programming Language :: Python :: 3.10",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Topic :: Office/Business",
21
+ "Topic :: Software Development :: Libraries :: Python Modules",
22
+ ]
23
+ dependencies = [
24
+ "kingdee-cdp-webapi-sdk>=8.2.0,<9.0.0",
25
+ "mcp>=1.26.0,<2",
26
+ "python-dotenv>=1.2.1,<2",
27
+ ]
28
+
29
+ [project.scripts]
30
+ k3cloud-query-mcp = "k3cloud_query_mcp.server:main"
31
+
32
+ [project.urls]
33
+ Homepage = "https://github.com/nxr/k3cloud-query-mcp"
34
+ Repository = "https://github.com/nxr/k3cloud-query-mcp"
35
+
36
+ [build-system]
37
+ requires = ["hatchling"]
38
+ build-backend = "hatchling.build"
39
+
40
+ [tool.hatch.build.targets.wheel]
41
+ packages = ["src/k3cloud_query_mcp"]
42
+ artifacts = ["src/k3cloud_query_mcp/py.typed"]
43
+
44
+ [dependency-groups]
45
+ dev = [
46
+ "mcp[cli]>=1.26.0,<2",
47
+ "pytest>=9.0.2",
48
+ "pytest-cov>=5.0",
49
+ "pytest-mock>=3.14",
50
+ "ruff>=0.9",
51
+ "mypy>=1.13",
52
+ ]
53
+
54
+ [tool.pytest.ini_options]
55
+ pythonpath = ["src"]
56
+ testpaths = ["tests"]
57
+
58
+ [tool.ruff]
59
+ line-length = 100
60
+ target-version = "py310"
61
+
62
+ [tool.ruff.lint]
63
+ select = ["E", "F", "W", "I", "B", "UP", "SIM"]
64
+ ignore = ["E501"]
65
+
66
+ [tool.mypy]
67
+ python_version = "3.10"
68
+ strict_optional = true
69
+ warn_unused_ignores = true
70
+ ignore_missing_imports = true
71
+
72
+ [tool.coverage.run]
73
+ source = ["src"]
74
+ branch = true
75
+
76
+ [tool.coverage.report]
77
+ fail_under = 80
78
+ show_missing = true
79
+ skip_covered = false
@@ -0,0 +1,3 @@
1
+ """k3cloud-query-mcp — 金蝶云星空 K3Cloud MCP 查询服务(纯查询版)"""
2
+
3
+ __version__ = "1.0.0"
File without changes