mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-21 21:50:49 +02:00

* 📝 chore: Add comment to clarify purpose of check_updates.sh script
* feat: mcp package
* feat: add librechat-mcp package and update dependencies
* feat: refactor MCPConnectionSingleton to handle transport initialization and connection management
* feat: change private methods to public in MCPConnectionSingleton for improved accessibility
* feat: filesystem demo
* chore: everything demo and move everything under mcp workspace
* chore: move ts-node to mcp workspace
* feat: mcp examples
* feat: working sse MCP example
* refactor: rename MCPConnectionSingleton to MCPConnection for clarity
* refactor: replace MCPConnectionSingleton with MCPConnection for consistency
* refactor: manager/connections
* refactor: update MCPConnection to use type definitions from mcp types
* refactor: update MCPManager to use winston logger and enhance server initialization
* refactor: share logger between connections and manager
* refactor: add schema definitions and update MCPManager to accept logger parameter
* feat: map available MCP tools
* feat: load manifest tools
* feat: add MCP tools delimiter constant and update plugin key generation
* feat: call MCP tools
* feat: update librechat-data-provider version to 0.7.63 and enhance StdioOptionsSchema with additional properties
* refactor: simplify typing
* chore: update types/packages
* feat: MCP Tool Content parsing
* chore: update dependencies and improve package configurations
* feat: add 'mcp' directory to package and update configurations
* refactor: return CONTENT_AND_ARTIFACT format for MCP callTool
* chore: bump @librechat/agents
* WIP: MCP artifacts
* chore: bump @librechat/agents to v1.8.7
* fix: ensure filename has extension when saving base64 image
* fix: move base64 buffer conversion before filename extension check
* chore: update backend review workflow to install MCP package
* fix: use correct `mime` method
* fix: enhance file metadata with message and tool call IDs in image saving process
* fix: refactor ToolCall component to handle MCP tool calls and improve domain extraction
* fix: update ToolItem component for default isInstalled value and improve localization in ToolSelectDialog
* fix: update ToolItem component to use consistent text color for tool description
* style: add theming to ToolSelectDialog
* fix: improve domain extraction logic in ToolCall component
* refactor: conversation item theming, fix rename UI bug, optimize props, add missing types
* feat: enhance MCP options schema with base options (iconPath to start) and make transport type optional, infer based on other option fields
* fix: improve reconnection logic with parallel init and exponential backoff and enhance transport debug logging
* refactor: improve logging format
* refactor: improve logging of available tools by displaying tool names
* refactor: improve reconnection/connection logic
* feat: add MCP package build process to Dockerfile
* feat: add fallback icon for tools without an image in ToolItem component
* feat: Assistants Support for MCP Tools
* fix(build): configure rollup to use output.dir for dynamic imports
* chore: update @librechat/agents to version 1.8.8 and add @langchain/anthropic dependency
* fix: update CONFIG_VERSION to 1.2.0
133 lines
4.3 KiB
JavaScript
133 lines
4.3 KiB
JavaScript
const path = require('path');
|
|
const { execSync } = require('child_process');
|
|
const { askQuestion, isDockerRunning, deleteNodeModules, silentExit } = require('./helpers');
|
|
|
|
const config = {
|
|
bun: process.argv.includes('-b'),
|
|
local: process.argv.includes('-l'),
|
|
docker: process.argv.includes('-d'),
|
|
singleCompose: process.argv.includes('-s'),
|
|
useSudo: process.argv.includes('--sudo'),
|
|
skipGit: process.argv.includes('-g'),
|
|
};
|
|
|
|
// Set the directories
|
|
const rootDir = path.resolve(__dirname, '..');
|
|
const directories = [
|
|
rootDir,
|
|
path.resolve(rootDir, 'packages', 'data-provider'),
|
|
path.resolve(rootDir, 'packages', 'mcp'),
|
|
path.resolve(rootDir, 'client'),
|
|
path.resolve(rootDir, 'api'),
|
|
];
|
|
|
|
async function updateConfigWithWizard() {
|
|
if (!config.docker && !config.singleCompose) {
|
|
config.docker = (await askQuestion('Are you using Docker? (y/n): '))
|
|
.toLowerCase()
|
|
.startsWith('y');
|
|
}
|
|
|
|
if (config.docker && !config.singleCompose) {
|
|
config.singleCompose = !(
|
|
await askQuestion('Are you using the default docker-compose file? (y/n): ')
|
|
)
|
|
.toLowerCase()
|
|
.startsWith('y');
|
|
}
|
|
}
|
|
|
|
async function validateDockerRunning() {
|
|
if (!config.docker && config.singleCompose) {
|
|
config.docker = true;
|
|
}
|
|
|
|
if (config.docker && !isDockerRunning()) {
|
|
console.red(
|
|
'Error: Docker is not running. You will need to start Docker Desktop or if using linux/mac, run `sudo systemctl start docker`',
|
|
);
|
|
silentExit(1);
|
|
}
|
|
}
|
|
|
|
(async () => {
|
|
const showWizard = !config.local && !config.docker && !config.singleCompose;
|
|
|
|
if (showWizard) {
|
|
await updateConfigWithWizard();
|
|
}
|
|
|
|
console.green(
|
|
'Starting update script, this may take a minute or two depending on your system and network.',
|
|
);
|
|
|
|
await validateDockerRunning();
|
|
const { docker, singleCompose, useSudo, skipGit, bun } = config;
|
|
const sudo = useSudo ? 'sudo ' : '';
|
|
if (!skipGit) {
|
|
// Fetch latest repo
|
|
console.purple('Fetching the latest repo...');
|
|
execSync('git fetch origin', { stdio: 'inherit' });
|
|
|
|
// Switch to main branch
|
|
console.purple('Switching to main branch...');
|
|
execSync('git checkout main', { stdio: 'inherit' });
|
|
|
|
// Git pull origin main
|
|
console.purple('Pulling the latest code from main...');
|
|
execSync('git pull origin main', { stdio: 'inherit' });
|
|
}
|
|
|
|
if (docker) {
|
|
console.purple('Removing previously made Docker container...');
|
|
const downCommand = `${sudo}docker compose ${
|
|
singleCompose ? '-f ./docs/dev/single-compose.yml ' : ''
|
|
}down`;
|
|
console.orange(downCommand);
|
|
execSync(downCommand, { stdio: 'inherit' });
|
|
console.purple('Pruning all LibreChat Docker images...');
|
|
|
|
const imageName = singleCompose ? 'librechat_single' : 'librechat';
|
|
try {
|
|
execSync(`${sudo}docker rmi ${imageName}:latest`, { stdio: 'inherit' });
|
|
} catch (e) {
|
|
console.purple('Failed to remove Docker image librechat:latest. It might not exist.');
|
|
}
|
|
console.purple('Removing all unused dangling Docker images...');
|
|
execSync(`${sudo}docker image prune -f`, { stdio: 'inherit' });
|
|
console.purple('Building new LibreChat image...');
|
|
const buildCommand = `${sudo}docker compose ${
|
|
singleCompose ? '-f ./docs/dev/single-compose.yml ' : ''
|
|
}build --no-cache`;
|
|
console.orange(buildCommand);
|
|
execSync(buildCommand, { stdio: 'inherit' });
|
|
} else {
|
|
// Delete all node_modules
|
|
directories.forEach(deleteNodeModules);
|
|
|
|
// Run npm cache clean --force
|
|
console.purple('Cleaning npm cache...');
|
|
execSync('npm cache clean --force', { stdio: 'inherit' });
|
|
|
|
// Install dependencies
|
|
console.purple('Installing dependencies...');
|
|
execSync('npm ci', { stdio: 'inherit' });
|
|
|
|
// Build client-side code
|
|
console.purple('Building frontend...');
|
|
execSync(bun ? 'bun b:client' : 'npm run frontend', { stdio: 'inherit' });
|
|
}
|
|
|
|
let startCommand = 'npm run backend';
|
|
if (docker) {
|
|
startCommand = `${sudo}docker compose ${
|
|
singleCompose ? '-f ./docs/dev/single-compose.yml ' : ''
|
|
}up`;
|
|
}
|
|
console.green('Your LibreChat app is now up to date! Start the app with the following command:');
|
|
console.purple(startCommand);
|
|
console.orange(
|
|
'Note: it\'s also recommended to clear your browser cookies and localStorage for LibreChat to assure a fully clean installation.',
|
|
);
|
|
console.orange('Also: Don\'t worry, your data is safe :)');
|
|
})();
|