- Replace ISC license with Sustainable Use License v1.0 - Add LICENSE_FAQ.md explaining the fair-code approach - Update package.json with new license identifier - Add license headers to main entry point files - Update README with clear license usage guidelines Following n8n's licensing approach, this provides: - Free use for internal business purposes - Free use for personal/non-commercial projects - Restrictions on hosting as a service - Protection against commercial exploitation No .ee. mechanism implemented yet - all features remain freely available under the single license. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
101 lines
3.0 KiB
JavaScript
101 lines
3.0 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* n8n Documentation MCP Server
|
|
* Copyright (c) 2025 n8n-mcp contributors
|
|
*
|
|
* This software is licensed under the Sustainable Use License.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
import dotenv from 'dotenv';
|
|
import { N8NDocumentationRemoteServer } from './mcp/remote-server';
|
|
import { logger } from './utils/logger';
|
|
import * as path from 'path';
|
|
|
|
// Load environment variables
|
|
dotenv.config();
|
|
|
|
async function main() {
|
|
try {
|
|
// Get configuration from environment
|
|
const config = {
|
|
port: parseInt(process.env.MCP_PORT || '3000', 10),
|
|
host: process.env.MCP_HOST || '0.0.0.0',
|
|
domain: process.env.MCP_DOMAIN || 'localhost',
|
|
authToken: process.env.MCP_AUTH_TOKEN,
|
|
cors: process.env.MCP_CORS === 'true',
|
|
tlsCert: process.env.MCP_TLS_CERT,
|
|
tlsKey: process.env.MCP_TLS_KEY,
|
|
};
|
|
|
|
// Validate required configuration
|
|
if (!config.domain || config.domain === 'localhost') {
|
|
logger.warn('MCP_DOMAIN not set or set to localhost. Using default: localhost');
|
|
logger.warn('For production, set MCP_DOMAIN to your actual domain (e.g., n8ndocumentation.aiservices.pl)');
|
|
}
|
|
|
|
if (!config.authToken) {
|
|
logger.warn('MCP_AUTH_TOKEN not set. Server will run without authentication.');
|
|
logger.warn('For production, set MCP_AUTH_TOKEN to a secure value.');
|
|
}
|
|
|
|
// Set database path if not already set
|
|
if (!process.env.NODE_DB_PATH) {
|
|
process.env.NODE_DB_PATH = path.join(__dirname, '../data/nodes-v2.db');
|
|
}
|
|
|
|
logger.info('Starting n8n Documentation MCP Remote Server');
|
|
logger.info('Configuration:', {
|
|
port: config.port,
|
|
host: config.host,
|
|
domain: config.domain,
|
|
cors: config.cors,
|
|
authEnabled: !!config.authToken,
|
|
tlsEnabled: !!(config.tlsCert && config.tlsKey),
|
|
databasePath: process.env.NODE_DB_PATH,
|
|
});
|
|
|
|
const server = new N8NDocumentationRemoteServer(config);
|
|
|
|
// Start the server
|
|
await server.start();
|
|
|
|
// Handle graceful shutdown
|
|
const shutdown = async () => {
|
|
logger.info('Received shutdown signal');
|
|
await server.stop();
|
|
process.exit(0);
|
|
};
|
|
|
|
process.on('SIGINT', shutdown);
|
|
process.on('SIGTERM', shutdown);
|
|
|
|
logger.info('Server is ready to accept connections');
|
|
logger.info(`Claude Desktop configuration:`);
|
|
logger.info(JSON.stringify({
|
|
"mcpServers": {
|
|
"n8n-nodes-remote": {
|
|
"command": "curl",
|
|
"args": [
|
|
"-X", "POST",
|
|
"-H", "Content-Type: application/json",
|
|
"-H", `Authorization: Bearer ${config.authToken || 'YOUR_AUTH_TOKEN'}`,
|
|
"-d", "@-",
|
|
`https://${config.domain}/mcp`
|
|
],
|
|
"env": {}
|
|
}
|
|
}
|
|
}, null, 2));
|
|
|
|
} catch (error) {
|
|
logger.error('Failed to start server:', error);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
|
|
// Run the server
|
|
main().catch((error) => {
|
|
logger.error('Unhandled error:', error);
|
|
process.exit(1);
|
|
}); |