fa-mcp-sdk 0.2.204 → 0.2.206
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/bin/fa-mcp.js
CHANGED
|
@@ -835,7 +835,7 @@ certificate's public and private keys`,
|
|
|
835
835
|
async replaceTemplateParameters (config) {
|
|
836
836
|
const targetPath = config.projectAbsPath;
|
|
837
837
|
const files = await this.getAllFiles(targetPath, ALLOWED_FILES);
|
|
838
|
-
const importRe = /'[^']+\/core\/index.js'
|
|
838
|
+
const importRe = /'[^']+\/core\/index.js'/ig;
|
|
839
839
|
for (const filePath of files) {
|
|
840
840
|
let content = await fs.readFile(filePath, 'utf8');
|
|
841
841
|
let modified = false;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ESLint Auto-Fix Hook for Claude Code
|
|
5
|
+
* Automatically formats JS/TS files after Write/Edit operations
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const { execSync } = require('child_process');
|
|
11
|
+
|
|
12
|
+
const LOG_FILE = path.join(__dirname, 'log.log');
|
|
13
|
+
const IS_LOG = process.env.CLAUDE_HOOK_LOG === 'true';
|
|
14
|
+
|
|
15
|
+
function log (message) {
|
|
16
|
+
if (IS_LOG) {
|
|
17
|
+
const timestamp = new Date().toISOString();
|
|
18
|
+
const line = `[${timestamp}] ${message}\n`;
|
|
19
|
+
fs.appendFileSync(LOG_FILE, line);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function main () {
|
|
24
|
+
let input = '';
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
// Read JSON input from stdin
|
|
28
|
+
input = fs.readFileSync(0, 'utf-8');
|
|
29
|
+
log(`Input received:\n====\n${input.substring(0, 200)}...\n====\n`);
|
|
30
|
+
|
|
31
|
+
const data = JSON.parse(input);
|
|
32
|
+
const filePath = data?.tool_input?.file_path;
|
|
33
|
+
|
|
34
|
+
if (!filePath) {
|
|
35
|
+
log('No file_path found in input');
|
|
36
|
+
process.exit(0);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
log(`File path: ${filePath}`);
|
|
40
|
+
|
|
41
|
+
// Check if file extension is .js or .ts
|
|
42
|
+
if (!/\.(js|ts)$/.test(filePath)) {
|
|
43
|
+
log(`Skipping non-JS/TS file: ${filePath}`);
|
|
44
|
+
process.exit(0);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// Exclude files in node_modules, dist, coverage, etc.
|
|
48
|
+
const excludePatterns = [
|
|
49
|
+
/node_modules/,
|
|
50
|
+
/[/\\]dist[/\\]/,
|
|
51
|
+
/[/\\]coverage[/\\]/,
|
|
52
|
+
/\.d\.ts$/,
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
for (const pattern of excludePatterns) {
|
|
56
|
+
if (pattern.test(filePath)) {
|
|
57
|
+
log(`Skipping excluded path: ${filePath}`);
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Get project directory from environment
|
|
63
|
+
const projectDir = process.env.CLAUDE_PROJECT_DIR;
|
|
64
|
+
|
|
65
|
+
if (!projectDir) {
|
|
66
|
+
log('CLAUDE_PROJECT_DIR not set');
|
|
67
|
+
process.exit(0);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
log(`Project dir: ${projectDir}`);
|
|
71
|
+
|
|
72
|
+
// Change to project directory
|
|
73
|
+
process.chdir(projectDir);
|
|
74
|
+
|
|
75
|
+
// Run eslint --fix on the file
|
|
76
|
+
log(`Running ESLint on: ${filePath}`);
|
|
77
|
+
|
|
78
|
+
try {
|
|
79
|
+
const output = execSync(`npx eslint --fix "${filePath}"`, {
|
|
80
|
+
encoding: 'utf-8',
|
|
81
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
82
|
+
});
|
|
83
|
+
log(`ESLint output: ${output || '(empty)'}`);
|
|
84
|
+
console.log(`🔧 Formatted: ${filePath}`);
|
|
85
|
+
console.log('✅ Formatted successfully');
|
|
86
|
+
} catch (eslintError) {
|
|
87
|
+
// ESLint returns non-zero on warnings/errors but file is still fixed
|
|
88
|
+
log(`ESLint warnings/errors: ${eslintError.message}`);
|
|
89
|
+
console.log(`⚠️ ESLint warnings/errors (file still saved)`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
} catch (error) {
|
|
93
|
+
log(`Error: ${error.message}\nStack: ${error.stack}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Always exit 0 to not block Claude's operations
|
|
97
|
+
process.exit(0);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
main();
|
|
@@ -28,6 +28,19 @@
|
|
|
28
28
|
"DISABLE_COST_WARNINGS": "0",
|
|
29
29
|
"DISABLE_TELEMETRY": "0"
|
|
30
30
|
},
|
|
31
|
+
"hooks": {
|
|
32
|
+
"PostToolUse": [
|
|
33
|
+
{
|
|
34
|
+
"matcher": "Write|Edit",
|
|
35
|
+
"hooks": [
|
|
36
|
+
{
|
|
37
|
+
"type": "command",
|
|
38
|
+
"command": "node .claude/hooks/eslint-fix.cjs"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
},
|
|
31
44
|
"hasCompletedOnboarding": true,
|
|
32
45
|
"hasTrustDialogAccepted": true,
|
|
33
46
|
"hasCompletedProjectOnboarding": true,
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
The FA-MCP-SDK is a comprehensive TypeScript framework for building Model Context
|
|
5
|
+
The FA-MCP-SDK is a comprehensive TypeScript framework for building Model Context
|
|
6
|
+
Protocol (MCP) servers. This is the documentation index - read the relevant
|
|
7
|
+
sections based on your task.
|
|
6
8
|
|
|
7
9
|
## Using with Claude Code
|
|
8
10
|
|
|
9
|
-
This project includes a specialized agent `.claude/agents/fa-mcp-sdk.md` for
|
|
11
|
+
This project includes a specialized agent `.claude/agents/fa-mcp-sdk.md` for
|
|
12
|
+
Claude Code. The agent automatically reads relevant documentation sections and
|
|
13
|
+
follows SDK patterns.
|
|
10
14
|
|
|
11
15
|
### Example Prompts
|
|
12
16
|
|
|
@@ -39,7 +43,8 @@ Use the fa-mcp-sdk subagent to create an MCP server for managing TODO lists with
|
|
|
39
43
|
- REST API for web client
|
|
40
44
|
```
|
|
41
45
|
|
|
42
|
-
The agent will read the appropriate documentation files and implement the
|
|
46
|
+
The agent will read the appropriate documentation files and implement the
|
|
47
|
+
functionality following SDK conventions.
|
|
43
48
|
|
|
44
49
|
## Quick Start
|
|
45
50
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fa-mcp-sdk",
|
|
3
3
|
"productName": "FA MCP SDK",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.206",
|
|
5
5
|
"description": "Core infrastructure and templates for building Model Context Protocol (MCP) servers with TypeScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/core/index.js",
|