Skip to content

Commit 506d7f7

Browse files
dimber-caisgeelen
authored andcommitted
Add --no-log argument to make it work with IntelliJ
IntelliJ fails to connect if output is sent to STDERR
1 parent 01e240f commit 506d7f7

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,12 @@ As of version `0.48.0`, Cursor supports unauthed SSE servers directly. If your M
226226

227227
[Official Docs](https://docs.codeium.com/windsurf/mcp). The configuration file is located at `~/.codeium/windsurf/mcp_config.json`.
228228

229+
### JetBrains IntelliJ
230+
231+
IntelliJ supports MCP servers however, you must disable logging (which this package does by default to STDERR). Do this
232+
by adding the `--no-log` argument.
233+
234+
229235
## Building Remote MCP Servers
230236

231237
For instructions on building & deploying remote MCP servers, including acting as a valid OAuth client, see the following resources:

src/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ async function runClient(
158158
}
159159

160160
// Parse command-line arguments and run the client
161-
parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx client.ts <https://server-url> [callback-port] [--debug]')
161+
parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx client.ts <https://server-url> [callback-port] [--debug] [-no-log]')
162162
.then(({ serverUrl, callbackPort, headers, transportStrategy, host, staticOAuthClientMetadata, staticOAuthClientInfo }) => {
163163
return runClient(serverUrl, callbackPort, headers, transportStrategy, host, staticOAuthClientMetadata, staticOAuthClientInfo)
164164
})

src/lib/utils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ const pid = process.pid
3232
// Global debug flag
3333
export let DEBUG = false
3434

35+
// Global no-log flag
36+
export let NO_LOG = false
37+
3538
// Helper function for timestamp formatting
3639
function getTimestamp(): string {
3740
const now = new Date()
@@ -71,6 +74,10 @@ export function debugLog(message: string, ...args: any[]) {
7174
}
7275

7376
export function log(str: string, ...rest: unknown[]) {
77+
if(NO_LOG) {
78+
return
79+
}
80+
7481
// Using stderr so that it doesn't interfere with stdout
7582
console.error(`[${pid}] ${str}`, ...rest)
7683

0 commit comments

Comments
 (0)