@liangshanli/mcp-server-project-standards 5.1.0 โ†’ 5.1.1

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,832 +1,836 @@
1
- # MCP Project Standards Server
2
-
3
- A MCP (Model Context Protocol) server for project standards management, designed for AI-assisted development to help teams maintain unified development standards and specifications across multiple machines.
4
-
5
- ## ๐Ÿ“‹ Version Updates
6
-
7
- ### v5.1.0 (2025-12-22)
8
- - **New Tool**: Added `download_file` tool to download files from URL to project path.
9
- - **Version Sync**: Updated server and package versions to 5.1.0.
10
-
11
- ### v5.0.0 (2025-12-19) - Major Release
12
- - **Project Path Support**: Added `PROJECT_PATH` environment variable for resolving relative paths.
13
- - **Cursor Detection**: Automatic identification of Cursor IDE for enhanced features.
14
- - **New Tools**: Added `list_directory`, `generate_cursorrules`, and `generate_rules`.
15
- - **AI Guidance**: Integrated AI Enforcement Rules into rule generation templates.
16
- - **Security**: Added path validation for directory listing.
17
-
18
- ### v3.0.0 (2025-10-31) - Major Release
19
-
20
- #### ๐Ÿš€ Breaking Changes
21
- - Config directory resolution now depends on both `CONFIG_DIR` and `TOOL_PREFIX`:
22
- - If `CONFIG_DIR` is set, it is used as-is
23
- - If `CONFIG_DIR` is not set and `TOOL_PREFIX` is set, use `./.setting.<TOOL_PREFIX>`
24
- - Otherwise default to `./.setting`
25
- - `tools/call` now strips the `TOOL_PREFIX` from tool names before method dispatch. If you call `xxx_api_debug` (with `TOOL_PREFIX=xxx`), the server routes the call to `api_debug` internally.
26
-
27
- #### โœจ New/Improved
28
- - Unified `getConfigDir()` used by both `server-final.js` and `api_common.js`
29
- - `tools/list` shows environment with resolved `CONFIG_DIR`
30
- - Prefixed tool names and project-branded descriptions when both `TOOL_PREFIX` and `PROJECT_NAME` are provided
31
-
32
- #### ๐Ÿงน Cleanup
33
- - Removed duplicate legacy `api_debug` method definition
34
-
35
- #### ๐Ÿ’ก Benefits
36
- - Multi-project isolation: simple per-project segregation via `TOOL_PREFIX` without code changes
37
- - Zero-friction switching: swap project context by environment only
38
- - Smoother tool calling: clients can call prefixed names, server auto-routes
39
-
40
- ### v2.0.0 (2024-12-19) - Major Release
41
-
42
- #### ๐Ÿš€ New Tools & Features
43
- - **API Login Tool** (`api_login`): Direct login authentication using environment variables
44
- - **API Debug Tool** (`api_debug`): Simplified API request execution
45
- - **API Config Tool** (`api_config`): Comprehensive configuration management
46
- - **Code Refactoring**: Eliminated duplicate code with shared utilities
47
- - **Enhanced Environment Variable Support**: Flexible login body formats (JSON/string)
48
-
49
- #### ๐Ÿ”ง Technical Improvements
50
- - **Reduced Code Duplication**: ~70% reduction in duplicate code
51
- - **Better Error Handling**: Unified error management across tools
52
- - **Improved Performance**: Faster module loading and execution
53
- - **Enhanced Maintainability**: Centralized configuration management
54
-
55
- ### v1.1.0 (2024-12-19)
56
-
57
- #### ๐Ÿ†• New Features
58
- - **API Debug Tool Environment Variable Support**:
59
- - `API_DEBUG_ALLOWED_METHODS` - Control allowed request methods (default: GET)
60
- - `API_DEBUG_LOGIN_URL` - Set login API URL (default: /api/login)
61
- - `API_DEBUG_LOGIN_METHOD` - Set login request method (default: POST)
62
- - `API_DEBUG_LOGIN_BODY` - Set login request body (default: {"username":"","password":""})
63
- - `API_DEBUG_LOGIN_DESCRIPTION` - Set login API description (default: Save returned token to common headers in debug tool, field name Authorization, field value Bearer token)
64
-
65
- #### ๐Ÿ”ง Feature Improvements
66
- - **Smart Login API Recognition**:
67
- - Support for full URL and relative path matching
68
- - Automatic login API recognition using environment variable configuration
69
- - Non-login APIs strictly follow allowed method restrictions
70
-
71
- - **Error Handling Optimization**:
72
- - Only request-related errors are saved to api.json
73
- - Method validation errors don't pollute execution records
74
- - More precise error classification and handling
75
-
76
- - **Dynamic Tool Description**:
77
- - Display login authentication information based on environment variable configuration
78
- - Real-time display of allowed request methods and usage instructions
79
-
80
- #### ๐Ÿ›ก๏ธ Security Enhancements
81
- - **Request Method Restrictions**: Default only allows GET requests to prevent accidental operations
82
- - **Login API Exception**: Login APIs can use methods configured in environment variables
83
- - **Flexible Configuration**: Can open more request methods as needed
84
-
85
- #### ๐Ÿ“š Documentation Updates
86
- - Added environment variable configuration instructions
87
- - Updated API debug tool usage guide
88
- - Improved login authentication flow documentation
89
-
90
- ## ๐Ÿš€ Core Advantages
91
-
92
- ### ๐Ÿ’ฐ Token Cost Optimization
93
- - **Efficient Context Caching**: By using MCP tools to retrieve short, structured standard data instead of reading long documents, it triggers model Context Caching more effectively (e.g., Gemini 3 Flash), significantly reducing input costs (down to $0.05/1M).
94
- - **Incremental Output**: Enforces minimal code diffs and precise tool responses, minimizing high-cost output token consumption.
95
-
96
- ### ๐ŸŽฏ Solving Multi-Machine Development Chaos
97
- - **Unified Standards**: AI assistants on multiple machines use the same project standards, avoiding inconsistent development styles
98
- - **Team Collaboration**: Eliminates code style differences caused by different developers using different AI configurations
99
-
100
- ### ๐Ÿ›ก๏ธ Enterprise-Grade Development Standards Management
101
- - **Project Information Management**: Unified management of basic project information, tech stack, versions, etc.
102
- - **API Standards Specification**: Define unified interface design standards to ensure API consistency
103
- - **Development Standards**: Code style, naming conventions, architecture standards, etc.
104
- - **Database Standards**: Table structure, naming conventions, indexing strategies, etc.
105
-
106
- ### ๐Ÿ”ง Simple Configuration Management
107
- - **JSON Configuration**: Simple configuration storage based on JSON files
108
- - **Environment Variables**: Support for specifying configuration file paths through environment variables
109
- - **Auto-Creation**: Automatically creates default configuration files on first run
110
-
111
- ## โœจ Main Features
112
-
113
- - โœ… **Project Information Management** - Unified management of project basic information and configuration
114
- - โœ… **Project Structure Analysis** - Intelligent analysis of project directory structure and dependencies
115
- - โœ… **API Interface Standards** - Define unified API design specifications and best practices
116
- - โœ… **Development Standards** - Code style, naming conventions, architecture standards management
117
- - โœ… **Database Standards** - Table structure design, naming conventions, indexing strategies standardization
118
- - โœ… **API Debugging Tool** - Complete API interface testing and debugging functionality
119
- - โœ… **Configuration Management** - JSON-based configuration storage and management
120
- - โœ… **Auto-Restart** - Intelligent process management and fault recovery
121
- - โœ… **Health Checks** - Real-time service status and performance monitoring
122
- - โœ… **File Downloader** - Download files from URLs directly to the project directory
123
-
124
- ## ๐ŸŽฏ Application Scenarios
125
-
126
- ### Team Collaborative Development
127
- - **Multi-Developer Environment**: Ensure each developer's AI assistant follows the same project standards
128
- - **Code Review**: Unified code style and standards, reducing review time
129
- - **New Team Member Training**: Quickly help new team members understand project standards and best practices
130
-
131
- ### Enterprise Projects
132
- - **Large Projects**: Manage complex project structures and multi-module development
133
- - **Microservices Architecture**: Unify API design and database standards across services
134
- - **Multi-Environment Deployment**: Standard consistency across development, testing, and production environments
135
-
136
- ### AI-Assisted Development
137
- - **Intelligent Code Generation**: AI generates code that conforms to project standards
138
- - **Automatic Refactoring**: Automatically optimize and refactor code based on standards
139
- - **Standards Checking**: Real-time checking of code compliance with project standards
140
-
141
- ## Installation
142
-
143
- ### Global Installation (Recommended)
144
- ```bash
145
- npm install -g @liangshanli/mcp-server-project-standards
146
- ```
147
-
148
- ### Local Installation
149
- ```bash
150
- npm install @liangshanli/mcp-server-project-standards
151
- ```
152
-
153
- ### From Source
154
- ```bash
155
- git clone https://github.com/liliangshan/mcp-server-project-standards.git
156
- cd mcp-server-project-standards
157
- npm install
158
- ```
159
-
160
- ## โš™๏ธ Configuration Management
161
-
162
- The server uses the `./.setting/` directory to store configuration files by default. You can specify a different directory using environment variables.
163
-
164
- ### Environment Variables
165
-
166
- | Variable | Default | Description | Example |
167
- |----------|---------|-------------|---------|
168
- | PROJECT_PATH | . | Root path of the project. Supports both absolute (e.g., `/` or `C:\`) and relative paths. Used to resolve all relative paths. | `export PROJECT_PATH="/path/to/project"` |
169
- | CONFIG_DIR | ./.setting or ./.setting.<TOOL_PREFIX> | Configuration directory. Resolved relative to PROJECT_PATH. | `export CONFIG_DIR="./config"` |
170
- | TOOL_PREFIX | | Optional tool prefix for tool names and config isolation | `export TOOL_PREFIX="projA"` |
171
- | PROJECT_NAME | | Optional project branding for tool descriptions | `export PROJECT_NAME="MyProject"` |
172
- | API_DEBUG_ALLOWED_METHODS | GET | Control allowed request methods (supports: GET,POST,PUT,DELETE,PATCH, etc.) | `export API_DEBUG_ALLOWED_METHODS="GET,POST"` |
173
- | API_DEBUG_LOGIN_URL | /api/login | Set login API URL | `export API_DEBUG_LOGIN_URL="/api/auth/login"` |
174
- | API_DEBUG_LOGIN_METHOD | POST | Set login request method | `export API_DEBUG_LOGIN_METHOD="POST"` |
175
- | API_DEBUG_LOGIN_BODY | {"username":"","password":""} | Set login request body | `export API_DEBUG_LOGIN_BODY='{"mobile":"","password":""}'` |
176
- | API_DEBUG_LOGIN_DESCRIPTION | Save returned token to common headers in debug tool, field name Authorization, field value Bearer token | Set login API description | `export API_DEBUG_LOGIN_DESCRIPTION="User Login API"` |
177
-
178
- ### Configuration Files
179
-
180
- The server uses two configuration files:
181
- - `config.json` - Project standards configuration
182
- - `api.json` - API debugging configuration
183
-
184
- **config.json default values:**
185
- ```json
186
- {
187
- "project_info": {},
188
- "project_structure": [],
189
- "api_standards": {},
190
- "development_standards": [],
191
- "database_standards": []
192
- }
193
- ```
194
-
195
- **api.json default values:**
196
- ```json
197
- {
198
- "baseUrl": "",
199
- "headers": {
200
- "Content-Type": "application/json",
201
- "Accept": "application/json"
202
- },
203
- "list": []
204
- }
205
- ```
206
-
207
- ### Configuration Field Description
208
-
209
- **config.json fields:**
210
- - **project_info** - Project basic information (project name, development language, description, etc.)
211
- - **project_structure** - Project structure definition (directory and file descriptions)
212
- - **api_standards** - API interface standards (interface type, response structure, request headers, etc.)
213
- - **development_standards** - Development standards (code style, naming conventions, etc.)
214
- - **database_standards** - Database standards (table naming, field naming, etc.)
215
-
216
- **api.json fields:**
217
- - **baseUrl** - API base URL
218
- - **headers** - Common request headers (authentication, Content-Type, etc.)
219
- - **list** - API interface list (includes request parameters, response data, execution history, etc.)
220
-
221
- ## ๐Ÿš€ Quick Start
222
-
223
- ### 1. Direct Run (Global Installation)
224
- ```bash
225
- mcp-server-project-standards
226
- ```
227
-
228
- ### 2. Using npx (Recommended)
229
- ```bash
230
- npx @liangshanli/mcp-server-project-standards
231
- ```
232
-
233
- ### 3. Direct Start (Source Installation)
234
- ```bash
235
- npm start
236
- ```
237
-
238
- ### 4. Managed Start (Recommended for Production)
239
- ```bash
240
- npm run start-managed
241
- ```
242
-
243
- Managed start provides:
244
- - Auto-restart (up to 10 times)
245
- - Error recovery
246
- - Process management
247
- - Logging
248
-
249
- ### 5. Development Mode
250
- ```bash
251
- npm run dev
252
- ```
253
-
254
- ## Editor Integration
255
-
256
- ### Cursor Editor Configuration
257
-
258
- 1) Single-project example (no prefix isolation):
259
-
260
- ```json
261
- {
262
- "mcpServers": {
263
- "project-standards": {
264
- "command": "npx",
265
- "args": ["@liangshanli/mcp-server-project-standards"],
266
- "env": {
267
- "PROJECT_PATH": ".",
268
- "CONFIG_DIR": "./.setting",
269
- "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
270
- "API_DEBUG_LOGIN_URL": "/api/login",
271
- "API_DEBUG_LOGIN_METHOD": "POST",
272
- "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}",
273
- "API_DEBUG_LOGIN_DESCRIPTION": "Save returned token to common headers in debug tool, field name Authorization, field value Bearer token"
274
- }
275
- }
276
- }
277
- }
278
- ```
279
-
280
- 2) Multi-project example (with TOOL_PREFIX + PROJECT_NAME):
281
-
282
- ```json
283
- {
284
- "mcpServers": {
285
- "project-standards-A": {
286
- "command": "npx",
287
- "args": ["@liangshanli/mcp-server-project-standards"],
288
- "env": {
289
- "PROJECT_PATH": ".",
290
- "TOOL_PREFIX": "projA",
291
- "PROJECT_NAME": "Project A",
292
- "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
293
- "API_DEBUG_LOGIN_URL": "/api/login",
294
- "API_DEBUG_LOGIN_METHOD": "POST",
295
- "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}"
296
- }
297
- },
298
- "project-standards-B": {
299
- "command": "npx",
300
- "args": ["@liangshanli/mcp-server-project-standards"],
301
- "env": {
302
- "PROJECT_PATH": ".",
303
- "TOOL_PREFIX": "projB",
304
- "PROJECT_NAME": "Project B",
305
- "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
306
- "API_DEBUG_LOGIN_URL": "/api/auth/login",
307
- "API_DEBUG_LOGIN_METHOD": "POST",
308
- "API_DEBUG_LOGIN_BODY": "{\"mobile\":\"\",\"password\":\"\"}"
309
- }
310
- }
311
- }
312
- }
313
- ```
314
-
315
- ### VS Code Configuration
316
-
317
- 1) Single-project example (no prefix isolation):
318
-
319
- ```json
320
- {
321
- "mcp.servers": {
322
- "project-standards": {
323
- "command": "npx",
324
- "args": ["@liangshanli/mcp-server-project-standards"],
325
- "env": {
326
- "PROJECT_PATH": ".",
327
- "CONFIG_DIR": "./.setting",
328
- "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
329
- "API_DEBUG_LOGIN_URL": "/api/login",
330
- "API_DEBUG_LOGIN_METHOD": "POST",
331
- "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}"
332
- }
333
- }
334
- }
335
- }
336
- ```
337
-
338
- 2) Multi-project example (with TOOL_PREFIX + PROJECT_NAME):
339
-
340
- ```json
341
- {
342
- "mcp.servers": {
343
- "project-standards-A": {
344
- "command": "npx",
345
- "args": ["@liangshanli/mcp-server-project-standards"],
346
- "env": {
347
- "PROJECT_PATH": ".",
348
- "TOOL_PREFIX": "projA",
349
- "PROJECT_NAME": "Project A",
350
- "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
351
- "API_DEBUG_LOGIN_URL": "/api/login",
352
- "API_DEBUG_LOGIN_METHOD": "POST",
353
- "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}"
354
- }
355
- },
356
- "project-standards-B": {
357
- "command": "npx",
358
- "args": ["@liangshanli/mcp-server-project-standards"],
359
- "env": {
360
- "PROJECT_PATH": ".",
361
- "TOOL_PREFIX": "projB",
362
- "PROJECT_NAME": "Project B",
363
- "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
364
- "API_DEBUG_LOGIN_URL": "/api/auth/login",
365
- "API_DEBUG_LOGIN_METHOD": "POST",
366
- "API_DEBUG_LOGIN_BODY": "{\"mobile\":\"\",\"password\":\"\"}"
367
- }
368
- }
369
- }
370
- }
371
- ```
372
-
373
- ## ๐Ÿ› ๏ธ Available Tools
374
-
375
- ### 1. Project Information Management (project_info)
376
- Get and manage project basic information, including project name, development language, description, etc.
377
-
378
- **Parameters:**
379
- - `action` (required): Operation type - "get" to retrieve info, "set" to set info
380
- - `key` (optional): Field to set - "projectName", "developmentLanguage", "basicInfo"
381
- - `value` (optional): Value to set
382
-
383
- **Example:**
384
- ```json
385
- {
386
- "jsonrpc": "2.0",
387
- "id": 1,
388
- "method": "tools/call",
389
- "params": {
390
- "name": "project_info",
391
- "arguments": {
392
- "action": "set",
393
- "key": "projectName",
394
- "value": "My Project"
395
- }
396
- }
397
- }
398
- ```
399
-
400
- ### 2. Project Structure Management (project_structure)
401
- Get and manage project directory structure with depth control and hidden file inclusion.
402
-
403
- **Parameters:**
404
- - `action` (required): Operation type - "get" to retrieve structure, "set" to set structure, "delete" to delete structure item
405
- - `structure` (optional): Structure item array (required for set action)
406
- - `path` (optional): Path to delete (required for delete action)
407
-
408
- **Example:**
409
- ```json
410
- {
411
- "jsonrpc": "2.0",
412
- "id": 2,
413
- "method": "tools/call",
414
- "params": {
415
- "name": "project_structure",
416
- "arguments": {
417
- "action": "set",
418
- "structure": [
419
- {
420
- "path": "/src",
421
- "description": "Source code directory"
422
- }
423
- ]
424
- }
425
- }
426
- }
427
- ```
428
-
429
- ### 3. API Standards Management (api_standards)
430
- Get and manage API interface standards and best practices.
431
-
432
- **Parameters:**
433
- - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
434
- - `key` (optional): Field to set - "interfaceType", "successStructure", "errorStructure", "basicHeaders", "requirements"
435
- - `value` (optional): Value to set
436
- - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
437
-
438
- **Example:**
439
- ```json
440
- {
441
- "jsonrpc": "2.0",
442
- "id": 3,
443
- "method": "tools/call",
444
- "params": {
445
- "name": "api_standards",
446
- "arguments": {
447
- "action": "set",
448
- "key": "requirements",
449
- "value": ["Unified response format", "Error code standards", "Parameter validation"],
450
- "forceOverwrite": true
451
- }
452
- }
453
- }
454
- ```
455
-
456
- ### 4. Development Standards Management (development_standards)
457
- Get and manage development standards, including code style, Git workflow, testing, and documentation.
458
-
459
- **Parameters:**
460
- - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
461
- - `standards` (optional): Standards array (required for set action)
462
- - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
463
-
464
- **Example:**
465
- ```json
466
- {
467
- "jsonrpc": "2.0",
468
- "id": 4,
469
- "method": "tools/call",
470
- "params": {
471
- "name": "development_standards",
472
- "arguments": {
473
- "action": "set",
474
- "standards": ["Use 2 spaces for indentation", "Use single quotes", "Use camelCase naming"],
475
- "forceOverwrite": false
476
- }
477
- }
478
- }
479
- ```
480
-
481
- ### 5. Database Standards Management (database_standards)
482
- Get and manage database standards, including table structure design, naming conventions, indexing strategies, etc.
483
-
484
- **Parameters:**
485
- - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
486
- - `standards` (optional): Standards array (required for set action)
487
- - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
488
-
489
- **Example:**
490
- ```json
491
- {
492
- "jsonrpc": "2.0",
493
- "id": 5,
494
- "method": "tools/call",
495
- "params": {
496
- "name": "database_standards",
497
- "arguments": {
498
- "action": "set",
499
- "standards": [
500
- "Use test_ prefix for all table names",
501
- "Use snake_case for table and field names",
502
- "Use singular form for table names"
503
- ],
504
- "forceOverwrite": true
505
- }
506
- }
507
- }
508
- ```
509
-
510
- ### 6. API Debugging Tool (api_debug)
511
- Complete API interface testing and debugging functionality, supporting multiple HTTP methods, authentication, parameter passing, etc.
512
-
513
- **Parameters:**
514
- - `action` (required): Operation type - "get" to retrieve config, "set" to update config, "delete" to delete API, "execute" to execute API, "updateBaseUrl" to update base URL, "updateHeaders" to update headers, "deleteHeader" to delete specific header, "search" to search APIs
515
- - `config` (optional): API debug configuration (required for set action)
516
- - `index` (optional): API index (required for execute/delete actions)
517
- - `baseUrl` (optional): New base URL (required for updateBaseUrl action)
518
- - `headers` (optional): New headers (required for updateHeaders action)
519
- - `headerName` (optional): Header name to delete (required for deleteHeader action)
520
- - `keyword` (optional): Search keyword (required for search action)
521
-
522
- **Features:**
523
- - **Smart Content-Type Detection**: Automatically detect request body type (JSON, XML, HTML, URL-encoded, etc.)
524
- - **Authentication Management**: Support Bearer Token and other authentication methods
525
- - **URL Deduplication**: Same URL only saves one copy of data, avoiding duplicates
526
- - **Execution Recording**: Record execution history regardless of success or failure
527
- - **Search Function**: Support searching APIs by URL or description
528
- - **Parameter Management**: Support query parameters, request body, custom headers, etc.
529
-
530
- **๐Ÿ” Special Note - Login Authentication Flow:**
531
-
532
- The API debugging tool supports a complete login authentication flow, making it easy to manage API access permissions:
533
-
534
- 1. **Login API Configuration**:
535
- - First configure the login API (e.g., `/api/login`)
536
- - Set login request parameters (username, password, etc.)
537
- - Execute login request to obtain authentication information
538
-
539
- 2. **Automatic Token Management**:
540
- - After successful login, the tool automatically extracts returned `token` or `cookie`
541
- - Automatically writes authentication information to common request headers (e.g., `Authorization: Bearer token`)
542
- - All subsequent API requests automatically carry authentication information
543
-
544
- 3. **Authentication Expiration Handling**:
545
- - When API returns authentication expired error
546
- - Re-execute the original login API to get new token
547
- - Use `updateHeaders` operation to update common request headers
548
- - Continue debugging other APIs that require authentication
549
-
550
- 4. **Usage Flow Example**:
551
- ```bash
552
- # 1. Configure login API
553
- api_debug set config={login_api_config}
554
-
555
- # 2. Execute login to get token
556
- api_debug execute index=0
557
-
558
- # 3. Update common request headers (automatic)
559
- api_debug updateHeaders headers={Authorization: Bearer token}
560
-
561
- # 4. Debug other APIs that require authentication
562
- api_debug execute index=1
563
-
564
- # 5. If token expires, re-login
565
- api_debug execute index=0 # Re-execute login
566
- ```
567
-
568
- This design eliminates the need for manual authentication state management, as the tool automatically handles login and token updates, greatly simplifying the API debugging process!
569
-
570
- ### 7. Directory Listing (list_directory)
571
- Recursively explores the directory structure relative to the project root.
572
-
573
- **Parameters:**
574
- - `path` (optional): Subdirectory path to list.
575
- - `depth` (optional): Max recursion depth (default: 2).
576
-
577
- **Example:**
578
- ```json
579
- {
580
- "jsonrpc": "2.0",
581
- "id": 10,
582
- "method": "tools/call",
583
- "params": {
584
- "name": "list_directory",
585
- "arguments": {
586
- "depth": 3
587
- }
588
- }
589
- }
590
- ```
591
-
592
- ### 8. Rule Generation (generate_cursorrules / generate_rules)
593
- Generates AI project guidance files (`.cursorrules` for Cursor, `PROJECT_RULES.md` for others) based on your standards.
594
-
595
- **Parameters:**
596
- - `save` (optional): Whether to save content to disk (default: false).
597
-
598
- **Example:**
599
- ```json
600
- {
601
- "jsonrpc": "2.0",
602
- "id": 11,
603
- "method": "tools/call",
604
- "params": {
605
- "name": "generate_cursorrules",
606
- "arguments": {
607
- "save": true
608
- }
609
- }
610
- }
611
- ```
612
-
613
- ### 9. File Download Tool (download_file)
614
- Download a file from a URL and save it to a specified path within the project.
615
-
616
- **Parameters:**
617
- - `url` (required): The URL of the file to download.
618
- - `savePath` (required): The path where the file should be saved (relative to project path or absolute).
619
-
620
- **Example:**
621
- ```json
622
- {
623
- "jsonrpc": "2.0",
624
- "id": 12,
625
- "method": "tools/call",
626
- "params": {
627
- "name": "download_file",
628
- "arguments": {
629
- "url": "https://example.com/logo.png",
630
- "savePath": "assets/logo.png"
631
- }
632
- }
633
- }
634
- ```
635
-
636
- ## ๐Ÿ”— Related Tools for Collaborative Use
637
-
638
- To provide a more complete development experience, we recommend using the following MCP tools in collaboration:
639
-
640
- ### ๐Ÿ—„๏ธ Database Management Tools
641
-
642
- **MySQL Database Support**
643
- - **NPM Package**: [@liangshanli/mcp-server-mysql](https://www.npmjs.com/package/@liangshanli/mcp-server-mysql)
644
- - **GitHub Repository**: [mcp-server-mysql](https://github.com/liliangshan/mcp-server-mysql)
645
- - **Features**: DDL operations, permission control, operation logs, connection pool management
646
- - **Highlights**: Supports DDL SQL logging for easy database structure synchronization
647
-
648
- **SQL Server Database Support**
649
- - **NPM Package**: [@liangshanli/mcp-server-mssqlserver](https://www.npmjs.com/package/@liangshanli/mcp-server-mssqlserver)
650
- - **GitHub Repository**: [mcp-server-mssqlserver](https://github.com/liliangshan/mcp-server-mssqlserver)
651
- - **Features**: SQL Server database operations, DDL support, permission management
652
- - **Highlights**: Optimized specifically for SQL Server database operations
653
-
654
- ### ๐ŸŽจ Icon Management Tools
655
-
656
- **Icon Resource Management**
657
- - **NPM Package**: [@liangshanli/mcp-server-icon](https://www.npmjs.com/package/@liangshanli/mcp-server-icon)
658
- - **GitHub Repository**: [mcp-server-icon](https://github.com/liliangshan/mcp-server-icon)
659
- - **Features**: Icon resource management, icon search, icon library integration
660
- - **Highlights**: Supports multiple icon libraries for convenient UI development
661
-
662
- ### ๐Ÿš€ Collaborative Development Benefits
663
-
664
- **Complete Development Stack**:
665
- - **Project Standards** + **Database Management** + **API Debugging** + **Icon Resources** = Full-stack development solution
666
- - Unified MCP protocol for seamless integration of all tools
667
- - Consistent configuration management and error handling mechanisms
668
-
669
- **Team Collaboration**:
670
- - All tools support unified standards across multi-machine environments
671
- - Shared configuration files and logging systems
672
- - Easy onboarding and collaboration for team members
673
-
674
- **Development Efficiency**:
675
- - One-stop solution from project standards to database operations to API debugging
676
- - Reduced tool switching costs and improved development efficiency
677
- - Unified error handling and logging
678
-
679
- **Usage Example**:
680
- ```bash
681
- # 1. Install project standards management tool
682
- npm install -g @liangshanli/mcp-server-project-standards
683
-
684
- # 2. Install database management tools (choose as needed)
685
- npm install -g @liangshanli/mcp-server-mysql
686
- # or
687
- npm install -g @liangshanli/mcp-server-mssqlserver
688
-
689
- # 3. Install icon management tool
690
- npm install -g @liangshanli/mcp-server-icon
691
-
692
- # 4. Configure multiple MCP servers in your editor
693
- ```
694
-
695
- **Example:**
696
-
697
- **Set API Configuration:**
698
- ```json
699
- {
700
- "jsonrpc": "2.0",
701
- "id": 6,
702
- "method": "tools/call",
703
- "params": {
704
- "name": "api_debug",
705
- "arguments": {
706
- "action": "set",
707
- "config": {
708
- "baseUrl": "https://api.example.com",
709
- "headers": {
710
- "Content-Type": "application/json",
711
- "Authorization": "Bearer your-token"
712
- },
713
- "list": [
714
- {
715
- "description": "User Login",
716
- "url": "/api/login",
717
- "method": "POST",
718
- "body": {
719
- "username": "user",
720
- "password": "pass"
721
- }
722
- }
723
- ]
724
- }
725
- }
726
- }
727
- }
728
- ```
729
-
730
- **Execute API Request:**
731
- ```json
732
- {
733
- "jsonrpc": "2.0",
734
- "id": 7,
735
- "method": "tools/call",
736
- "params": {
737
- "name": "api_debug",
738
- "arguments": {
739
- "action": "execute",
740
- "index": 0
741
- }
742
- }
743
- }
744
- ```
745
-
746
- **Search API:**
747
- ```json
748
- {
749
- "jsonrpc": "2.0",
750
- "id": 8,
751
- "method": "tools/call",
752
- "params": {
753
- "name": "api_debug",
754
- "arguments": {
755
- "action": "search",
756
- "keyword": "login"
757
- }
758
- }
759
- }
760
- ```
761
-
762
- **Update Authentication Headers:**
763
- ```json
764
- {
765
- "jsonrpc": "2.0",
766
- "id": 9,
767
- "method": "tools/call",
768
- "params": {
769
- "name": "api_debug",
770
- "arguments": {
771
- "action": "updateHeaders",
772
- "headers": {
773
- "Authorization": "Bearer new-token"
774
- }
775
- }
776
- }
777
- }
778
- ```
779
-
780
-
781
- ## ๐Ÿ›ก๏ธ Error Handling
782
-
783
- - Individual request errors don't affect the entire server
784
- - Configuration errors are automatically recovered
785
- - Process exceptions are automatically restarted (managed mode)
786
-
787
- ## ๐Ÿ“ Project Structure
788
-
789
- ```
790
- mcp-server-project-standards/
791
- โ”œโ”€โ”€ src/
792
- โ”‚ โ”œโ”€โ”€ server-final.js # Main server file
793
- โ”‚ โ””โ”€โ”€ utils/ # Utility functions directory
794
- โ”‚ โ”œโ”€โ”€ get_project_info.js # Project information management
795
- โ”‚ โ”œโ”€โ”€ get_project_structure.js # Project structure management
796
- โ”‚ โ”œโ”€โ”€ get_api_standards.js # API standards management
797
- โ”‚ โ”œโ”€โ”€ get_development_standards.js # Development standards management
798
- โ”‚ โ”œโ”€โ”€ database_standards.js # Database standards management
799
- โ”‚ โ”œโ”€โ”€ api_debug.js # API debugging tool
800
- โ”‚ โ””โ”€โ”€ ... # Other tools
801
- โ”œโ”€โ”€ bin/
802
- โ”‚ โ””โ”€โ”€ cli.js # CLI startup script
803
- โ”œโ”€โ”€ start-server.js # Managed startup script
804
- โ”œโ”€โ”€ package.json
805
- โ””โ”€โ”€ README.md
806
- ```
807
-
808
- ## ๐Ÿงช Testing
809
-
810
- ```bash
811
- npm test
812
- ```
813
-
814
- ## ๐Ÿ“„ License
815
-
816
- MIT
817
-
818
- ## ๐Ÿค Contributing
819
-
820
- Welcome to submit Issues and Pull Requests to improve this project!
821
-
822
- ## ๐Ÿ“ž Support
823
-
824
- If you encounter problems during use, please:
825
-
826
- 1. Check the [Issues](https://github.com/liliangshan/mcp-server-project-standards/issues) page
827
- 2. Create a new Issue describing your problem
828
- 3. Provide detailed error information and reproduction steps
829
-
830
- ---
831
-
832
- **Make AI-assisted development more standardized and efficient!** ๐Ÿš€
1
+ # MCP Project Standards Server
2
+
3
+ A MCP (Model Context Protocol) server for project standards management, designed for AI-assisted development to help teams maintain unified development standards and specifications across multiple machines.
4
+
5
+ ## ๐Ÿ“‹ Version Updates
6
+
7
+ ### v5.1.1 (2026-02-26)
8
+ - **Bug Fix**: Fixed MCP tool parameter validation error in VS Code - "tool parameters array type must have items"
9
+ - Added `items` property to all `type: 'array'` definitions in tool input schemas to comply with MCP's JSON Schema validation requirements
10
+
11
+ ### v5.1.0 (2025-12-22)
12
+ - **New Tool**: Added `download_file` tool to download files from URL to project path.
13
+ - **Version Sync**: Updated server and package versions to 5.1.0.
14
+
15
+ ### v5.0.0 (2025-12-19) - Major Release
16
+ - **Project Path Support**: Added `PROJECT_PATH` environment variable for resolving relative paths.
17
+ - **Cursor Detection**: Automatic identification of Cursor IDE for enhanced features.
18
+ - **New Tools**: Added `list_directory`, `generate_cursorrules`, and `generate_rules`.
19
+ - **AI Guidance**: Integrated AI Enforcement Rules into rule generation templates.
20
+ - **Security**: Added path validation for directory listing.
21
+
22
+ ### v3.0.0 (2025-10-31) - Major Release
23
+
24
+ #### ๐Ÿš€ Breaking Changes
25
+ - Config directory resolution now depends on both `CONFIG_DIR` and `TOOL_PREFIX`:
26
+ - If `CONFIG_DIR` is set, it is used as-is
27
+ - If `CONFIG_DIR` is not set and `TOOL_PREFIX` is set, use `./.setting.<TOOL_PREFIX>`
28
+ - Otherwise default to `./.setting`
29
+ - `tools/call` now strips the `TOOL_PREFIX` from tool names before method dispatch. If you call `xxx_api_debug` (with `TOOL_PREFIX=xxx`), the server routes the call to `api_debug` internally.
30
+
31
+ #### โœจ New/Improved
32
+ - Unified `getConfigDir()` used by both `server-final.js` and `api_common.js`
33
+ - `tools/list` shows environment with resolved `CONFIG_DIR`
34
+ - Prefixed tool names and project-branded descriptions when both `TOOL_PREFIX` and `PROJECT_NAME` are provided
35
+
36
+ #### ๐Ÿงน Cleanup
37
+ - Removed duplicate legacy `api_debug` method definition
38
+
39
+ #### ๐Ÿ’ก Benefits
40
+ - Multi-project isolation: simple per-project segregation via `TOOL_PREFIX` without code changes
41
+ - Zero-friction switching: swap project context by environment only
42
+ - Smoother tool calling: clients can call prefixed names, server auto-routes
43
+
44
+ ### v2.0.0 (2024-12-19) - Major Release
45
+
46
+ #### ๐Ÿš€ New Tools & Features
47
+ - **API Login Tool** (`api_login`): Direct login authentication using environment variables
48
+ - **API Debug Tool** (`api_debug`): Simplified API request execution
49
+ - **API Config Tool** (`api_config`): Comprehensive configuration management
50
+ - **Code Refactoring**: Eliminated duplicate code with shared utilities
51
+ - **Enhanced Environment Variable Support**: Flexible login body formats (JSON/string)
52
+
53
+ #### ๐Ÿ”ง Technical Improvements
54
+ - **Reduced Code Duplication**: ~70% reduction in duplicate code
55
+ - **Better Error Handling**: Unified error management across tools
56
+ - **Improved Performance**: Faster module loading and execution
57
+ - **Enhanced Maintainability**: Centralized configuration management
58
+
59
+ ### v1.1.0 (2024-12-19)
60
+
61
+ #### ๐Ÿ†• New Features
62
+ - **API Debug Tool Environment Variable Support**:
63
+ - `API_DEBUG_ALLOWED_METHODS` - Control allowed request methods (default: GET)
64
+ - `API_DEBUG_LOGIN_URL` - Set login API URL (default: /api/login)
65
+ - `API_DEBUG_LOGIN_METHOD` - Set login request method (default: POST)
66
+ - `API_DEBUG_LOGIN_BODY` - Set login request body (default: {"username":"","password":""})
67
+ - `API_DEBUG_LOGIN_DESCRIPTION` - Set login API description (default: Save returned token to common headers in debug tool, field name Authorization, field value Bearer token)
68
+
69
+ #### ๐Ÿ”ง Feature Improvements
70
+ - **Smart Login API Recognition**:
71
+ - Support for full URL and relative path matching
72
+ - Automatic login API recognition using environment variable configuration
73
+ - Non-login APIs strictly follow allowed method restrictions
74
+
75
+ - **Error Handling Optimization**:
76
+ - Only request-related errors are saved to api.json
77
+ - Method validation errors don't pollute execution records
78
+ - More precise error classification and handling
79
+
80
+ - **Dynamic Tool Description**:
81
+ - Display login authentication information based on environment variable configuration
82
+ - Real-time display of allowed request methods and usage instructions
83
+
84
+ #### ๐Ÿ›ก๏ธ Security Enhancements
85
+ - **Request Method Restrictions**: Default only allows GET requests to prevent accidental operations
86
+ - **Login API Exception**: Login APIs can use methods configured in environment variables
87
+ - **Flexible Configuration**: Can open more request methods as needed
88
+
89
+ #### ๐Ÿ“š Documentation Updates
90
+ - Added environment variable configuration instructions
91
+ - Updated API debug tool usage guide
92
+ - Improved login authentication flow documentation
93
+
94
+ ## ๐Ÿš€ Core Advantages
95
+
96
+ ### ๐Ÿ’ฐ Token Cost Optimization
97
+ - **Efficient Context Caching**: By using MCP tools to retrieve short, structured standard data instead of reading long documents, it triggers model Context Caching more effectively (e.g., Gemini 3 Flash), significantly reducing input costs (down to $0.05/1M).
98
+ - **Incremental Output**: Enforces minimal code diffs and precise tool responses, minimizing high-cost output token consumption.
99
+
100
+ ### ๐ŸŽฏ Solving Multi-Machine Development Chaos
101
+ - **Unified Standards**: AI assistants on multiple machines use the same project standards, avoiding inconsistent development styles
102
+ - **Team Collaboration**: Eliminates code style differences caused by different developers using different AI configurations
103
+
104
+ ### ๐Ÿ›ก๏ธ Enterprise-Grade Development Standards Management
105
+ - **Project Information Management**: Unified management of basic project information, tech stack, versions, etc.
106
+ - **API Standards Specification**: Define unified interface design standards to ensure API consistency
107
+ - **Development Standards**: Code style, naming conventions, architecture standards, etc.
108
+ - **Database Standards**: Table structure, naming conventions, indexing strategies, etc.
109
+
110
+ ### ๐Ÿ”ง Simple Configuration Management
111
+ - **JSON Configuration**: Simple configuration storage based on JSON files
112
+ - **Environment Variables**: Support for specifying configuration file paths through environment variables
113
+ - **Auto-Creation**: Automatically creates default configuration files on first run
114
+
115
+ ## โœจ Main Features
116
+
117
+ - โœ… **Project Information Management** - Unified management of project basic information and configuration
118
+ - โœ… **Project Structure Analysis** - Intelligent analysis of project directory structure and dependencies
119
+ - โœ… **API Interface Standards** - Define unified API design specifications and best practices
120
+ - โœ… **Development Standards** - Code style, naming conventions, architecture standards management
121
+ - โœ… **Database Standards** - Table structure design, naming conventions, indexing strategies standardization
122
+ - โœ… **API Debugging Tool** - Complete API interface testing and debugging functionality
123
+ - โœ… **Configuration Management** - JSON-based configuration storage and management
124
+ - โœ… **Auto-Restart** - Intelligent process management and fault recovery
125
+ - โœ… **Health Checks** - Real-time service status and performance monitoring
126
+ - โœ… **File Downloader** - Download files from URLs directly to the project directory
127
+
128
+ ## ๐ŸŽฏ Application Scenarios
129
+
130
+ ### Team Collaborative Development
131
+ - **Multi-Developer Environment**: Ensure each developer's AI assistant follows the same project standards
132
+ - **Code Review**: Unified code style and standards, reducing review time
133
+ - **New Team Member Training**: Quickly help new team members understand project standards and best practices
134
+
135
+ ### Enterprise Projects
136
+ - **Large Projects**: Manage complex project structures and multi-module development
137
+ - **Microservices Architecture**: Unify API design and database standards across services
138
+ - **Multi-Environment Deployment**: Standard consistency across development, testing, and production environments
139
+
140
+ ### AI-Assisted Development
141
+ - **Intelligent Code Generation**: AI generates code that conforms to project standards
142
+ - **Automatic Refactoring**: Automatically optimize and refactor code based on standards
143
+ - **Standards Checking**: Real-time checking of code compliance with project standards
144
+
145
+ ## Installation
146
+
147
+ ### Global Installation (Recommended)
148
+ ```bash
149
+ npm install -g @liangshanli/mcp-server-project-standards
150
+ ```
151
+
152
+ ### Local Installation
153
+ ```bash
154
+ npm install @liangshanli/mcp-server-project-standards
155
+ ```
156
+
157
+ ### From Source
158
+ ```bash
159
+ git clone https://github.com/liliangshan/mcp-server-project-standards.git
160
+ cd mcp-server-project-standards
161
+ npm install
162
+ ```
163
+
164
+ ## โš™๏ธ Configuration Management
165
+
166
+ The server uses the `./.setting/` directory to store configuration files by default. You can specify a different directory using environment variables.
167
+
168
+ ### Environment Variables
169
+
170
+ | Variable | Default | Description | Example |
171
+ |----------|---------|-------------|---------|
172
+ | PROJECT_PATH | . | Root path of the project. Supports both absolute (e.g., `/` or `C:\`) and relative paths. Used to resolve all relative paths. | `export PROJECT_PATH="/path/to/project"` |
173
+ | CONFIG_DIR | ./.setting or ./.setting.<TOOL_PREFIX> | Configuration directory. Resolved relative to PROJECT_PATH. | `export CONFIG_DIR="./config"` |
174
+ | TOOL_PREFIX | | Optional tool prefix for tool names and config isolation | `export TOOL_PREFIX="projA"` |
175
+ | PROJECT_NAME | | Optional project branding for tool descriptions | `export PROJECT_NAME="MyProject"` |
176
+ | API_DEBUG_ALLOWED_METHODS | GET | Control allowed request methods (supports: GET,POST,PUT,DELETE,PATCH, etc.) | `export API_DEBUG_ALLOWED_METHODS="GET,POST"` |
177
+ | API_DEBUG_LOGIN_URL | /api/login | Set login API URL | `export API_DEBUG_LOGIN_URL="/api/auth/login"` |
178
+ | API_DEBUG_LOGIN_METHOD | POST | Set login request method | `export API_DEBUG_LOGIN_METHOD="POST"` |
179
+ | API_DEBUG_LOGIN_BODY | {"username":"","password":""} | Set login request body | `export API_DEBUG_LOGIN_BODY='{"mobile":"","password":""}'` |
180
+ | API_DEBUG_LOGIN_DESCRIPTION | Save returned token to common headers in debug tool, field name Authorization, field value Bearer token | Set login API description | `export API_DEBUG_LOGIN_DESCRIPTION="User Login API"` |
181
+
182
+ ### Configuration Files
183
+
184
+ The server uses two configuration files:
185
+ - `config.json` - Project standards configuration
186
+ - `api.json` - API debugging configuration
187
+
188
+ **config.json default values:**
189
+ ```json
190
+ {
191
+ "project_info": {},
192
+ "project_structure": [],
193
+ "api_standards": {},
194
+ "development_standards": [],
195
+ "database_standards": []
196
+ }
197
+ ```
198
+
199
+ **api.json default values:**
200
+ ```json
201
+ {
202
+ "baseUrl": "",
203
+ "headers": {
204
+ "Content-Type": "application/json",
205
+ "Accept": "application/json"
206
+ },
207
+ "list": []
208
+ }
209
+ ```
210
+
211
+ ### Configuration Field Description
212
+
213
+ **config.json fields:**
214
+ - **project_info** - Project basic information (project name, development language, description, etc.)
215
+ - **project_structure** - Project structure definition (directory and file descriptions)
216
+ - **api_standards** - API interface standards (interface type, response structure, request headers, etc.)
217
+ - **development_standards** - Development standards (code style, naming conventions, etc.)
218
+ - **database_standards** - Database standards (table naming, field naming, etc.)
219
+
220
+ **api.json fields:**
221
+ - **baseUrl** - API base URL
222
+ - **headers** - Common request headers (authentication, Content-Type, etc.)
223
+ - **list** - API interface list (includes request parameters, response data, execution history, etc.)
224
+
225
+ ## ๐Ÿš€ Quick Start
226
+
227
+ ### 1. Direct Run (Global Installation)
228
+ ```bash
229
+ mcp-server-project-standards
230
+ ```
231
+
232
+ ### 2. Using npx (Recommended)
233
+ ```bash
234
+ npx @liangshanli/mcp-server-project-standards
235
+ ```
236
+
237
+ ### 3. Direct Start (Source Installation)
238
+ ```bash
239
+ npm start
240
+ ```
241
+
242
+ ### 4. Managed Start (Recommended for Production)
243
+ ```bash
244
+ npm run start-managed
245
+ ```
246
+
247
+ Managed start provides:
248
+ - Auto-restart (up to 10 times)
249
+ - Error recovery
250
+ - Process management
251
+ - Logging
252
+
253
+ ### 5. Development Mode
254
+ ```bash
255
+ npm run dev
256
+ ```
257
+
258
+ ## Editor Integration
259
+
260
+ ### Cursor Editor Configuration
261
+
262
+ 1) Single-project example (no prefix isolation):
263
+
264
+ ```json
265
+ {
266
+ "mcpServers": {
267
+ "project-standards": {
268
+ "command": "npx",
269
+ "args": ["@liangshanli/mcp-server-project-standards"],
270
+ "env": {
271
+ "PROJECT_PATH": ".",
272
+ "CONFIG_DIR": "./.setting",
273
+ "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
274
+ "API_DEBUG_LOGIN_URL": "/api/login",
275
+ "API_DEBUG_LOGIN_METHOD": "POST",
276
+ "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}",
277
+ "API_DEBUG_LOGIN_DESCRIPTION": "Save returned token to common headers in debug tool, field name Authorization, field value Bearer token"
278
+ }
279
+ }
280
+ }
281
+ }
282
+ ```
283
+
284
+ 2) Multi-project example (with TOOL_PREFIX + PROJECT_NAME):
285
+
286
+ ```json
287
+ {
288
+ "mcpServers": {
289
+ "project-standards-A": {
290
+ "command": "npx",
291
+ "args": ["@liangshanli/mcp-server-project-standards"],
292
+ "env": {
293
+ "PROJECT_PATH": ".",
294
+ "TOOL_PREFIX": "projA",
295
+ "PROJECT_NAME": "Project A",
296
+ "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
297
+ "API_DEBUG_LOGIN_URL": "/api/login",
298
+ "API_DEBUG_LOGIN_METHOD": "POST",
299
+ "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}"
300
+ }
301
+ },
302
+ "project-standards-B": {
303
+ "command": "npx",
304
+ "args": ["@liangshanli/mcp-server-project-standards"],
305
+ "env": {
306
+ "PROJECT_PATH": ".",
307
+ "TOOL_PREFIX": "projB",
308
+ "PROJECT_NAME": "Project B",
309
+ "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
310
+ "API_DEBUG_LOGIN_URL": "/api/auth/login",
311
+ "API_DEBUG_LOGIN_METHOD": "POST",
312
+ "API_DEBUG_LOGIN_BODY": "{\"mobile\":\"\",\"password\":\"\"}"
313
+ }
314
+ }
315
+ }
316
+ }
317
+ ```
318
+
319
+ ### VS Code Configuration
320
+
321
+ 1) Single-project example (no prefix isolation):
322
+
323
+ ```json
324
+ {
325
+ "mcp.servers": {
326
+ "project-standards": {
327
+ "command": "npx",
328
+ "args": ["@liangshanli/mcp-server-project-standards"],
329
+ "env": {
330
+ "PROJECT_PATH": ".",
331
+ "CONFIG_DIR": "./.setting",
332
+ "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
333
+ "API_DEBUG_LOGIN_URL": "/api/login",
334
+ "API_DEBUG_LOGIN_METHOD": "POST",
335
+ "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}"
336
+ }
337
+ }
338
+ }
339
+ }
340
+ ```
341
+
342
+ 2) Multi-project example (with TOOL_PREFIX + PROJECT_NAME):
343
+
344
+ ```json
345
+ {
346
+ "mcp.servers": {
347
+ "project-standards-A": {
348
+ "command": "npx",
349
+ "args": ["@liangshanli/mcp-server-project-standards"],
350
+ "env": {
351
+ "PROJECT_PATH": ".",
352
+ "TOOL_PREFIX": "projA",
353
+ "PROJECT_NAME": "Project A",
354
+ "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
355
+ "API_DEBUG_LOGIN_URL": "/api/login",
356
+ "API_DEBUG_LOGIN_METHOD": "POST",
357
+ "API_DEBUG_LOGIN_BODY": "{\"username\":\"\",\"password\":\"\"}"
358
+ }
359
+ },
360
+ "project-standards-B": {
361
+ "command": "npx",
362
+ "args": ["@liangshanli/mcp-server-project-standards"],
363
+ "env": {
364
+ "PROJECT_PATH": ".",
365
+ "TOOL_PREFIX": "projB",
366
+ "PROJECT_NAME": "Project B",
367
+ "API_DEBUG_ALLOWED_METHODS": "GET,POST,PUT,DELETE",
368
+ "API_DEBUG_LOGIN_URL": "/api/auth/login",
369
+ "API_DEBUG_LOGIN_METHOD": "POST",
370
+ "API_DEBUG_LOGIN_BODY": "{\"mobile\":\"\",\"password\":\"\"}"
371
+ }
372
+ }
373
+ }
374
+ }
375
+ ```
376
+
377
+ ## ๐Ÿ› ๏ธ Available Tools
378
+
379
+ ### 1. Project Information Management (project_info)
380
+ Get and manage project basic information, including project name, development language, description, etc.
381
+
382
+ **Parameters:**
383
+ - `action` (required): Operation type - "get" to retrieve info, "set" to set info
384
+ - `key` (optional): Field to set - "projectName", "developmentLanguage", "basicInfo"
385
+ - `value` (optional): Value to set
386
+
387
+ **Example:**
388
+ ```json
389
+ {
390
+ "jsonrpc": "2.0",
391
+ "id": 1,
392
+ "method": "tools/call",
393
+ "params": {
394
+ "name": "project_info",
395
+ "arguments": {
396
+ "action": "set",
397
+ "key": "projectName",
398
+ "value": "My Project"
399
+ }
400
+ }
401
+ }
402
+ ```
403
+
404
+ ### 2. Project Structure Management (project_structure)
405
+ Get and manage project directory structure with depth control and hidden file inclusion.
406
+
407
+ **Parameters:**
408
+ - `action` (required): Operation type - "get" to retrieve structure, "set" to set structure, "delete" to delete structure item
409
+ - `structure` (optional): Structure item array (required for set action)
410
+ - `path` (optional): Path to delete (required for delete action)
411
+
412
+ **Example:**
413
+ ```json
414
+ {
415
+ "jsonrpc": "2.0",
416
+ "id": 2,
417
+ "method": "tools/call",
418
+ "params": {
419
+ "name": "project_structure",
420
+ "arguments": {
421
+ "action": "set",
422
+ "structure": [
423
+ {
424
+ "path": "/src",
425
+ "description": "Source code directory"
426
+ }
427
+ ]
428
+ }
429
+ }
430
+ }
431
+ ```
432
+
433
+ ### 3. API Standards Management (api_standards)
434
+ Get and manage API interface standards and best practices.
435
+
436
+ **Parameters:**
437
+ - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
438
+ - `key` (optional): Field to set - "interfaceType", "successStructure", "errorStructure", "basicHeaders", "requirements"
439
+ - `value` (optional): Value to set
440
+ - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
441
+
442
+ **Example:**
443
+ ```json
444
+ {
445
+ "jsonrpc": "2.0",
446
+ "id": 3,
447
+ "method": "tools/call",
448
+ "params": {
449
+ "name": "api_standards",
450
+ "arguments": {
451
+ "action": "set",
452
+ "key": "requirements",
453
+ "value": ["Unified response format", "Error code standards", "Parameter validation"],
454
+ "forceOverwrite": true
455
+ }
456
+ }
457
+ }
458
+ ```
459
+
460
+ ### 4. Development Standards Management (development_standards)
461
+ Get and manage development standards, including code style, Git workflow, testing, and documentation.
462
+
463
+ **Parameters:**
464
+ - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
465
+ - `standards` (optional): Standards array (required for set action)
466
+ - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
467
+
468
+ **Example:**
469
+ ```json
470
+ {
471
+ "jsonrpc": "2.0",
472
+ "id": 4,
473
+ "method": "tools/call",
474
+ "params": {
475
+ "name": "development_standards",
476
+ "arguments": {
477
+ "action": "set",
478
+ "standards": ["Use 2 spaces for indentation", "Use single quotes", "Use camelCase naming"],
479
+ "forceOverwrite": false
480
+ }
481
+ }
482
+ }
483
+ ```
484
+
485
+ ### 5. Database Standards Management (database_standards)
486
+ Get and manage database standards, including table structure design, naming conventions, indexing strategies, etc.
487
+
488
+ **Parameters:**
489
+ - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
490
+ - `standards` (optional): Standards array (required for set action)
491
+ - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
492
+
493
+ **Example:**
494
+ ```json
495
+ {
496
+ "jsonrpc": "2.0",
497
+ "id": 5,
498
+ "method": "tools/call",
499
+ "params": {
500
+ "name": "database_standards",
501
+ "arguments": {
502
+ "action": "set",
503
+ "standards": [
504
+ "Use test_ prefix for all table names",
505
+ "Use snake_case for table and field names",
506
+ "Use singular form for table names"
507
+ ],
508
+ "forceOverwrite": true
509
+ }
510
+ }
511
+ }
512
+ ```
513
+
514
+ ### 6. API Debugging Tool (api_debug)
515
+ Complete API interface testing and debugging functionality, supporting multiple HTTP methods, authentication, parameter passing, etc.
516
+
517
+ **Parameters:**
518
+ - `action` (required): Operation type - "get" to retrieve config, "set" to update config, "delete" to delete API, "execute" to execute API, "updateBaseUrl" to update base URL, "updateHeaders" to update headers, "deleteHeader" to delete specific header, "search" to search APIs
519
+ - `config` (optional): API debug configuration (required for set action)
520
+ - `index` (optional): API index (required for execute/delete actions)
521
+ - `baseUrl` (optional): New base URL (required for updateBaseUrl action)
522
+ - `headers` (optional): New headers (required for updateHeaders action)
523
+ - `headerName` (optional): Header name to delete (required for deleteHeader action)
524
+ - `keyword` (optional): Search keyword (required for search action)
525
+
526
+ **Features:**
527
+ - **Smart Content-Type Detection**: Automatically detect request body type (JSON, XML, HTML, URL-encoded, etc.)
528
+ - **Authentication Management**: Support Bearer Token and other authentication methods
529
+ - **URL Deduplication**: Same URL only saves one copy of data, avoiding duplicates
530
+ - **Execution Recording**: Record execution history regardless of success or failure
531
+ - **Search Function**: Support searching APIs by URL or description
532
+ - **Parameter Management**: Support query parameters, request body, custom headers, etc.
533
+
534
+ **๐Ÿ” Special Note - Login Authentication Flow:**
535
+
536
+ The API debugging tool supports a complete login authentication flow, making it easy to manage API access permissions:
537
+
538
+ 1. **Login API Configuration**:
539
+ - First configure the login API (e.g., `/api/login`)
540
+ - Set login request parameters (username, password, etc.)
541
+ - Execute login request to obtain authentication information
542
+
543
+ 2. **Automatic Token Management**:
544
+ - After successful login, the tool automatically extracts returned `token` or `cookie`
545
+ - Automatically writes authentication information to common request headers (e.g., `Authorization: Bearer token`)
546
+ - All subsequent API requests automatically carry authentication information
547
+
548
+ 3. **Authentication Expiration Handling**:
549
+ - When API returns authentication expired error
550
+ - Re-execute the original login API to get new token
551
+ - Use `updateHeaders` operation to update common request headers
552
+ - Continue debugging other APIs that require authentication
553
+
554
+ 4. **Usage Flow Example**:
555
+ ```bash
556
+ # 1. Configure login API
557
+ api_debug set config={login_api_config}
558
+
559
+ # 2. Execute login to get token
560
+ api_debug execute index=0
561
+
562
+ # 3. Update common request headers (automatic)
563
+ api_debug updateHeaders headers={Authorization: Bearer token}
564
+
565
+ # 4. Debug other APIs that require authentication
566
+ api_debug execute index=1
567
+
568
+ # 5. If token expires, re-login
569
+ api_debug execute index=0 # Re-execute login
570
+ ```
571
+
572
+ This design eliminates the need for manual authentication state management, as the tool automatically handles login and token updates, greatly simplifying the API debugging process!
573
+
574
+ ### 7. Directory Listing (list_directory)
575
+ Recursively explores the directory structure relative to the project root.
576
+
577
+ **Parameters:**
578
+ - `path` (optional): Subdirectory path to list.
579
+ - `depth` (optional): Max recursion depth (default: 2).
580
+
581
+ **Example:**
582
+ ```json
583
+ {
584
+ "jsonrpc": "2.0",
585
+ "id": 10,
586
+ "method": "tools/call",
587
+ "params": {
588
+ "name": "list_directory",
589
+ "arguments": {
590
+ "depth": 3
591
+ }
592
+ }
593
+ }
594
+ ```
595
+
596
+ ### 8. Rule Generation (generate_cursorrules / generate_rules)
597
+ Generates AI project guidance files (`.cursorrules` for Cursor, `PROJECT_RULES.md` for others) based on your standards.
598
+
599
+ **Parameters:**
600
+ - `save` (optional): Whether to save content to disk (default: false).
601
+
602
+ **Example:**
603
+ ```json
604
+ {
605
+ "jsonrpc": "2.0",
606
+ "id": 11,
607
+ "method": "tools/call",
608
+ "params": {
609
+ "name": "generate_cursorrules",
610
+ "arguments": {
611
+ "save": true
612
+ }
613
+ }
614
+ }
615
+ ```
616
+
617
+ ### 9. File Download Tool (download_file)
618
+ Download a file from a URL and save it to a specified path within the project.
619
+
620
+ **Parameters:**
621
+ - `url` (required): The URL of the file to download.
622
+ - `savePath` (required): The path where the file should be saved (relative to project path or absolute).
623
+
624
+ **Example:**
625
+ ```json
626
+ {
627
+ "jsonrpc": "2.0",
628
+ "id": 12,
629
+ "method": "tools/call",
630
+ "params": {
631
+ "name": "download_file",
632
+ "arguments": {
633
+ "url": "https://example.com/logo.png",
634
+ "savePath": "assets/logo.png"
635
+ }
636
+ }
637
+ }
638
+ ```
639
+
640
+ ## ๐Ÿ”— Related Tools for Collaborative Use
641
+
642
+ To provide a more complete development experience, we recommend using the following MCP tools in collaboration:
643
+
644
+ ### ๐Ÿ—„๏ธ Database Management Tools
645
+
646
+ **MySQL Database Support**
647
+ - **NPM Package**: [@liangshanli/mcp-server-mysql](https://www.npmjs.com/package/@liangshanli/mcp-server-mysql)
648
+ - **GitHub Repository**: [mcp-server-mysql](https://github.com/liliangshan/mcp-server-mysql)
649
+ - **Features**: DDL operations, permission control, operation logs, connection pool management
650
+ - **Highlights**: Supports DDL SQL logging for easy database structure synchronization
651
+
652
+ **SQL Server Database Support**
653
+ - **NPM Package**: [@liangshanli/mcp-server-mssqlserver](https://www.npmjs.com/package/@liangshanli/mcp-server-mssqlserver)
654
+ - **GitHub Repository**: [mcp-server-mssqlserver](https://github.com/liliangshan/mcp-server-mssqlserver)
655
+ - **Features**: SQL Server database operations, DDL support, permission management
656
+ - **Highlights**: Optimized specifically for SQL Server database operations
657
+
658
+ ### ๐ŸŽจ Icon Management Tools
659
+
660
+ **Icon Resource Management**
661
+ - **NPM Package**: [@liangshanli/mcp-server-icon](https://www.npmjs.com/package/@liangshanli/mcp-server-icon)
662
+ - **GitHub Repository**: [mcp-server-icon](https://github.com/liliangshan/mcp-server-icon)
663
+ - **Features**: Icon resource management, icon search, icon library integration
664
+ - **Highlights**: Supports multiple icon libraries for convenient UI development
665
+
666
+ ### ๐Ÿš€ Collaborative Development Benefits
667
+
668
+ **Complete Development Stack**:
669
+ - **Project Standards** + **Database Management** + **API Debugging** + **Icon Resources** = Full-stack development solution
670
+ - Unified MCP protocol for seamless integration of all tools
671
+ - Consistent configuration management and error handling mechanisms
672
+
673
+ **Team Collaboration**:
674
+ - All tools support unified standards across multi-machine environments
675
+ - Shared configuration files and logging systems
676
+ - Easy onboarding and collaboration for team members
677
+
678
+ **Development Efficiency**:
679
+ - One-stop solution from project standards to database operations to API debugging
680
+ - Reduced tool switching costs and improved development efficiency
681
+ - Unified error handling and logging
682
+
683
+ **Usage Example**:
684
+ ```bash
685
+ # 1. Install project standards management tool
686
+ npm install -g @liangshanli/mcp-server-project-standards
687
+
688
+ # 2. Install database management tools (choose as needed)
689
+ npm install -g @liangshanli/mcp-server-mysql
690
+ # or
691
+ npm install -g @liangshanli/mcp-server-mssqlserver
692
+
693
+ # 3. Install icon management tool
694
+ npm install -g @liangshanli/mcp-server-icon
695
+
696
+ # 4. Configure multiple MCP servers in your editor
697
+ ```
698
+
699
+ **Example:**
700
+
701
+ **Set API Configuration:**
702
+ ```json
703
+ {
704
+ "jsonrpc": "2.0",
705
+ "id": 6,
706
+ "method": "tools/call",
707
+ "params": {
708
+ "name": "api_debug",
709
+ "arguments": {
710
+ "action": "set",
711
+ "config": {
712
+ "baseUrl": "https://api.example.com",
713
+ "headers": {
714
+ "Content-Type": "application/json",
715
+ "Authorization": "Bearer your-token"
716
+ },
717
+ "list": [
718
+ {
719
+ "description": "User Login",
720
+ "url": "/api/login",
721
+ "method": "POST",
722
+ "body": {
723
+ "username": "user",
724
+ "password": "pass"
725
+ }
726
+ }
727
+ ]
728
+ }
729
+ }
730
+ }
731
+ }
732
+ ```
733
+
734
+ **Execute API Request:**
735
+ ```json
736
+ {
737
+ "jsonrpc": "2.0",
738
+ "id": 7,
739
+ "method": "tools/call",
740
+ "params": {
741
+ "name": "api_debug",
742
+ "arguments": {
743
+ "action": "execute",
744
+ "index": 0
745
+ }
746
+ }
747
+ }
748
+ ```
749
+
750
+ **Search API:**
751
+ ```json
752
+ {
753
+ "jsonrpc": "2.0",
754
+ "id": 8,
755
+ "method": "tools/call",
756
+ "params": {
757
+ "name": "api_debug",
758
+ "arguments": {
759
+ "action": "search",
760
+ "keyword": "login"
761
+ }
762
+ }
763
+ }
764
+ ```
765
+
766
+ **Update Authentication Headers:**
767
+ ```json
768
+ {
769
+ "jsonrpc": "2.0",
770
+ "id": 9,
771
+ "method": "tools/call",
772
+ "params": {
773
+ "name": "api_debug",
774
+ "arguments": {
775
+ "action": "updateHeaders",
776
+ "headers": {
777
+ "Authorization": "Bearer new-token"
778
+ }
779
+ }
780
+ }
781
+ }
782
+ ```
783
+
784
+
785
+ ## ๐Ÿ›ก๏ธ Error Handling
786
+
787
+ - Individual request errors don't affect the entire server
788
+ - Configuration errors are automatically recovered
789
+ - Process exceptions are automatically restarted (managed mode)
790
+
791
+ ## ๐Ÿ“ Project Structure
792
+
793
+ ```
794
+ mcp-server-project-standards/
795
+ โ”œโ”€โ”€ src/
796
+ โ”‚ โ”œโ”€โ”€ server-final.js # Main server file
797
+ โ”‚ โ””โ”€โ”€ utils/ # Utility functions directory
798
+ โ”‚ โ”œโ”€โ”€ get_project_info.js # Project information management
799
+ โ”‚ โ”œโ”€โ”€ get_project_structure.js # Project structure management
800
+ โ”‚ โ”œโ”€โ”€ get_api_standards.js # API standards management
801
+ โ”‚ โ”œโ”€โ”€ get_development_standards.js # Development standards management
802
+ โ”‚ โ”œโ”€โ”€ database_standards.js # Database standards management
803
+ โ”‚ โ”œโ”€โ”€ api_debug.js # API debugging tool
804
+ โ”‚ โ””โ”€โ”€ ... # Other tools
805
+ โ”œโ”€โ”€ bin/
806
+ โ”‚ โ””โ”€โ”€ cli.js # CLI startup script
807
+ โ”œโ”€โ”€ start-server.js # Managed startup script
808
+ โ”œโ”€โ”€ package.json
809
+ โ””โ”€โ”€ README.md
810
+ ```
811
+
812
+ ## ๐Ÿงช Testing
813
+
814
+ ```bash
815
+ npm test
816
+ ```
817
+
818
+ ## ๐Ÿ“„ License
819
+
820
+ MIT
821
+
822
+ ## ๐Ÿค Contributing
823
+
824
+ Welcome to submit Issues and Pull Requests to improve this project!
825
+
826
+ ## ๐Ÿ“ž Support
827
+
828
+ If you encounter problems during use, please:
829
+
830
+ 1. Check the [Issues](https://github.com/liliangshan/mcp-server-project-standards/issues) page
831
+ 2. Create a new Issue describing your problem
832
+ 3. Provide detailed error information and reproduction steps
833
+
834
+ ---
835
+
836
+ **Make AI-assisted development more standardized and efficient!** ๐Ÿš€