Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 41 additions & 2 deletions nodes/McpClient/McpClient.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,18 @@ export class McpClient implements INodeType {
default: 'cmd',
description: 'Choose the transport type to connect to MCP server',
},
{
displayName: 'Uri Override',
name: 'uriOverride',
type: 'string',
displayOptions: {
show: {
connectionType: ['sse', 'http'],
},
},
default: '',
description: 'Override the URL from credentials with a custom URL',
},
{
displayName: 'Operation',
name: 'operation',
Expand Down Expand Up @@ -220,7 +232,21 @@ export class McpClient implements INodeType {
// Dynamically import the HTTP client
const { StreamableHTTPClientTransport } = await import('@modelcontextprotocol/sdk/client/streamableHttp.js');

const httpStreamUrl = httpCredentials.httpStreamUrl as string;
// Get URI override or use credentials URL
const uriOverride = this.getNodeParameter('uriOverride', 0) as string;
let httpStreamUrl: string;

if (uriOverride && uriOverride.trim()) {
try {
// Validate URL format
new URL(uriOverride.trim());
httpStreamUrl = uriOverride.trim();
} catch (error) {
throw new NodeOperationError(this.getNode(), `Invalid URI override format: ${uriOverride}`);
}
} else {
httpStreamUrl = httpCredentials.httpStreamUrl as string;
}
const messagesPostEndpoint = (httpCredentials.messagesPostEndpoint as string) || '';
timeout = httpCredentials.httpTimeout as number || 60000;

Expand Down Expand Up @@ -258,7 +284,20 @@ export class McpClient implements INodeType {
// Dynamically import the SSE client to avoid TypeScript errors
const { SSEClientTransport } = await import('@modelcontextprotocol/sdk/client/sse.js');

const sseUrl = sseCredentials.sseUrl as string;
// Get URI override or use credentials URL
const uriOverride = this.getNodeParameter('uriOverride', 0) as string;
let sseUrl: string;
if (uriOverride && uriOverride.trim()) {
try {
// Validate URL format
new URL(uriOverride.trim());
sseUrl = uriOverride.trim();
} catch (error) {
throw new NodeOperationError(this.getNode(), `Invalid URI override format: ${uriOverride}`);
}
} else {
sseUrl = sseCredentials.sseUrl as string;
}
const messagesPostEndpoint = (sseCredentials.messagesPostEndpoint as string) || '';
timeout = sseCredentials.sseTimeout as number || 60000;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "n8n-nodes-mcp",
"version": "0.1.29",
"version": "0.1.30",
"description": "MCP nodes for n8n ",
"keywords": [
"n8n-community-node-package",
Expand Down