mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-23 20:00:15 +01:00
🚀 feat: Add Code API Proxy Support and Update MCP SDK (#6203)
* chore: bump mcp sdk * feat: Add proxy support for file download and upload in Code Environment CRUD operations * chore: remove unused files * chore: change output format from CommonJS to ES module in server rollup config
This commit is contained in:
parent
780fdf743a
commit
8cb7f34f86
6 changed files with 476 additions and 133 deletions
|
|
@ -9,15 +9,13 @@
|
|||
"exports": {
|
||||
".": {
|
||||
"import": "./dist/index.es.js",
|
||||
"require": "./dist/index.js",
|
||||
"types": "./dist/types/index.d.ts"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"clean": "rimraf dist",
|
||||
"build": "npm run clean && rollup -c --silent --bundleConfigAsCjs",
|
||||
"build:watch": "rollup -c -w",
|
||||
"rollup:api": "npx rollup -c server-rollup.config.js --bundleConfigAsCjs",
|
||||
"build": "npm run clean && rollup -c --configPlugin=@rollup/plugin-typescript",
|
||||
"build:watch": "rollup -c -w --configPlugin=@rollup/plugin-typescript",
|
||||
"test": "jest --coverage --watch",
|
||||
"test:ci": "jest --coverage --ci",
|
||||
"verify": "npm run test:ci",
|
||||
|
|
@ -48,6 +46,7 @@
|
|||
"@rollup/plugin-node-resolve": "^15.1.0",
|
||||
"@rollup/plugin-replace": "^5.0.5",
|
||||
"@rollup/plugin-terser": "^0.4.4",
|
||||
"@rollup/plugin-typescript": "^12.1.2",
|
||||
"@types/diff": "^6.0.0",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/jest": "^29.5.2",
|
||||
|
|
@ -69,7 +68,7 @@
|
|||
"registry": "https://registry.npmjs.org/"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/sdk": "^1.4.1",
|
||||
"@modelcontextprotocol/sdk": "^1.6.1",
|
||||
"diff": "^7.0.0",
|
||||
"eventsource": "^3.0.2",
|
||||
"express": "^4.21.2"
|
||||
|
|
|
|||
|
|
@ -1,18 +1,27 @@
|
|||
// rollup.config.js
|
||||
import typescript from 'rollup-plugin-typescript2';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import pkg from './package.json';
|
||||
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import replace from '@rollup/plugin-replace';
|
||||
import terser from '@rollup/plugin-terser';
|
||||
import { readFileSync } from 'fs';
|
||||
|
||||
const pkg = JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'));
|
||||
|
||||
const plugins = [
|
||||
peerDepsExternal(),
|
||||
resolve(),
|
||||
resolve({
|
||||
preferBuiltins: true,
|
||||
}),
|
||||
replace({
|
||||
__IS_DEV__: process.env.NODE_ENV === 'development',
|
||||
preventAssignment: true,
|
||||
}),
|
||||
commonjs({
|
||||
transformMixedEsModules: true,
|
||||
requireReturnsDefault: 'auto',
|
||||
}),
|
||||
commonjs(),
|
||||
typescript({
|
||||
tsconfig: './tsconfig.json',
|
||||
useTsconfigDeclarationDir: true,
|
||||
|
|
@ -20,27 +29,17 @@ const plugins = [
|
|||
terser(),
|
||||
];
|
||||
|
||||
export default [
|
||||
{
|
||||
input: 'src/index.ts',
|
||||
output: [
|
||||
{
|
||||
file: pkg.main,
|
||||
format: 'cjs',
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
},
|
||||
{
|
||||
file: pkg.module,
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
},
|
||||
],
|
||||
...{
|
||||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})],
|
||||
preserveSymlinks: true,
|
||||
plugins,
|
||||
},
|
||||
const esmBuild = {
|
||||
input: 'src/index.ts',
|
||||
output: {
|
||||
file: pkg.module,
|
||||
format: 'esm',
|
||||
sourcemap: true,
|
||||
exports: 'named',
|
||||
},
|
||||
];
|
||||
external: [...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.devDependencies || {})],
|
||||
preserveSymlinks: true,
|
||||
plugins,
|
||||
};
|
||||
|
||||
export default esmBuild;
|
||||
|
|
|
|||
|
|
@ -1,40 +0,0 @@
|
|||
import path from 'path';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import alias from '@rollup/plugin-alias';
|
||||
import json from '@rollup/plugin-json';
|
||||
|
||||
const rootPath = path.resolve(__dirname, '../../');
|
||||
const rootServerPath = path.resolve(__dirname, '../../api');
|
||||
const entryPath = path.resolve(rootPath, 'api/server/index.js');
|
||||
|
||||
console.log('entryPath', entryPath);
|
||||
|
||||
// Define custom aliases here
|
||||
const customAliases = {
|
||||
entries: [{ find: '~', replacement: rootServerPath }],
|
||||
};
|
||||
|
||||
export default {
|
||||
input: entryPath,
|
||||
output: {
|
||||
file: 'test_bundle/bundle.js',
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [
|
||||
alias(customAliases),
|
||||
resolve({
|
||||
preferBuiltins: true,
|
||||
extensions: ['.js', '.json', '.node'],
|
||||
}),
|
||||
commonjs(),
|
||||
json(),
|
||||
],
|
||||
external: (id) => {
|
||||
// More selective external function
|
||||
if (/node_modules/.test(id)) {
|
||||
return !id.startsWith('langchain/');
|
||||
}
|
||||
return false;
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue