src / index.ts
// The LM Studio plugin's entry point. LM Studio runs main() once when the plugin starts.
// The MCP server for other setups starts from main.ts instead.
import type { PluginContext } from "@lmstudio/sdk";
import { globalConfigSchematics, preprocess, stopSession, toolsProvider } from "./plugin";
export async function main(context: PluginContext): Promise<void> {
context.withGlobalConfigSchematics(globalConfigSchematics);
context.withPromptPreprocessor(preprocess);
context.withToolsProvider(toolsProvider);
process.once("SIGTERM", () => {
void stopSession().finally(() => process.exit(0));
});
}
src / index.ts
// The LM Studio plugin's entry point. LM Studio runs main() once when the plugin starts.
// The MCP server for other setups starts from main.ts instead.
import type { PluginContext } from "@lmstudio/sdk";
import { globalConfigSchematics, preprocess, stopSession, toolsProvider } from "./plugin";
export async function main(context: PluginContext): Promise<void> {
context.withGlobalConfigSchematics(globalConfigSchematics);
context.withPromptPreprocessor(preprocess);
context.withToolsProvider(toolsProvider);
process.once("SIGTERM", () => {
void stopSession().finally(() => process.exit(0));
});
}