@liangshanli/mcp-server-project-standards 1.0.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.
package/README.md ADDED
@@ -0,0 +1,588 @@
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
+ ## ๐Ÿš€ Core Advantages
6
+
7
+ ### ๐ŸŽฏ Solving Multi-Machine Development Chaos
8
+ - **Unified Standards**: AI assistants on multiple machines use the same project standards, avoiding inconsistent development styles
9
+ - **Team Collaboration**: Eliminates code style differences caused by different developers using different AI configurations
10
+
11
+ ### ๐Ÿ›ก๏ธ Enterprise-Grade Development Standards Management
12
+ - **Project Information Management**: Unified management of basic project information, tech stack, versions, etc.
13
+ - **API Standards Specification**: Define unified interface design standards to ensure API consistency
14
+ - **Development Standards**: Code style, naming conventions, architecture standards, etc.
15
+ - **Database Standards**: Table structure, naming conventions, indexing strategies, etc.
16
+
17
+ ### ๐Ÿ”ง Simple Configuration Management
18
+ - **JSON Configuration**: Simple configuration storage based on JSON files
19
+ - **Environment Variables**: Support for specifying configuration file paths through environment variables
20
+ - **Auto-Creation**: Automatically creates default configuration files on first run
21
+
22
+ ## โœจ Main Features
23
+
24
+ - โœ… **Project Information Management** - Unified management of project basic information and configuration
25
+ - โœ… **Project Structure Analysis** - Intelligent analysis of project directory structure and dependencies
26
+ - โœ… **API Interface Standards** - Define unified API design specifications and best practices
27
+ - โœ… **Development Standards** - Code style, naming conventions, architecture standards management
28
+ - โœ… **Database Standards** - Table structure design, naming conventions, indexing strategies standardization
29
+ - โœ… **API Debugging Tool** - Complete API interface testing and debugging functionality
30
+ - โœ… **Configuration Management** - JSON-based configuration storage and management
31
+ - โœ… **Auto-Restart** - Intelligent process management and fault recovery
32
+ - โœ… **Health Checks** - Real-time service status and performance monitoring
33
+
34
+ ## ๐ŸŽฏ Application Scenarios
35
+
36
+ ### Team Collaborative Development
37
+ - **Multi-Developer Environment**: Ensure each developer's AI assistant follows the same project standards
38
+ - **Code Review**: Unified code style and standards, reducing review time
39
+ - **New Team Member Training**: Quickly help new team members understand project standards and best practices
40
+
41
+ ### Enterprise Projects
42
+ - **Large Projects**: Manage complex project structures and multi-module development
43
+ - **Microservices Architecture**: Unify API design and database standards across services
44
+ - **Multi-Environment Deployment**: Standard consistency across development, testing, and production environments
45
+
46
+ ### AI-Assisted Development
47
+ - **Intelligent Code Generation**: AI generates code that conforms to project standards
48
+ - **Automatic Refactoring**: Automatically optimize and refactor code based on standards
49
+ - **Standards Checking**: Real-time checking of code compliance with project standards
50
+
51
+ ## Installation
52
+
53
+ ### Global Installation (Recommended)
54
+ ```bash
55
+ npm install -g @liangshanli/mcp-server-project-standards
56
+ ```
57
+
58
+ ### Local Installation
59
+ ```bash
60
+ npm install @liangshanli/mcp-server-project-standards
61
+ ```
62
+
63
+ ### From Source
64
+ ```bash
65
+ git clone https://github.com/liliangshan/mcp-server-project-standards.git
66
+ cd mcp-server-project-standards
67
+ npm install
68
+ ```
69
+
70
+ ## โš™๏ธ Configuration Management
71
+
72
+ The server uses the `./.setting/` directory to store configuration files by default. You can specify a different directory using environment variables.
73
+
74
+ ### Environment Variables
75
+
76
+ | Variable | Default | Description |
77
+ |----------|---------|-------------|
78
+ | CONFIG_DIR | ./.setting | Configuration file directory (contains config.json and api.json) |
79
+
80
+ ### Configuration Files
81
+
82
+ The server uses two configuration files:
83
+ - `config.json` - Project standards configuration
84
+ - `api.json` - API debugging configuration
85
+
86
+ **config.json default values:**
87
+ ```json
88
+ {
89
+ "project_info": {},
90
+ "project_structure": [],
91
+ "api_standards": {},
92
+ "development_standards": [],
93
+ "database_standards": []
94
+ }
95
+ ```
96
+
97
+ **api.json default values:**
98
+ ```json
99
+ {
100
+ "baseUrl": "",
101
+ "headers": {
102
+ "Content-Type": "application/json",
103
+ "Accept": "application/json"
104
+ },
105
+ "list": []
106
+ }
107
+ ```
108
+
109
+ ### Configuration Field Description
110
+
111
+ **config.json fields:**
112
+ - **project_info** - Project basic information (project name, development language, description, etc.)
113
+ - **project_structure** - Project structure definition (directory and file descriptions)
114
+ - **api_standards** - API interface standards (interface type, response structure, request headers, etc.)
115
+ - **development_standards** - Development standards (code style, naming conventions, etc.)
116
+ - **database_standards** - Database standards (table naming, field naming, etc.)
117
+
118
+ **api.json fields:**
119
+ - **baseUrl** - API base URL
120
+ - **headers** - Common request headers (authentication, Content-Type, etc.)
121
+ - **list** - API interface list (includes request parameters, response data, execution history, etc.)
122
+
123
+ ## ๐Ÿš€ Quick Start
124
+
125
+ ### 1. Direct Run (Global Installation)
126
+ ```bash
127
+ mcp-server-project-standards
128
+ ```
129
+
130
+ ### 2. Using npx (Recommended)
131
+ ```bash
132
+ npx @liangshanli/mcp-server-project-standards
133
+ ```
134
+
135
+ ### 3. Direct Start (Source Installation)
136
+ ```bash
137
+ npm start
138
+ ```
139
+
140
+ ### 4. Managed Start (Recommended for Production)
141
+ ```bash
142
+ npm run start-managed
143
+ ```
144
+
145
+ Managed start provides:
146
+ - Auto-restart (up to 10 times)
147
+ - Error recovery
148
+ - Process management
149
+ - Logging
150
+
151
+ ### 5. Development Mode
152
+ ```bash
153
+ npm run dev
154
+ ```
155
+
156
+ ## Editor Integration
157
+
158
+ ### Cursor Editor Configuration
159
+
160
+ 1. Create `.cursor/mcp.json` file in your project root:
161
+
162
+ ```json
163
+ {
164
+ "mcpServers": {
165
+ "project-standards": {
166
+ "command": "npx",
167
+ "args": ["@liangshanli/mcp-server-project-standards"],
168
+ "env": {
169
+ "CONFIG_DIR": "./.setting"
170
+ }
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ ### VS Code Configuration
177
+
178
+ 1. Install the MCP extension for VS Code
179
+ 2. Create `.vscode/settings.json` file:
180
+
181
+ ```json
182
+ {
183
+ "mcp.servers": {
184
+ "project-standards": {
185
+ "command": "npx",
186
+ "args": ["@liangshanli/mcp-server-project-standards"],
187
+ "env": {
188
+ "CONFIG_DIR": "./.setting"
189
+ }
190
+ }
191
+ }
192
+ }
193
+ ```
194
+
195
+ ## ๐Ÿ› ๏ธ Available Tools
196
+
197
+ ### 1. Project Information Management (project_info)
198
+ Get and manage project basic information, including project name, development language, description, etc.
199
+
200
+ **Parameters:**
201
+ - `action` (required): Operation type - "get" to retrieve info, "set" to set info
202
+ - `key` (optional): Field to set - "projectName", "developmentLanguage", "basicInfo"
203
+ - `value` (optional): Value to set
204
+
205
+ **Example:**
206
+ ```json
207
+ {
208
+ "jsonrpc": "2.0",
209
+ "id": 1,
210
+ "method": "tools/call",
211
+ "params": {
212
+ "name": "project_info",
213
+ "arguments": {
214
+ "action": "set",
215
+ "key": "projectName",
216
+ "value": "My Project"
217
+ }
218
+ }
219
+ }
220
+ ```
221
+
222
+ ### 2. Project Structure Management (project_structure)
223
+ Get and manage project directory structure with depth control and hidden file inclusion.
224
+
225
+ **Parameters:**
226
+ - `action` (required): Operation type - "get" to retrieve structure, "set" to set structure, "delete" to delete structure item
227
+ - `structure` (optional): Structure item array (required for set action)
228
+ - `path` (optional): Path to delete (required for delete action)
229
+
230
+ **Example:**
231
+ ```json
232
+ {
233
+ "jsonrpc": "2.0",
234
+ "id": 2,
235
+ "method": "tools/call",
236
+ "params": {
237
+ "name": "project_structure",
238
+ "arguments": {
239
+ "action": "set",
240
+ "structure": [
241
+ {
242
+ "path": "/src",
243
+ "description": "Source code directory"
244
+ }
245
+ ]
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ ### 3. API Standards Management (api_standards)
252
+ Get and manage API interface standards and best practices.
253
+
254
+ **Parameters:**
255
+ - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
256
+ - `key` (optional): Field to set - "interfaceType", "successStructure", "errorStructure", "basicHeaders", "requirements"
257
+ - `value` (optional): Value to set
258
+ - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
259
+
260
+ **Example:**
261
+ ```json
262
+ {
263
+ "jsonrpc": "2.0",
264
+ "id": 3,
265
+ "method": "tools/call",
266
+ "params": {
267
+ "name": "api_standards",
268
+ "arguments": {
269
+ "action": "set",
270
+ "key": "requirements",
271
+ "value": ["Unified response format", "Error code standards", "Parameter validation"],
272
+ "forceOverwrite": true
273
+ }
274
+ }
275
+ }
276
+ ```
277
+
278
+ ### 4. Development Standards Management (development_standards)
279
+ Get and manage development standards, including code style, Git workflow, testing, and documentation.
280
+
281
+ **Parameters:**
282
+ - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
283
+ - `standards` (optional): Standards array (required for set action)
284
+ - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
285
+
286
+ **Example:**
287
+ ```json
288
+ {
289
+ "jsonrpc": "2.0",
290
+ "id": 4,
291
+ "method": "tools/call",
292
+ "params": {
293
+ "name": "development_standards",
294
+ "arguments": {
295
+ "action": "set",
296
+ "standards": ["Use 2 spaces for indentation", "Use single quotes", "Use camelCase naming"],
297
+ "forceOverwrite": false
298
+ }
299
+ }
300
+ }
301
+ ```
302
+
303
+ ### 5. Database Standards Management (database_standards)
304
+ Get and manage database standards, including table structure design, naming conventions, indexing strategies, etc.
305
+
306
+ **Parameters:**
307
+ - `action` (required): Operation type - "get" to retrieve standards, "set" to set standards, "delete" to delete standards
308
+ - `standards` (optional): Standards array (required for set action)
309
+ - `forceOverwrite` (optional): Whether to force overwrite array values (default: false)
310
+
311
+ **Example:**
312
+ ```json
313
+ {
314
+ "jsonrpc": "2.0",
315
+ "id": 5,
316
+ "method": "tools/call",
317
+ "params": {
318
+ "name": "database_standards",
319
+ "arguments": {
320
+ "action": "set",
321
+ "standards": [
322
+ "Use test_ prefix for all table names",
323
+ "Use snake_case for table and field names",
324
+ "Use singular form for table names"
325
+ ],
326
+ "forceOverwrite": true
327
+ }
328
+ }
329
+ }
330
+ ```
331
+
332
+ ### 6. API Debugging Tool (api_debug)
333
+ Complete API interface testing and debugging functionality, supporting multiple HTTP methods, authentication, parameter passing, etc.
334
+
335
+ **Parameters:**
336
+ - `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
337
+ - `config` (optional): API debug configuration (required for set action)
338
+ - `index` (optional): API index (required for execute/delete actions)
339
+ - `baseUrl` (optional): New base URL (required for updateBaseUrl action)
340
+ - `headers` (optional): New headers (required for updateHeaders action)
341
+ - `headerName` (optional): Header name to delete (required for deleteHeader action)
342
+ - `keyword` (optional): Search keyword (required for search action)
343
+
344
+ **Features:**
345
+ - **Smart Content-Type Detection**: Automatically detect request body type (JSON, XML, HTML, URL-encoded, etc.)
346
+ - **Authentication Management**: Support Bearer Token and other authentication methods
347
+ - **URL Deduplication**: Same URL only saves one copy of data, avoiding duplicates
348
+ - **Execution Recording**: Record execution history regardless of success or failure
349
+ - **Search Function**: Support searching APIs by URL or description
350
+ - **Parameter Management**: Support query parameters, request body, custom headers, etc.
351
+
352
+ **๐Ÿ” Special Note - Login Authentication Flow:**
353
+
354
+ The API debugging tool supports a complete login authentication flow, making it easy to manage API access permissions:
355
+
356
+ 1. **Login API Configuration**:
357
+ - First configure the login API (e.g., `/api/login`)
358
+ - Set login request parameters (username, password, etc.)
359
+ - Execute login request to obtain authentication information
360
+
361
+ 2. **Automatic Token Management**:
362
+ - After successful login, the tool automatically extracts returned `token` or `cookie`
363
+ - Automatically writes authentication information to common request headers (e.g., `Authorization: Bearer token`)
364
+ - All subsequent API requests automatically carry authentication information
365
+
366
+ 3. **Authentication Expiration Handling**:
367
+ - When API returns authentication expired error
368
+ - Re-execute the original login API to get new token
369
+ - Use `updateHeaders` operation to update common request headers
370
+ - Continue debugging other APIs that require authentication
371
+
372
+ 4. **Usage Flow Example**:
373
+ ```bash
374
+ # 1. Configure login API
375
+ api_debug set config={login_api_config}
376
+
377
+ # 2. Execute login to get token
378
+ api_debug execute index=0
379
+
380
+ # 3. Update common request headers (automatic)
381
+ api_debug updateHeaders headers={Authorization: Bearer token}
382
+
383
+ # 4. Debug other APIs that require authentication
384
+ api_debug execute index=1
385
+
386
+ # 5. If token expires, re-login
387
+ api_debug execute index=0 # Re-execute login
388
+ ```
389
+
390
+ 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!
391
+
392
+ ## ๐Ÿ”— Related Tools for Collaborative Use
393
+
394
+ To provide a more complete development experience, we recommend using the following MCP tools in collaboration:
395
+
396
+ ### ๐Ÿ—„๏ธ Database Management Tools
397
+
398
+ **MySQL Database Support**
399
+ - **NPM Package**: [@liangshanli/mcp-server-mysql](https://www.npmjs.com/package/@liangshanli/mcp-server-mysql)
400
+ - **GitHub Repository**: [mcp-server-mysql](https://github.com/liliangshan/mcp-server-mysql)
401
+ - **Features**: DDL operations, permission control, operation logs, connection pool management
402
+ - **Highlights**: Supports DDL SQL logging for easy database structure synchronization
403
+
404
+ **SQL Server Database Support**
405
+ - **NPM Package**: [@liangshanli/mcp-server-mssqlserver](https://www.npmjs.com/package/@liangshanli/mcp-server-mssqlserver)
406
+ - **GitHub Repository**: [mcp-server-mssqlserver](https://github.com/liliangshan/mcp-server-mssqlserver)
407
+ - **Features**: SQL Server database operations, DDL support, permission management
408
+ - **Highlights**: Optimized specifically for SQL Server database operations
409
+
410
+ ### ๐ŸŽจ Icon Management Tools
411
+
412
+ **Icon Resource Management**
413
+ - **NPM Package**: [@liangshanli/mcp-server-icon](https://www.npmjs.com/package/@liangshanli/mcp-server-icon)
414
+ - **GitHub Repository**: [mcp-server-icon](https://github.com/liliangshan/mcp-server-icon)
415
+ - **Features**: Icon resource management, icon search, icon library integration
416
+ - **Highlights**: Supports multiple icon libraries for convenient UI development
417
+
418
+ ### ๐Ÿš€ Collaborative Development Benefits
419
+
420
+ **Complete Development Stack**:
421
+ - **Project Standards** + **Database Management** + **API Debugging** + **Icon Resources** = Full-stack development solution
422
+ - Unified MCP protocol for seamless integration of all tools
423
+ - Consistent configuration management and error handling mechanisms
424
+
425
+ **Team Collaboration**:
426
+ - All tools support unified standards across multi-machine environments
427
+ - Shared configuration files and logging systems
428
+ - Easy onboarding and collaboration for team members
429
+
430
+ **Development Efficiency**:
431
+ - One-stop solution from project standards to database operations to API debugging
432
+ - Reduced tool switching costs and improved development efficiency
433
+ - Unified error handling and logging
434
+
435
+ **Usage Example**:
436
+ ```bash
437
+ # 1. Install project standards management tool
438
+ npm install -g @liangshanli/mcp-server-project-standards
439
+
440
+ # 2. Install database management tools (choose as needed)
441
+ npm install -g @liangshanli/mcp-server-mysql
442
+ # or
443
+ npm install -g @liangshanli/mcp-server-mssqlserver
444
+
445
+ # 3. Install icon management tool
446
+ npm install -g @liangshanli/mcp-server-icon
447
+
448
+ # 4. Configure multiple MCP servers in your editor
449
+ ```
450
+
451
+ **Example:**
452
+
453
+ **Set API Configuration:**
454
+ ```json
455
+ {
456
+ "jsonrpc": "2.0",
457
+ "id": 6,
458
+ "method": "tools/call",
459
+ "params": {
460
+ "name": "api_debug",
461
+ "arguments": {
462
+ "action": "set",
463
+ "config": {
464
+ "baseUrl": "https://api.example.com",
465
+ "headers": {
466
+ "Content-Type": "application/json",
467
+ "Authorization": "Bearer your-token"
468
+ },
469
+ "list": [
470
+ {
471
+ "description": "User Login",
472
+ "url": "/api/login",
473
+ "method": "POST",
474
+ "body": {
475
+ "username": "user",
476
+ "password": "pass"
477
+ }
478
+ }
479
+ ]
480
+ }
481
+ }
482
+ }
483
+ }
484
+ ```
485
+
486
+ **Execute API Request:**
487
+ ```json
488
+ {
489
+ "jsonrpc": "2.0",
490
+ "id": 7,
491
+ "method": "tools/call",
492
+ "params": {
493
+ "name": "api_debug",
494
+ "arguments": {
495
+ "action": "execute",
496
+ "index": 0
497
+ }
498
+ }
499
+ }
500
+ ```
501
+
502
+ **Search API:**
503
+ ```json
504
+ {
505
+ "jsonrpc": "2.0",
506
+ "id": 8,
507
+ "method": "tools/call",
508
+ "params": {
509
+ "name": "api_debug",
510
+ "arguments": {
511
+ "action": "search",
512
+ "keyword": "login"
513
+ }
514
+ }
515
+ }
516
+ ```
517
+
518
+ **Update Authentication Headers:**
519
+ ```json
520
+ {
521
+ "jsonrpc": "2.0",
522
+ "id": 9,
523
+ "method": "tools/call",
524
+ "params": {
525
+ "name": "api_debug",
526
+ "arguments": {
527
+ "action": "updateHeaders",
528
+ "headers": {
529
+ "Authorization": "Bearer new-token"
530
+ }
531
+ }
532
+ }
533
+ }
534
+ ```
535
+
536
+
537
+ ## ๐Ÿ›ก๏ธ Error Handling
538
+
539
+ - Individual request errors don't affect the entire server
540
+ - Configuration errors are automatically recovered
541
+ - Process exceptions are automatically restarted (managed mode)
542
+
543
+ ## ๐Ÿ“ Project Structure
544
+
545
+ ```
546
+ mcp-server-project-standards/
547
+ โ”œโ”€โ”€ src/
548
+ โ”‚ โ”œโ”€โ”€ server-final.js # Main server file
549
+ โ”‚ โ””โ”€โ”€ utils/ # Utility functions directory
550
+ โ”‚ โ”œโ”€โ”€ get_project_info.js # Project information management
551
+ โ”‚ โ”œโ”€โ”€ get_project_structure.js # Project structure management
552
+ โ”‚ โ”œโ”€โ”€ get_api_standards.js # API standards management
553
+ โ”‚ โ”œโ”€โ”€ get_development_standards.js # Development standards management
554
+ โ”‚ โ”œโ”€โ”€ database_standards.js # Database standards management
555
+ โ”‚ โ”œโ”€โ”€ api_debug.js # API debugging tool
556
+ โ”‚ โ””โ”€โ”€ ... # Other tools
557
+ โ”œโ”€โ”€ bin/
558
+ โ”‚ โ””โ”€โ”€ cli.js # CLI startup script
559
+ โ”œโ”€โ”€ start-server.js # Managed startup script
560
+ โ”œโ”€โ”€ package.json
561
+ โ””โ”€โ”€ README.md
562
+ ```
563
+
564
+ ## ๐Ÿงช Testing
565
+
566
+ ```bash
567
+ npm test
568
+ ```
569
+
570
+ ## ๐Ÿ“„ License
571
+
572
+ MIT
573
+
574
+ ## ๐Ÿค Contributing
575
+
576
+ Welcome to submit Issues and Pull Requests to improve this project!
577
+
578
+ ## ๐Ÿ“ž Support
579
+
580
+ If you encounter problems during use, please:
581
+
582
+ 1. Check the [Issues](https://github.com/liliangshan/mcp-server-project-standards/issues) page
583
+ 2. Create a new Issue describing your problem
584
+ 3. Provide detailed error information and reproduction steps
585
+
586
+ ---
587
+
588
+ **Make AI-assisted development more standardized and efficient!** ๐Ÿš€