From 88113899cdbf6520960195a74547e0f7d05f8426 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Tue, 6 May 2025 11:13:50 +1000 Subject: [PATCH 01/22] Adding (via mcp-remote ) to clientInfo.name on initialize --- .github/workflows/publish.yml | 11 ++++------- package.json | 1 - src/lib/utils.ts | 15 +++++++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dd32058..c58f197 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,14 +15,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - run: corepack enable - - uses: actions/setup-node@v4 + - name: Setup pnpm & install + uses: wyvox/action-setup-pnpm@v3 with: - node-version: 20 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install + node-version: 22 + pnpm-version: 10 - name: Build run: pnpm build diff --git a/package.json b/package.json index 2d65086..ba21bf7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "mcp-remote", "version": "0.1.2", - "packageManager": "pnpm@8.15.1", "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth", "keywords": [ "mcp", diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c88a08b..e86aaac 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -32,14 +32,21 @@ export function mcpProxy({ transportToClient, transportToServer }: { transportTo let transportToClientClosed = false let transportToServerClosed = false - transportToClient.onmessage = (message) => { - // @ts-expect-error TODO + transportToClient.onmessage = (_message) => { + // TODO: fix types + const message = _message as any log('[Local→Remote]', message.method || message.id) + if (message.method === 'initialize') { + const { clientInfo } = message.params + if (clientInfo) clientInfo.name = `${clientInfo.name} (via mcp-remote ${MCP_REMOTE_VERSION})` + log(JSON.stringify(message, null, 2)) + } transportToServer.send(message).catch(onServerError) } - transportToServer.onmessage = (message) => { - // @ts-expect-error TODO: fix this type + transportToServer.onmessage = (_message) => { + // TODO: fix types + const message = _message as any log('[Remote→Local]', message.method || message.id) transportToClient.send(message).catch(onClientError) } From 45c1739b4c849575458565c8f5feb746c917fc64 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Tue, 6 May 2025 11:13:50 +1000 Subject: [PATCH 02/22] Adding (via mcp-remote ) to clientInfo.name on initialize --- .github/workflows/publish.yml | 11 ++++------- package.json | 1 - src/lib/utils.ts | 15 +++++++++++---- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dd32058..c58f197 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,14 +15,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - run: corepack enable - - uses: actions/setup-node@v4 + - name: Setup pnpm & install + uses: wyvox/action-setup-pnpm@v3 with: - node-version: 20 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install + node-version: 22 + pnpm-version: 10 - name: Build run: pnpm build diff --git a/package.json b/package.json index 2d65086..ba21bf7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,6 @@ { "name": "mcp-remote", "version": "0.1.2", - "packageManager": "pnpm@8.15.1", "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth", "keywords": [ "mcp", diff --git a/src/lib/utils.ts b/src/lib/utils.ts index c88a08b..e86aaac 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -32,14 +32,21 @@ export function mcpProxy({ transportToClient, transportToServer }: { transportTo let transportToClientClosed = false let transportToServerClosed = false - transportToClient.onmessage = (message) => { - // @ts-expect-error TODO + transportToClient.onmessage = (_message) => { + // TODO: fix types + const message = _message as any log('[Local→Remote]', message.method || message.id) + if (message.method === 'initialize') { + const { clientInfo } = message.params + if (clientInfo) clientInfo.name = `${clientInfo.name} (via mcp-remote ${MCP_REMOTE_VERSION})` + log(JSON.stringify(message, null, 2)) + } transportToServer.send(message).catch(onServerError) } - transportToServer.onmessage = (message) => { - // @ts-expect-error TODO: fix this type + transportToServer.onmessage = (_message) => { + // TODO: fix types + const message = _message as any log('[Remote→Local]', message.method || message.id) transportToClient.send(message).catch(onClientError) } From 63e02eef1c11aa4f218ab94906f3ac1e05591198 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Tue, 6 May 2025 09:00:58 +1000 Subject: [PATCH 03/22] Use 127.0.0.1 everywhere _except_ as a redirect_uri for the client registration --- src/lib/node-oauth-client-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/node-oauth-client-provider.ts b/src/lib/node-oauth-client-provider.ts index 1e58b7e..806f3af 100644 --- a/src/lib/node-oauth-client-provider.ts +++ b/src/lib/node-oauth-client-provider.ts @@ -37,7 +37,7 @@ export class NodeOAuthClientProvider implements OAuthClientProvider { } get redirectUrl(): string { - return `http://127.0.0.1:${this.options.callbackPort}${this.callbackPath}` + return `http://localhost:${this.options.callbackPort}${this.callbackPath}` } get clientMetadata() { From 46e33334164cb75be0b6490f205a7c87e0ae775c Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Mon, 12 May 2025 15:27:57 +1000 Subject: [PATCH 04/22] 0.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ba21bf7..77a21a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcp-remote", - "version": "0.1.2", + "version": "0.1.3", "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth", "keywords": [ "mcp", From 767549412f79bd92d85f07a3c9dfe4f8a2f0cf7b Mon Sep 17 00:00:00 2001 From: Tomer Zait Date: Tue, 6 May 2025 19:00:33 +0300 Subject: [PATCH 05/22] fix issue #64 --- src/lib/utils.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index e86aaac..572550c 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -484,6 +484,11 @@ export function setupSignalHandlers(cleanup: () => Promise) { // Keep the process alive process.stdin.resume() + process.stdin.on('end', async () => { + log('\nShutting down...') + await cleanup() + process.exit(0) + }) } /** From bd75a1cdf026bed04e03ce097293124028c329f1 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Mon, 12 May 2025 15:37:49 +1000 Subject: [PATCH 06/22] 0.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 77a21a4..4c7a40d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcp-remote", - "version": "0.1.3", + "version": "0.1.4", "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth", "keywords": [ "mcp", From b209d98074bc680d0bda58ee61075dcbaf4d9026 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barthelet?= Date: Tue, 13 May 2025 15:25:49 +0200 Subject: [PATCH 07/22] Add port sourcing from existing client information --- src/lib/utils.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 572550c..1f60c5e 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -3,6 +3,7 @@ import { Client } from '@modelcontextprotocol/sdk/client/index.js' import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js' import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js' import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js' +import { OAuthClientInformationFull, OAuthClientInformationFullSchema } from '@modelcontextprotocol/sdk/shared/auth.js' // Connection constants export const REASON_AUTH_NEEDED = 'authentication-needed' @@ -11,6 +12,7 @@ export const REASON_TRANSPORT_FALLBACK = 'falling-back-to-alternate-transport' // Transport strategy types export type TransportStrategy = 'sse-only' | 'http-only' | 'sse-first' | 'http-first' import { OAuthCallbackServerOptions } from './types' +import { readJsonFile } from './mcp-auth-config' import express from 'express' import net from 'net' import crypto from 'crypto' @@ -352,6 +354,21 @@ export function setupOAuthCallbackServer(options: OAuthCallbackServerOptions) { return { server, authCode, waitForAuthCode } } +async function findExistingClientPort(serverUrl: string): Promise { + const serverUrlHash = getServerUrlHash(serverUrl) + const clientInfo = await readJsonFile(serverUrlHash, 'client_info.json', OAuthClientInformationFullSchema) + if (!clientInfo) { + return undefined + } + + const localhostRedirectUri = clientInfo.redirect_uris.map((uri) => new URL(uri)).find(({ hostname }) => hostname === 'localhost') + if (!localhostRedirectUri) { + throw new Error('Cannot find localhost callback URI from existing client information') + } + + return parseInt(localhostRedirectUri.port) +} + /** * Finds an available port on the local machine * @param preferredPort Optional preferred port to try first @@ -440,11 +457,14 @@ export async function parseCommandLineArgs(args: string[], defaultPort: number, process.exit(1) } - // Use the specified port, or find an available one - const callbackPort = specifiedPort || (await findAvailablePort(defaultPort)) + // Use the specified port, or the existing client port or fallback to find an available one + const [existingClientPort, availablePort] = await Promise.all([findExistingClientPort(serverUrl), findAvailablePort(defaultPort)]) + const callbackPort = specifiedPort || existingClientPort || availablePort if (specifiedPort) { log(`Using specified callback port: ${callbackPort}`) + } else if (existingClientPort) { + log(`Using existing client port: ${existingClientPort}`) } else { log(`Using automatically selected callback port: ${callbackPort}`) } From bd6df4222f5bdeaccadad2691c9404b90233ca34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Barthelet?= Date: Tue, 13 May 2025 15:26:18 +0200 Subject: [PATCH 08/22] Fix schema on clientInformation() --- src/lib/node-oauth-client-provider.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/lib/node-oauth-client-provider.ts b/src/lib/node-oauth-client-provider.ts index 806f3af..0826844 100644 --- a/src/lib/node-oauth-client-provider.ts +++ b/src/lib/node-oauth-client-provider.ts @@ -1,9 +1,8 @@ import open from 'open' import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js' import { - OAuthClientInformation, OAuthClientInformationFull, - OAuthClientInformationSchema, + OAuthClientInformationFullSchema, OAuthTokens, OAuthTokensSchema, } from '@modelcontextprotocol/sdk/shared/auth.js' @@ -57,9 +56,9 @@ export class NodeOAuthClientProvider implements OAuthClientProvider { * Gets the client information if it exists * @returns The client information or undefined */ - async clientInformation(): Promise { + async clientInformation(): Promise { // log('Reading client info') - return readJsonFile(this.serverUrlHash, 'client_info.json', OAuthClientInformationSchema) + return readJsonFile(this.serverUrlHash, 'client_info.json', OAuthClientInformationFullSchema) } /** From e5cdf08bc88616d4b80b04fdd7f553d6169d07fc Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Wed, 14 May 2025 20:53:40 +1000 Subject: [PATCH 09/22] Updated SDK version --- package.json | 2 +- pnpm-lock.yaml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 4c7a40d..1f87b70 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "open": "^10.1.0" }, "devDependencies": { - "@modelcontextprotocol/sdk": "^1.10.2", + "@modelcontextprotocol/sdk": "^1.11.2", "@types/express": "^5.0.0", "@types/node": "^22.13.10", "prettier": "^3.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a987cf4..d0720bf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -16,8 +16,8 @@ importers: version: 10.1.0 devDependencies: '@modelcontextprotocol/sdk': - specifier: ^1.10.2 - version: 1.10.2 + specifier: ^1.11.2 + version: 1.11.2 '@types/express': specifier: ^5.0.0 version: 5.0.0 @@ -211,8 +211,8 @@ packages: '@jridgewell/trace-mapping@0.3.25': resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} - '@modelcontextprotocol/sdk@1.10.2': - resolution: {integrity: sha512-rb6AMp2DR4SN+kc6L1ta2NCpApyA9WYNx3CrTSZvGxq9wH71bRur+zRqPfg0vQ9mjywR7qZdX2RGHOPq3ss+tA==} + '@modelcontextprotocol/sdk@1.11.2': + resolution: {integrity: sha512-H9vwztj5OAqHg9GockCQC06k1natgcxWQSRpQcPJf6i5+MWBzfKkRtxGbjQf0X2ihii0ffLZCRGbYV2f2bjNCQ==} engines: {node: '>=18'} '@pkgjs/parseargs@0.11.0': @@ -1206,7 +1206,7 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.0 - '@modelcontextprotocol/sdk@1.10.2': + '@modelcontextprotocol/sdk@1.11.2': dependencies: content-type: 1.0.5 cors: 2.8.5 From 6f2399bbfb149d80ba41542cbeebf8d05ef45745 Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Wed, 14 May 2025 21:10:35 +1000 Subject: [PATCH 10/22] remove client info on conflict --- src/lib/utils.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 1f60c5e..f5d4df0 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -12,10 +12,11 @@ export const REASON_TRANSPORT_FALLBACK = 'falling-back-to-alternate-transport' // Transport strategy types export type TransportStrategy = 'sse-only' | 'http-only' | 'sse-first' | 'http-first' import { OAuthCallbackServerOptions } from './types' -import { readJsonFile } from './mcp-auth-config' +import { getConfigFilePath, readJsonFile } from './mcp-auth-config' import express from 'express' import net from 'net' import crypto from 'crypto' +import fs from 'fs/promises' // Package version from package.json export const MCP_REMOTE_VERSION = require('../../package.json').version @@ -459,14 +460,23 @@ export async function parseCommandLineArgs(args: string[], defaultPort: number, // Use the specified port, or the existing client port or fallback to find an available one const [existingClientPort, availablePort] = await Promise.all([findExistingClientPort(serverUrl), findAvailablePort(defaultPort)]) - const callbackPort = specifiedPort || existingClientPort || availablePort + let callbackPort: number if (specifiedPort) { - log(`Using specified callback port: ${callbackPort}`) + if (existingClientPort && specifiedPort !== existingClientPort) { + log( + `Warning! Specified callback port of ${specifiedPort}, which conflicts with existing client registration port ${existingClientPort}. Deleting existing client data to force reregistration.`, + ) + await fs.rm(getConfigFilePath(getServerUrlHash(serverUrl), 'client_info.json')) + } + log(`Using specified callback port: ${specifiedPort}`) + callbackPort = specifiedPort } else if (existingClientPort) { log(`Using existing client port: ${existingClientPort}`) + callbackPort = existingClientPort } else { - log(`Using automatically selected callback port: ${callbackPort}`) + log(`Using automatically selected callback port: ${availablePort}`) + callbackPort = availablePort } if (Object.keys(headers).length > 0) { From b1dfa9fe5b17f5e9642ef73da2ce7259a43e1acc Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Wed, 14 May 2025 21:21:38 +1000 Subject: [PATCH 11/22] Picking a default port based on the server hash --- src/client.ts | 2 +- src/lib/utils.ts | 31 +++++++++++++++++++------------ src/proxy.ts | 2 +- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/client.ts b/src/client.ts index 4e0c14c..d87599c 100644 --- a/src/client.ts +++ b/src/client.ts @@ -151,7 +151,7 @@ async function runClient( } // Parse command-line arguments and run the client -parseCommandLineArgs(process.argv.slice(2), 3333, 'Usage: npx tsx client.ts [callback-port]') +parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx client.ts [callback-port]') .then(({ serverUrl, callbackPort, headers, transportStrategy }) => { return runClient(serverUrl, callbackPort, headers, transportStrategy) }) diff --git a/src/lib/utils.ts b/src/lib/utils.ts index f5d4df0..a0a60dc 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -4,6 +4,12 @@ import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js' import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js' import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js' import { OAuthClientInformationFull, OAuthClientInformationFullSchema } from '@modelcontextprotocol/sdk/shared/auth.js' +import { OAuthCallbackServerOptions } from './types' +import { getConfigFilePath, readJsonFile } from './mcp-auth-config' +import express from 'express' +import net from 'net' +import crypto from 'crypto' +import fs from 'fs/promises' // Connection constants export const REASON_AUTH_NEEDED = 'authentication-needed' @@ -11,12 +17,6 @@ export const REASON_TRANSPORT_FALLBACK = 'falling-back-to-alternate-transport' // Transport strategy types export type TransportStrategy = 'sse-only' | 'http-only' | 'sse-first' | 'http-first' -import { OAuthCallbackServerOptions } from './types' -import { getConfigFilePath, readJsonFile } from './mcp-auth-config' -import express from 'express' -import net from 'net' -import crypto from 'crypto' -import fs from 'fs/promises' // Package version from package.json export const MCP_REMOTE_VERSION = require('../../package.json').version @@ -355,8 +355,7 @@ export function setupOAuthCallbackServer(options: OAuthCallbackServerOptions) { return { server, authCode, waitForAuthCode } } -async function findExistingClientPort(serverUrl: string): Promise { - const serverUrlHash = getServerUrlHash(serverUrl) +async function findExistingClientPort(serverUrlHash: string): Promise { const clientInfo = await readJsonFile(serverUrlHash, 'client_info.json', OAuthClientInformationFullSchema) if (!clientInfo) { return undefined @@ -370,6 +369,13 @@ async function findExistingClientPort(serverUrl: string): Promise /** * Parses command line arguments for MCP clients and proxies * @param args Command line arguments - * @param defaultPort Default port for the callback server if specified port is unavailable * @param usage Usage message to show on error * @returns A promise that resolves to an object with parsed serverUrl, callbackPort and headers */ -export async function parseCommandLineArgs(args: string[], defaultPort: number, usage: string) { +export async function parseCommandLineArgs(args: string[], usage: string) { // Process headers const headers: Record = {} let i = 0 @@ -457,9 +462,11 @@ export async function parseCommandLineArgs(args: string[], defaultPort: number, log(usage) process.exit(1) } + const serverUrlHash = getServerUrlHash(serverUrl) + const defaultPort = calculateDefaultPort(serverUrlHash) // Use the specified port, or the existing client port or fallback to find an available one - const [existingClientPort, availablePort] = await Promise.all([findExistingClientPort(serverUrl), findAvailablePort(defaultPort)]) + const [existingClientPort, availablePort] = await Promise.all([findExistingClientPort(serverUrlHash), findAvailablePort(defaultPort)]) let callbackPort: number if (specifiedPort) { @@ -467,7 +474,7 @@ export async function parseCommandLineArgs(args: string[], defaultPort: number, log( `Warning! Specified callback port of ${specifiedPort}, which conflicts with existing client registration port ${existingClientPort}. Deleting existing client data to force reregistration.`, ) - await fs.rm(getConfigFilePath(getServerUrlHash(serverUrl), 'client_info.json')) + await fs.rm(getConfigFilePath(serverUrlHash, 'client_info.json')) } log(`Using specified callback port: ${specifiedPort}`) callbackPort = specifiedPort diff --git a/src/proxy.ts b/src/proxy.ts index 7263a95..535bfe2 100644 --- a/src/proxy.ts +++ b/src/proxy.ts @@ -135,7 +135,7 @@ to the CA certificate file. If using claude_desktop_config.json, this might look } // Parse command-line arguments and run the proxy -parseCommandLineArgs(process.argv.slice(2), 3334, 'Usage: npx tsx proxy.ts [callback-port]') +parseCommandLineArgs(process.argv.slice(2), 'Usage: npx tsx proxy.ts [callback-port]') .then(({ serverUrl, callbackPort, headers, transportStrategy }) => { return runProxy(serverUrl, callbackPort, headers, transportStrategy) }) From 5199279ea7b427237d74848b784b0f43cf434a8b Mon Sep 17 00:00:00 2001 From: Glen Maddern Date: Wed, 14 May 2025 21:24:02 +1000 Subject: [PATCH 12/22] 0.1.5 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1f87b70..b7f3f7f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mcp-remote", - "version": "0.1.4", + "version": "0.1.5", "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth", "keywords": [ "mcp", From 7eecc9ca3f388a24c0deb0c526fee3aedc74edb6 Mon Sep 17 00:00:00 2001 From: Will <76718650+the-wc@users.noreply.github.com> Date: Wed, 14 May 2025 11:49:34 -0700 Subject: [PATCH 13/22] Update README.md Move `env` into mcpServer configuration. The examples have it placed outside. If you don't pay attention, you'll end up wondering why you have empty `env` being passed through. --- README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bc70b15..bc0a4a7 100644 --- a/README.md +++ b/README.md @@ -46,11 +46,11 @@ To bypass authentication, or to emit custom headers on all requests to your remo "https://remote.mcp.server/sse", "--header", "Authorization: Bearer ${AUTH_TOKEN}" - ] + ], + "env": { + "AUTH_TOKEN": "..." + } }, - "env": { - "AUTH_TOKEN": "..." - } } } ``` @@ -65,11 +65,11 @@ To bypass authentication, or to emit custom headers on all requests to your remo "https://remote.mcp.server/sse", "--header", "Authorization:${AUTH_HEADER}" // note no spaces around ':' - ] + ], + "env": { + "AUTH_HEADER": "Bearer " // spaces OK in env vars + } }, -"env": { - "AUTH_HEADER": "Bearer " // spaces OK in env vars -} ``` ### Flags From 8f83b189665a8e194c9e2bedae2dffe94f97adb3 Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:00:50 +0200 Subject: [PATCH 14/22] adjust ci --- .github/workflows/publish.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c58f197..0b903a1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,11 +1,12 @@ name: Publish Any Commit on: + workflow_dispatch: pull_request: push: branches: - "**" tags: - - "!**" + - "v*" jobs: build: From 675dc6a76008de59a2ec97a030dc813ce2be8577 Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:01:58 +0200 Subject: [PATCH 15/22] fix tool path --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0b903a1..38e9871 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Setup pnpm & install - uses: wyvox/action-setup-pnpm@v3 + uses: https://github.com/wyvox/action-setup-pnpm@v3 with: node-version: 22 pnpm-version: 10 From 4f6de14fbc3f9deaf0a891dda6ed9440bb6bba3e Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:10:14 +0200 Subject: [PATCH 16/22] add packageManager --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index b7f3f7f..32c140e 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "express": "^4.21.2", "open": "^10.1.0" }, + "packageManager": "pnpm@7.1.7", "devDependencies": { "@modelcontextprotocol/sdk": "^1.11.2", "@types/express": "^5.0.0", From 0213c20d3d2eb252a6cd03872568f04f12755670 Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:11:17 +0200 Subject: [PATCH 17/22] update pnpm --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 32c140e..111afce 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "express": "^4.21.2", "open": "^10.1.0" }, - "packageManager": "pnpm@7.1.7", + "packageManager": "pnpm@10", "devDependencies": { "@modelcontextprotocol/sdk": "^1.11.2", "@types/express": "^5.0.0", From 27907a4624bc2786fd5f8020ef675affc5a9e57f Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:12:39 +0200 Subject: [PATCH 18/22] wip --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 111afce..bb4062c 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "express": "^4.21.2", "open": "^10.1.0" }, - "packageManager": "pnpm@10", + "packageManager": "pnpm@10.11.0", "devDependencies": { "@modelcontextprotocol/sdk": "^1.11.2", "@types/express": "^5.0.0", From a7a76d3f1777ebb05dc5bc2ac88d7f07364d1ef0 Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:18:21 +0200 Subject: [PATCH 19/22] wip --- package.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index bb4062c..3820e75 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,10 @@ "express": "^4.21.2", "open": "^10.1.0" }, - "packageManager": "pnpm@10.11.0", + "engines": { + "node": ">=10", + "pnpm": ">=10" + }, "devDependencies": { "@modelcontextprotocol/sdk": "^1.11.2", "@types/express": "^5.0.0", From d8ce2745068160bf86b79e66ed6cb12c0111908a Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:23:07 +0200 Subject: [PATCH 20/22] wip --- .github/workflows/publish.yml | 1 - package.json | 5 +---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 38e9871..6527995 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,7 +20,6 @@ jobs: uses: https://github.com/wyvox/action-setup-pnpm@v3 with: node-version: 22 - pnpm-version: 10 - name: Build run: pnpm build diff --git a/package.json b/package.json index 3820e75..bb4062c 100644 --- a/package.json +++ b/package.json @@ -31,10 +31,7 @@ "express": "^4.21.2", "open": "^10.1.0" }, - "engines": { - "node": ">=10", - "pnpm": ">=10" - }, + "packageManager": "pnpm@10.11.0", "devDependencies": { "@modelcontextprotocol/sdk": "^1.11.2", "@types/express": "^5.0.0", From a63b93aa5cad1cfa65ce69e9de9cc420e9789734 Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 17:32:42 +0200 Subject: [PATCH 21/22] wip --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 6527995..1008364 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -24,4 +24,4 @@ jobs: - name: Build run: pnpm build - - run: pnpm dlx pkg-pr-new publish --compact --bin + - run: pnpm dlx publish --compact --bin From d1cb48f770c4228c8639358ff608544656bbd57c Mon Sep 17 00:00:00 2001 From: Angel Nunez Mencias Date: Sun, 18 May 2025 18:01:29 +0200 Subject: [PATCH 22/22] a --- .github/workflows/publish.yml | 6 ++++++ package.json | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1008364..005fbc3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -15,6 +15,12 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + + - name: Add git.kvant.cloud scope + run: npm config set @kvant:registry=https://git.kvant.cloud/api/packages/${{ github.repository_owner }}/npm/ + + - name: Login to git.kvant.cloud npm + run: npm config set -- '//git.kvant.cloud/api/packages/${{ github.repository_owner }}/npm/:_authToken' "${{ secrets.PHOENIX_PACKAGE_WRITER_TOKEN }}" - name: Setup pnpm & install uses: https://github.com/wyvox/action-setup-pnpm@v3 diff --git a/package.json b/package.json index bb4062c..bf4892f 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "mcp-remote", + "name": "@kvant/mcp-remote", "version": "0.1.5", "description": "Remote proxy for Model Context Protocol, allowing local-only clients to connect to remote servers using oAuth", "keywords": [