17
scripts/build.sh
Archivo ejecutable
17
scripts/build.sh
Archivo ejecutable
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🔨 Building MCP ProcFS Server..."
|
||||
|
||||
# Clean previous build
|
||||
rm -rf dist/
|
||||
|
||||
# Compile TypeScript
|
||||
tsc
|
||||
|
||||
# Make CLI files executable
|
||||
chmod +x dist/cli.js
|
||||
chmod +x dist/cli-sse.js
|
||||
|
||||
echo "✅ Build complete!"
|
||||
echo "Output: dist/"
|
||||
31
scripts/release.sh
Archivo ejecutable
31
scripts/release.sh
Archivo ejecutable
@@ -0,0 +1,31 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
VERSION=$1
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Usage: ./scripts/release.sh <version>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🚀 Releasing version $VERSION..."
|
||||
|
||||
# Run tests
|
||||
echo "Running tests..."
|
||||
npm test
|
||||
|
||||
# Build
|
||||
echo "Building..."
|
||||
npm run build
|
||||
|
||||
# Update version
|
||||
npm version "$VERSION" -m "Release v%s"
|
||||
|
||||
# Publish
|
||||
echo "Publishing to npm..."
|
||||
npm publish
|
||||
|
||||
# Push tags
|
||||
git push --follow-tags
|
||||
|
||||
echo "✅ Released version $VERSION!"
|
||||
46
scripts/setup.sh
Archivo ejecutable
46
scripts/setup.sh
Archivo ejecutable
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "🚀 Setting up MCP ProcFS Server..."
|
||||
|
||||
# Check Node.js version
|
||||
NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1)
|
||||
if [ "$NODE_VERSION" -lt 18 ]; then
|
||||
echo "❌ Node.js 18 or higher is required"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ Node.js version check passed"
|
||||
|
||||
# Install dependencies
|
||||
echo "📦 Installing dependencies..."
|
||||
npm install
|
||||
|
||||
# Build the project
|
||||
echo "🔨 Building TypeScript..."
|
||||
npm run build
|
||||
|
||||
# Check if running on Linux
|
||||
if [ "$(uname)" != "Linux" ]; then
|
||||
echo "⚠️ Warning: This server is designed for Linux systems"
|
||||
echo " Some features may not work on $(uname)"
|
||||
fi
|
||||
|
||||
# Check permissions
|
||||
if [ ! -r /proc/cpuinfo ]; then
|
||||
echo "❌ Cannot read /proc filesystem"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "✓ /proc filesystem accessible"
|
||||
|
||||
echo ""
|
||||
echo "✅ Setup complete!"
|
||||
echo ""
|
||||
echo "To start the server:"
|
||||
echo " npm start # JSON-RPC server (stdio)"
|
||||
echo " npm run start:sse # HTTP server with SSE"
|
||||
echo ""
|
||||
echo "For development:"
|
||||
echo " npm run dev # Watch mode"
|
||||
echo ""
|
||||
104
scripts/verify-install.js
Archivo ejecutable
104
scripts/verify-install.js
Archivo ejecutable
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Installation verification script
|
||||
*/
|
||||
|
||||
const { execSync } = require('child_process');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
console.log('🔍 Verifying MCP ProcFS Server Installation...\n');
|
||||
|
||||
const checks = [];
|
||||
|
||||
// Check Node.js version
|
||||
try {
|
||||
const nodeVersion = process.version;
|
||||
const majorVersion = parseInt(nodeVersion.split('.')[0].replace('v', ''));
|
||||
if (majorVersion >= 18) {
|
||||
checks.push({ name: 'Node.js version', status: '✓', message: nodeVersion });
|
||||
} else {
|
||||
checks.push({ name: 'Node.js version', status: '✗', message: `${nodeVersion} (requires >= 18)` });
|
||||
}
|
||||
} catch (error) {
|
||||
checks.push({ name: 'Node.js version', status: '✗', message: error.message });
|
||||
}
|
||||
|
||||
// Check if on Linux
|
||||
const platform = process.platform;
|
||||
if (platform === 'linux') {
|
||||
checks.push({ name: 'Operating System', status: '✓', message: 'Linux' });
|
||||
} else {
|
||||
checks.push({ name: 'Operating System', status: '⚠', message: `${platform} (designed for Linux)` });
|
||||
}
|
||||
|
||||
// Check procfs accessibility
|
||||
try {
|
||||
fs.accessSync('/proc/cpuinfo', fs.constants.R_OK);
|
||||
checks.push({ name: '/proc filesystem', status: '✓', message: 'Accessible' });
|
||||
} catch (error) {
|
||||
checks.push({ name: '/proc filesystem', status: '✗', message: 'Not accessible' });
|
||||
}
|
||||
|
||||
// Check if built
|
||||
const distPath = path.join(__dirname, '..', 'dist');
|
||||
if (fs.existsSync(distPath)) {
|
||||
const files = fs.readdirSync(distPath);
|
||||
if (files.length > 0) {
|
||||
checks.push({ name: 'TypeScript build', status: '✓', message: 'Compiled' });
|
||||
} else {
|
||||
checks.push({ name: 'TypeScript build', status: '✗', message: 'Empty dist folder' });
|
||||
}
|
||||
} else {
|
||||
checks.push({ name: 'TypeScript build', status: '✗', message: 'Run npm run build' });
|
||||
}
|
||||
|
||||
// Check dependencies
|
||||
const packageJsonPath = path.join(__dirname, '..', 'package.json');
|
||||
if (fs.existsSync(packageJsonPath)) {
|
||||
const nodeModulesPath = path.join(__dirname, '..', 'node_modules');
|
||||
if (fs.existsSync(nodeModulesPath)) {
|
||||
checks.push({ name: 'Dependencies', status: '✓', message: 'Installed' });
|
||||
} else {
|
||||
checks.push({ name: 'Dependencies', status: '✗', message: 'Run npm install' });
|
||||
}
|
||||
}
|
||||
|
||||
// Check for sysctl (optional)
|
||||
try {
|
||||
execSync('which sysctl', { stdio: 'pipe' });
|
||||
checks.push({ name: 'sysctl utility', status: '✓', message: 'Available' });
|
||||
} catch (error) {
|
||||
checks.push({ name: 'sysctl utility', status: '⚠', message: 'Not found (optional)' });
|
||||
}
|
||||
|
||||
// Print results
|
||||
console.log('Installation Status:');
|
||||
console.log('='.repeat(60));
|
||||
checks.forEach(check => {
|
||||
console.log(`${check.status} ${check.name.padEnd(25)} ${check.message}`);
|
||||
});
|
||||
console.log('='.repeat(60));
|
||||
|
||||
// Summary
|
||||
const passed = checks.filter(c => c.status === '✓').length;
|
||||
const total = checks.length;
|
||||
const warnings = checks.filter(c => c.status === '⚠').length;
|
||||
const failed = checks.filter(c => c.status === '✗').length;
|
||||
|
||||
console.log(`\n✓ Passed: ${passed}/${total}`);
|
||||
if (warnings > 0) console.log(`⚠ Warnings: ${warnings}`);
|
||||
if (failed > 0) console.log(`✗ Failed: ${failed}`);
|
||||
|
||||
if (failed === 0) {
|
||||
console.log('\n✅ Installation verified successfully!');
|
||||
console.log('\nNext steps:');
|
||||
console.log(' npm start # Start JSON-RPC server');
|
||||
console.log(' npm run start:sse # Start HTTP/SSE server');
|
||||
console.log(' npm test # Run tests');
|
||||
process.exit(0);
|
||||
} else {
|
||||
console.log('\n❌ Installation has issues. Please fix the failed checks above.');
|
||||
process.exit(1);
|
||||
}
|
||||
Referencia en una nueva incidencia
Block a user