@azure/mcp-template 0.0.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/LICENSE +21 -0
- package/README.md +1 -0
- package/index.js +103 -0
- package/package.json +46 -0
- package/scripts/post-install-script.js +13 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Microsoft Template MCP Server
|
package/index.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const os = require('os')
|
|
4
|
+
|
|
5
|
+
// Check if DEBUG environment variable is set
|
|
6
|
+
const isDebugMode = process.env.DEBUG && (
|
|
7
|
+
process.env.DEBUG.toLowerCase() === 'true' ||
|
|
8
|
+
process.env.DEBUG.includes('azure-mcp') ||
|
|
9
|
+
process.env.DEBUG === '*'
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
// Helper function for debug logging
|
|
13
|
+
function debugLog(...args) {
|
|
14
|
+
if (isDebugMode) {
|
|
15
|
+
console.error(...args)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
debugLog('\nWrapper package starting')
|
|
20
|
+
debugLog('All args:')
|
|
21
|
+
process.argv.forEach((val, index) => {
|
|
22
|
+
debugLog(`${index}: ${val}`)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const platform = os.platform()
|
|
26
|
+
const arch = os.arch()
|
|
27
|
+
|
|
28
|
+
const platformPackageName = `@azure/mcp-${platform}-${arch}`
|
|
29
|
+
|
|
30
|
+
// Try to load the platform package
|
|
31
|
+
let platformPackage
|
|
32
|
+
try {
|
|
33
|
+
debugLog(`Attempting to require platform package: ${platformPackageName}`)
|
|
34
|
+
platformPackage = require(platformPackageName)
|
|
35
|
+
} catch (err) {
|
|
36
|
+
debugLog(`Failed to require ${platformPackageName}, attempting auto-install: ${err.message}`)
|
|
37
|
+
|
|
38
|
+
// Try to automatically install the missing platform package
|
|
39
|
+
try {
|
|
40
|
+
const { execSync } = require('child_process')
|
|
41
|
+
|
|
42
|
+
console.error(`Installing missing platform package: ${platformPackageName}`)
|
|
43
|
+
|
|
44
|
+
// Try to install the platform package
|
|
45
|
+
try {
|
|
46
|
+
execSync(`npm install ${platformPackageName}@latest`, {
|
|
47
|
+
stdio: ['inherit', 'inherit', 'pipe'], // Only pipe stderr to capture errors
|
|
48
|
+
timeout: 60000 // 60 second timeout
|
|
49
|
+
})
|
|
50
|
+
} catch (npmErr) {
|
|
51
|
+
// If npm install fails, try with --no-save and different install strategies
|
|
52
|
+
debugLog(`npm install failed, trying alternative installation methods: ${npmErr.message}`)
|
|
53
|
+
|
|
54
|
+
// Try with --no-save and --prefer-online
|
|
55
|
+
execSync(`npm install ${platformPackageName}@latest --no-save --prefer-online`, {
|
|
56
|
+
stdio: ['inherit', 'inherit', 'pipe'],
|
|
57
|
+
timeout: 60000
|
|
58
|
+
})
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Clear module cache and try to require again after installation
|
|
62
|
+
Object.keys(require.cache).forEach(key => {
|
|
63
|
+
if (key.includes(platformPackageName)) {
|
|
64
|
+
delete require.cache[key]
|
|
65
|
+
}
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
platformPackage = require(platformPackageName)
|
|
69
|
+
|
|
70
|
+
console.error(`ā
Successfully installed and loaded ${platformPackageName}`)
|
|
71
|
+
|
|
72
|
+
} catch (installErr) {
|
|
73
|
+
debugLog(`Auto-install failed: ${installErr.message}`)
|
|
74
|
+
|
|
75
|
+
console.error(`\nā Failed to load platform specific package '${platformPackageName}'`)
|
|
76
|
+
console.error(`\nš Troubleshooting steps:`)
|
|
77
|
+
console.error(`\n1. Clear npm cache and reinstall:`)
|
|
78
|
+
console.error(` npm cache clean --force`)
|
|
79
|
+
console.error(` npm uninstall -g @azure/mcp`)
|
|
80
|
+
console.error(` npm install -g @azure/mcp@latest`)
|
|
81
|
+
console.error(`\n2. If using npx, clear the cache:`)
|
|
82
|
+
console.error(` npx clear-npx-cache`)
|
|
83
|
+
console.error(` npx -y @azure/mcp@latest server start`)
|
|
84
|
+
console.error(`\n3. Manually install the platform package:`)
|
|
85
|
+
console.error(` npm install ${platformPackageName}@latest`)
|
|
86
|
+
console.error(`\n4. Check your internet connection and try again`)
|
|
87
|
+
console.error(`\n5. If the issue persists, please report it at:`)
|
|
88
|
+
console.error(` https://github.com/Azure/azure-mcp/issues`)
|
|
89
|
+
console.error(`\nOriginal error: ${err.message}`)
|
|
90
|
+
console.error(`Install error: ${installErr.message}`)
|
|
91
|
+
process.exit(1)
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
platformPackage.runExecutable(process.argv.slice(2))
|
|
96
|
+
.then((code) => {
|
|
97
|
+
debugLog(`Process exited with code: ${code}`)
|
|
98
|
+
process.exit(code)
|
|
99
|
+
})
|
|
100
|
+
.catch((err) => {
|
|
101
|
+
console.error(`Error: ${err.message}`)
|
|
102
|
+
process.exit(1)
|
|
103
|
+
})
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@azure/mcp-template",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Template MCP Server - Basic Model Context Protocol implementation",
|
|
5
|
+
"author": "Microsoft Corporation",
|
|
6
|
+
"homepage": "https://github.com/Microsoft/mcp/blob/main/servers/Azure.Mcp.Server#readme",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"azure",
|
|
10
|
+
"mcp",
|
|
11
|
+
"model-context-protocol"
|
|
12
|
+
],
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/microsoft/mcp/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"url": "https://github.com/microsoft/mcp.git",
|
|
18
|
+
"type": "git"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20.0.0"
|
|
22
|
+
},
|
|
23
|
+
"bin": {
|
|
24
|
+
"mcptmp": "./index.js"
|
|
25
|
+
},
|
|
26
|
+
"os": [
|
|
27
|
+
"linux",
|
|
28
|
+
"darwin",
|
|
29
|
+
"win32"
|
|
30
|
+
],
|
|
31
|
+
"cpu": [
|
|
32
|
+
"arm64",
|
|
33
|
+
"x64"
|
|
34
|
+
],
|
|
35
|
+
"optionalDependencies": {
|
|
36
|
+
"@azure/mcp-template-linux-arm64": "0.0.1",
|
|
37
|
+
"@azure/mcp-template-linux-x64": "0.0.1",
|
|
38
|
+
"@azure/mcp-template-darwin-arm64": "0.0.1",
|
|
39
|
+
"@azure/mcp-template-darwin-x64": "0.0.1",
|
|
40
|
+
"@azure/mcp-template-win32-arm64": "0.0.1",
|
|
41
|
+
"@azure/mcp-template-win32-x64": "0.0.1"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"postinstall": "node ./scripts/post-install-script.js"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const os = require('os');
|
|
2
|
+
|
|
3
|
+
const platform = os.platform();
|
|
4
|
+
const arch = os.arch();
|
|
5
|
+
|
|
6
|
+
const requiredPackage = `@azure/mcp-${platform}-${arch}`;
|
|
7
|
+
|
|
8
|
+
try {
|
|
9
|
+
require.resolve(requiredPackage);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
console.error(`Missing required package: '${requiredPackage}'`);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|