opc-finance-mcp 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/package.json +41 -41
  3. package/src/index.js +32 -0
package/README.md CHANGED
@@ -74,6 +74,7 @@ npm run inspect
74
74
  | `finance_query_tax` | 申报期参数与销售额 | 只读 |
75
75
  | `finance_get_tax_form` | **申报底稿**:按栏次/行次铺开,每格带来源科目与勾稽(只算不提交) | 只读 |
76
76
  | `finance_save_tax_params` | 保存平台报送额、已开票额等人工参数 | 可写 |
77
+ | `finance_create_tax_period` | 补建季度申报期(最早记账季度 → 当季) | 可写 |
77
78
  | `finance_list_attachments` | 票据资料 | 只读 |
78
79
  | `finance_set_attachment_kind` | 给票据打业务标签(进项/销项/流水…) | 传票 |
79
80
  | `finance_list_employees` | 员工档案(社保基数、公积金比例、专项附加扣除) | 只读 |
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "opc-finance-mcp",
3
- "version": "0.4.0",
4
- "description": "OPC智能财务 MCP Server —— 让 AI 客户端直接查账、记账、传票",
5
- "license": "UNLICENSED",
6
- "private": false,
7
- "bin": {
8
- "opc-finance-mcp": "src/index.js"
9
- },
10
- "main": "src/index.js",
11
- "homepage": "https://finance.cozvint.com/ai.html",
12
- "repository": {
13
- "type": "git",
14
- "url": "git+https://github.com/jeekwu/cozvintfinace.git"
15
- },
16
- "keywords": [
17
- "mcp",
18
- "finance",
19
- "accounting",
20
- "记账",
21
- "财务"
22
- ],
23
- "publishConfig": {
24
- "access": "public"
25
- },
26
- "files": [
27
- "src",
28
- "README.md"
29
- ],
30
- "engines": {
31
- "node": ">=18"
32
- },
33
- "scripts": {
34
- "start": "node src/index.js",
35
- "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
36
- },
37
- "dependencies": {
38
- "@modelcontextprotocol/sdk": "^1.32.2",
39
- "zod": "^3.25.76"
40
- }
41
- }
1
+ {
2
+ "name": "opc-finance-mcp",
3
+ "version": "0.5.0",
4
+ "description": "OPC智能财务 MCP Server —— 让 AI 客户端直接查账、记账、传票",
5
+ "license": "UNLICENSED",
6
+ "private": false,
7
+ "bin": {
8
+ "opc-finance-mcp": "src/index.js"
9
+ },
10
+ "main": "src/index.js",
11
+ "homepage": "https://finance.cozvint.com/ai.html",
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "git+https://github.com/jeekwu/cozvintfinace.git"
15
+ },
16
+ "keywords": [
17
+ "mcp",
18
+ "finance",
19
+ "accounting",
20
+ "记账",
21
+ "财务"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "files": [
27
+ "src",
28
+ "README.md"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
32
+ },
33
+ "scripts": {
34
+ "start": "node src/index.js",
35
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js"
36
+ },
37
+ "dependencies": {
38
+ "@modelcontextprotocol/sdk": "^1.32.2",
39
+ "zod": "^3.25.76"
40
+ }
41
+ }
package/src/index.js CHANGED
@@ -665,6 +665,38 @@ tool('finance_query_tax', {
665
665
  ].join('\n'));
666
666
  });
667
667
 
668
+ tool('finance_create_tax_period', {
669
+ title: '新建申报期',
670
+ description: '补建一个季度申报期。申报期不会自己滚动生成 —— 库里只有建账套时那两期,'
671
+ + '加上页面自动推导的「当季 / 上一季」草稿。要报更早的季度(比如去年 Q4 一直没建过),'
672
+ + '先用它把期间建出来,之后才能 finance_save_tax_params 录参数、finance_get_tax_form 出底稿。'
673
+ + '可选范围是最早记账季度(启用期间与首张凭证取早)到当季,超出后端会拒。',
674
+ inputSchema: {
675
+ period: z.string().optional().describe('季度,如 2026-Q2;不传按北京时区取当季'),
676
+ },
677
+ }, async ({ period }) => {
678
+ const ym = new Date().toLocaleString('sv-SE', { timeZone: 'Asia/Shanghai' }).slice(0, 7);
679
+ const curQ = `${ym.slice(0, 4)}-Q${Math.ceil(Number(ym.slice(5, 7)) / 3)}`;
680
+ const p = String(period || curQ).trim().toUpperCase();
681
+ const d = await request('/api/tax/periods', { method: 'POST', body: { period: p } });
682
+
683
+ /* 建完顺手再取一次期间:用户真正想知道的是「这一期从哪天到哪天、现在什么状态」,
684
+ * 只回一个 ok 等于让他再问一遍。 */
685
+ const t = await request('/api/tax' + qs({ period: d.period }));
686
+ const m = t.meta || {}, v = t.vat || {};
687
+ const pct = (x) => `${(Number(x || 0) * 100).toFixed(0)}%`;
688
+ return ok([
689
+ d.existed ? `ℹ️ ${d.period} 早就建过了,没有重复创建。` : `✅ 已新建申报期 ${d.period}。`,
690
+ '',
691
+ `- 期间:${m.periodStart} ~ ${m.periodEnd}`,
692
+ `- 状态:${m.status === 'filed' ? '已申报' : '待申报'}`,
693
+ `- 征收率:法定 ${pct(v.legalRate)} / 实际 ${pct(v.actualRate)};季度免税额度 ${money(v.threshold)}`,
694
+ `- 账套最早可建到:${m.earliestPeriod || '未知'}(再早就没有账了)`,
695
+ '',
696
+ '下一步:finance_save_tax_params 录入平台报送额、已开票额;finance_get_tax_form 出按栏次的填报底稿。',
697
+ ].join('\n'));
698
+ });
699
+
668
700
  /* ================================================================
669
701
  * 工资与个税
670
702
  * ================================================================ */