Columbia MCP Server
by smithery-ai
- COLUMBIA-MCP-SERVERS
- scripts
#!/bin/bash
# Check if required arguments are provided
if [ "$#" -lt 2 ]; then
echo "Usage: $0 <source_path> <server_type> [server_name]"
echo "Example: $0 /path/to/server ai minimax"
echo "Server types: ai, data, tools"
exit 1
fi
SOURCE_PATH=$1
SERVER_TYPE=$2
SERVER_NAME=${3:-$(basename "$SOURCE_PATH")}
# Validate server type
case $SERVER_TYPE in
ai|data|tools)
;;
*)
echo "Invalid server type. Must be one of: ai, data, tools"
exit 1
;;
esac
# Set target directory
TARGET_DIR="services/$SERVER_TYPE/$SERVER_NAME"
# Create target directory
mkdir -p "$TARGET_DIR"
# Copy files
echo "Copying files from $SOURCE_PATH to $TARGET_DIR..."
cp -r "$SOURCE_PATH"/* "$TARGET_DIR/"
# Remove build artifacts and node_modules
rm -rf "$TARGET_DIR/build" "$TARGET_DIR/dist" "$TARGET_DIR/node_modules"
# Update package.json
if [ -f "$TARGET_DIR/package.json" ]; then
echo "Updating package.json..."
# Use node to modify package.json
node -e "
const fs = require('fs');
const path = require('path');
const pkg = require('./$TARGET_DIR/package.json');
// Update package name
pkg.name = '@columbia-mcp/$SERVER_TYPE-$SERVER_NAME';
// Update version to 1.0.0 if not already set
if (!pkg.version) pkg.version = '1.0.0';
// Ensure private is set
pkg.private = true;
// Add workspace-specific scripts
pkg.scripts = {
...pkg.scripts,
build: 'tsc',
test: 'jest',
lint: 'eslint src/**/*.ts',
clean: 'rimraf build dist'
};
// Write updated package.json
fs.writeFileSync(
path.join(process.cwd(), '$TARGET_DIR/package.json'),
JSON.stringify(pkg, null, 2)
);
"
fi
# Create tsconfig.json if it doesn't exist
if [ ! -f "$TARGET_DIR/tsconfig.json" ]; then
echo "Creating tsconfig.json..."
echo '{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "./build",
"rootDir": "./src"
},
"include": ["src/**/*"],
"exclude": ["**/*.test.ts", "**/*.spec.ts"]
}' > "$TARGET_DIR/tsconfig.json"
fi
# Create jest.config.js if it doesn't exist
if [ ! -f "$TARGET_DIR/jest.config.js" ]; then
echo "Creating jest.config.js..."
echo "/** @type {import('jest').Config} */
const config = {
preset: 'ts-jest',
testEnvironment: 'node',
verbose: true,
transform: {
'^.+\\.ts$': ['ts-jest', { useESM: true }]
},
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1'
},
extensionsToTreatAsEsm: ['.ts']
};
export default config;" > "$TARGET_DIR/jest.config.js"
fi
# Create README.md if it doesn't exist
if [ ! -f "$TARGET_DIR/README.md" ]; then
echo "Creating README.md..."
echo "# @columbia-mcp/$SERVER_TYPE-$SERVER_NAME
Part of the Columbia MCP Servers collection.
## Installation
\`\`\`bash
npm install
\`\`\`
## Usage
\`\`\`typescript
import { YourServer } from '@columbia-mcp/$SERVER_TYPE-$SERVER_NAME';
\`\`\`
## Development
\`\`\`bash
# Build
npm run build
# Test
npm test
# Lint
npm run lint
\`\`\`
" > "$TARGET_DIR/README.md"
fi
echo "Migration complete! Server migrated to $TARGET_DIR"
echo "Next steps:"
echo "1. Review and update dependencies in package.json"
echo "2. Update import paths in source files"
echo "3. Run 'npm install' in the root directory"
echo "4. Run tests to verify the migration"