Skip to content

MCP's don't work because require() is used instead of import #586

Description

@theredwillow
C:\Users\there\OneDrive\Documents\Scripts\- LM Studio\terminal-mcp-server>lms dev
Starting the development server for local/terminal-mcp-server...
[esbuild] build finished, watching for changes...
Error: [stderr] C:\Users\there\OneDrive\Documents\Scripts\- LM Studio\terminal-mcp-server\.lmstudio\entry.ts:1
import { LMStudioClient, type PluginContext } from "@lmstudio/sdk";
                                                   ^

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Users\there\OneDrive\Documents\Scripts\- LM Studio\terminal-mcp-server\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at <anonymous> (C:\Users\there\OneDrive\Documents\Scripts\- LM Studio\terminal-mcp-server\.lmstudio\entry.ts:1:52)
    at ModuleJob.run (node:internal/modules/esm/module_job:430:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:655:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:101:5)

Node.js v25.5.0

I'm not sure if this is even the right repo to report this in. But I can't get MCP's to work in LMStudio and I think it's because this generates .lmstudo/dev.js that uses require.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions