mcp-user-system 1.0.5 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
1
  # mcp-user-system
2
2
 
3
- [MCP](https://modelcontextprotocol.io) server for token-user-system — OpenAPI operations via Model Context Protocol.
3
+ [MCP](https://modelcontextprotocol.io) server for token-user-system — Console 前台全量查询接口 via Model Context Protocol.
4
4
 
5
- Supports: wallet overview, dashboard stats, orders, users, model stats, trend.
5
+ Provides AI agents with authenticated access to the Console (前台) query APIs, covering user info, dashboard statistics, wallet, team management, token usage, invoices, and miscellaneous lookups.
6
+
7
+ Supports: user profiles, dashboard stats & trends, wallet overview, team & member management, token consumption, invoice queries, and more.
6
8
 
7
9
  ## Prerequisites
8
10
 
9
11
  - Node.js >= 18
10
- - `TUS_BASE_URL` and `TUS_API_KEY` environment variables
12
+ - `TUS_BASE_URL` and `TUS_ACCESS_TOKEN` environment variables
11
13
 
12
14
  ## Installation
13
15
 
@@ -30,16 +32,18 @@ npm run build
30
32
 
31
33
  ```bash
32
34
  export TUS_BASE_URL=https://api.example.com
33
- export TUS_API_KEY=your-openapi-key
35
+ export TUS_ACCESS_TOKEN=your-jwt-access-token
34
36
  ```
35
37
 
36
38
  Or create a `.env` file (add to `.gitignore`):
37
39
 
38
40
  ```bash
39
41
  TUS_BASE_URL=https://api.example.com
40
- TUS_API_KEY=your-openapi-key
42
+ TUS_ACCESS_TOKEN=your-jwt-access-token
41
43
  ```
42
44
 
45
+ > **Access Token** is a JWT Bearer Token obtained after user login. Include it as `Authorization: Bearer <token>` in upstream requests.
46
+
43
47
  ### 3. Test Run
44
48
 
45
49
  ```bash
@@ -60,7 +64,7 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
60
64
  "args": ["/path/to/mcp-user-system/dist/index.js"],
61
65
  "env": {
62
66
  "TUS_BASE_URL": "https://api.example.com",
63
- "TUS_API_KEY": "your-openapi-key"
67
+ "TUS_ACCESS_TOKEN": "your-jwt-access-token"
64
68
  }
65
69
  }
66
70
  }
@@ -79,7 +83,7 @@ Add to settings (Cursor: `~/.cursor/mcp.json`, VS Code: settings.json):
79
83
  "args": ["/path/to/mcp-user-system/dist/index.js"],
80
84
  "env": {
81
85
  "TUS_BASE_URL": "https://api.example.com",
82
- "TUS_API_KEY": "your-openapi-key"
86
+ "TUS_ACCESS_TOKEN": "your-jwt-access-token"
83
87
  }
84
88
  }
85
89
  }
@@ -98,7 +102,7 @@ Add to `~/.claude/mcp.json`:
98
102
  "args": ["/path/to/mcp-user-system/dist/index.js"],
99
103
  "env": {
100
104
  "TUS_BASE_URL": "https://api.example.com",
101
- "TUS_API_KEY": "your-openapi-key"
105
+ "TUS_ACCESS_TOKEN": "your-jwt-access-token"
102
106
  }
103
107
  }
104
108
  }
@@ -107,14 +111,161 @@ Add to `~/.claude/mcp.json`:
107
111
 
108
112
  ## Available Tools
109
113
 
110
- | Tool | Description |
111
- |------|-------------|
112
- | `wallet_overview` | Get account wallet overview (balance, usable balance, voucher, credit limit, pending amount) |
113
- | `dashboard_stats` | Get dashboard statistics (used quota, consumption, request count, active users, etc.) |
114
- | `dashboard_orders` | List API call detail records with optional filters |
115
- | `dashboard_users` | Get user dropdown options for dashboard filtering |
116
- | `dashboard_model_stats` | Get model usage statistics (call count, token consumption, cost, etc.) |
117
- | `dashboard_trend` | Get consumption trend data over time |
114
+ **62 tools** organized by domain:
115
+
116
+ | Domain | Count | Description |
117
+ |--------|-------|-------------|
118
+ | **user** | 6 | User profile, preferences, and account info |
119
+ | **dashboard** | 10 | Dashboard statistics, trends, rankings, model usage, member usage |
120
+ | **wallet** | 8 | Wallet overview, transactions, balance history, recharge records |
121
+ | **team** | 14 | Team/department management, member CRUD, role & permission queries |
122
+ | **tokens** | 6 | Token consumption details, usage aggregation, billing records |
123
+ | **invoice** | 4 | Invoice list, invoice detail, red-punch status queries |
124
+ | **misc** | 14 | Refund management, resource rules, alert settings, message center |
125
+
126
+ ## Authentication
127
+
128
+ This MCP server uses **Access Token** (JWT Bearer Token) authentication. The token is obtained after user login and passed via the `TUS_ACCESS_TOKEN` environment variable. All upstream API requests include it as `Authorization: Bearer <token>`.
129
+
130
+ ## Development
131
+
132
+ ```bash
133
+ npm run dev # Watch mode
134
+ npm run build # Compile TypeScript
135
+ npm start # Run compiled server
136
+ ```
137
+
138
+ ## License
139
+
140
+ MIT
141
+ # mcp-user-system
142
+
143
+ [MCP](https://modelcontextprotocol.io) server for token-user-system — Console 前台全量查询接口 via Model Context Protocol.
144
+
145
+ Provides AI agents with authenticated access to the Console (前台) query APIs, covering user info, dashboard statistics, wallet, team management, token usage, invoices, and miscellaneous lookups.
146
+
147
+ Supports: user profiles, dashboard stats & trends, wallet overview, team & member management, token consumption, invoice queries, and more.
148
+
149
+ ## Prerequisites
150
+
151
+ - Node.js >= 18
152
+ - `TUS_BASE_URL` and `TUS_ACCESS_TOKEN` environment variables
153
+
154
+ ## Installation
155
+
156
+ ### 1. Install globally
157
+
158
+ ```bash
159
+ npm install -g mcp-user-system
160
+ ```
161
+
162
+ Or clone & build manually:
163
+
164
+ ```bash
165
+ git clone https://github.com/shenda-ai/mcp-user-system.git
166
+ cd mcp-user-system
167
+ npm install
168
+ npm run build
169
+ ```
170
+
171
+ ### 2. Configure Environment
172
+
173
+ ```bash
174
+ export TUS_BASE_URL=https://api.example.com
175
+ export TUS_ACCESS_TOKEN=your-jwt-access-token
176
+ ```
177
+
178
+ Or create a `.env` file (add to `.gitignore`):
179
+
180
+ ```bash
181
+ TUS_BASE_URL=https://api.example.com
182
+ TUS_ACCESS_TOKEN=your-jwt-access-token
183
+ ```
184
+
185
+ > **Access Token** is a JWT Bearer Token obtained after user login. Include it as `Authorization: Bearer <token>` in upstream requests.
186
+
187
+ ### 3. Test Run
188
+
189
+ ```bash
190
+ npm start
191
+ ```
192
+
193
+ ## MCP Client Configuration
194
+
195
+ ### Claude Desktop (macOS)
196
+
197
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
198
+
199
+ ```json
200
+ {
201
+ "mcpServers": {
202
+ "user-system": {
203
+ "command": "node",
204
+ "args": ["/path/to/mcp-user-system/dist/index.js"],
205
+ "env": {
206
+ "TUS_BASE_URL": "https://api.example.com",
207
+ "TUS_ACCESS_TOKEN": "your-jwt-access-token"
208
+ }
209
+ }
210
+ }
211
+ }
212
+ ```
213
+
214
+ ### Cursor / VS Code
215
+
216
+ Add to settings (Cursor: `~/.cursor/mcp.json`, VS Code: settings.json):
217
+
218
+ ```json
219
+ {
220
+ "mcpServers": {
221
+ "user-system": {
222
+ "command": "node",
223
+ "args": ["/path/to/mcp-user-system/dist/index.js"],
224
+ "env": {
225
+ "TUS_BASE_URL": "https://api.example.com",
226
+ "TUS_ACCESS_TOKEN": "your-jwt-access-token"
227
+ }
228
+ }
229
+ }
230
+ }
231
+ ```
232
+
233
+ ### Claude Code (CLI)
234
+
235
+ Add to `~/.claude/mcp.json`:
236
+
237
+ ```json
238
+ {
239
+ "mcpServers": {
240
+ "user-system": {
241
+ "command": "node",
242
+ "args": ["/path/to/mcp-user-system/dist/index.js"],
243
+ "env": {
244
+ "TUS_BASE_URL": "https://api.example.com",
245
+ "TUS_ACCESS_TOKEN": "your-jwt-access-token"
246
+ }
247
+ }
248
+ }
249
+ }
250
+ ```
251
+
252
+ ## Available Tools
253
+
254
+ **62 tools** organized by domain:
255
+
256
+ | Domain | Count | Description |
257
+ |--------|-------|-------------|
258
+ | **user** | 6 | User profile, preferences, and account info |
259
+ | **dashboard** | 10 | Dashboard statistics, trends, rankings, model usage, member usage |
260
+ | **wallet** | 8 | Wallet overview, transactions, balance history, recharge records |
261
+ | **team** | 14 | Team/department management, member CRUD, role & permission queries |
262
+ | **tokens** | 6 | Token consumption details, usage aggregation, billing records |
263
+ | **invoice** | 4 | Invoice list, invoice detail, red-punch status queries |
264
+ | **misc** | 14 | Model list, announcements, notifications, system config, and other lookups |
265
+
266
+ ## Authentication
267
+
268
+ This MCP server uses **Access Token** (JWT Bearer Token) authentication. The token is obtained after user login and passed via the `TUS_ACCESS_TOKEN` environment variable. All upstream API requests include it as `Authorization: Bearer <token>`.
118
269
 
119
270
  ## Development
120
271
 
package/dist/env.d.ts CHANGED
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export interface Config {
5
5
  baseUrl: string;
6
- apiKey: string;
6
+ accessToken: string;
7
7
  }
8
8
  export declare function loadConfig(): Config;
package/dist/env.js CHANGED
@@ -11,7 +11,7 @@ function requireEnv(name) {
11
11
  export function loadConfig() {
12
12
  return {
13
13
  baseUrl: requireEnv("TUS_BASE_URL"),
14
- apiKey: requireEnv("TUS_API_KEY"),
14
+ accessToken: requireEnv("TUS_ACCESS_TOKEN"),
15
15
  };
16
16
  }
17
17
  //# sourceMappingURL=env.js.map
package/dist/env.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC;QACnC,MAAM,EAAE,UAAU,CAAC,aAAa,CAAC;KAClC,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA;;GAEG;AAOH,SAAS,UAAU,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,0CAA0C,IAAI,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO;QACL,OAAO,EAAE,UAAU,CAAC,cAAc,CAAC;QACnC,WAAW,EAAE,UAAU,CAAC,kBAAkB,CAAC;KAC5C,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,8 +2,7 @@
2
2
  /**
3
3
  * MCP Server for token-user-system
4
4
  *
5
- * Provides OpenAPI tools via Model Context Protocol.
6
- * Supports: wallet, dashboard stats, orders, users, model-stats, trend,
7
- * configurable-models, tokens-list, tokens-list-page, team-tree, team-members
5
+ * Provides tools via Model Context Protocol, organized by domain:
6
+ * user, dashboard, wallet, team, tokens, invoice, misc
8
7
  */
9
8
  export {};