Skip to content

Commit c0aee13

Browse files
committed
backward compatibility
1 parent 9d5777f commit c0aee13

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"scripts": {
66
"build": "tsc && shx chmod +x dist/*.js",
77
"watch": "tsc --watch",
8-
"inspector": "dotenv -e .env.local npx @modelcontextprotocol/inspector dist/index.js -e METAMCP_API_KEY=${METAMCP_API_KEY} -e METAMCP_API_BASE_URL=${METAMCP_API_BASE_URL}"
8+
"inspector": "dotenv -e .env.local npx @modelcontextprotocol/inspector dist/index.js -e METAMCP_API_KEY=${METAMCP_API_KEY} -e METAMCP_API_BASE_URL=${METAMCP_API_BASE_URL}",
9+
"inspector:prod": "dotenv -e .env.production.local npx @modelcontextprotocol/inspector dist/index.js -e METAMCP_API_KEY=${METAMCP_API_KEY}"
910
},
1011
"repository": {
1112
"type": "git",

src/client.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ export const createMetaMcpClient = (
2020
let transport: Transport | undefined;
2121

2222
// Create the appropriate transport based on server type
23-
if (serverParams.type === "STDIO") {
23+
// Default to "STDIO" if type is undefined
24+
if (!serverParams.type || serverParams.type === "STDIO") {
2425
const stdioParams: StdioServerParameters = {
2526
command: serverParams.command || "",
2627
args: serverParams.args || undefined,

src/fetch-metamcp.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export interface ServerParameters {
1010
uuid: string;
1111
name: string;
1212
description: string;
13-
type: "STDIO" | "SSE";
13+
type?: "STDIO" | "SSE"; // Optional field, defaults to "STDIO" when undefined
1414
command?: string | null;
1515
args?: string[] | null;
1616
env?: Record<string, string> | null;
@@ -55,7 +55,12 @@ export async function getMcpServers(
5555
const data = response.data;
5656

5757
const serverDict: Record<string, ServerParameters> = {};
58-
for (const params of data) {
58+
for (const serverParams of data) {
59+
const params: ServerParameters = {
60+
...serverParams,
61+
type: serverParams.type || "STDIO",
62+
};
63+
5964
// Process based on server type
6065
if (params.type === "STDIO") {
6166
if ("args" in params && !params.args) {

src/utils.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ export function computeParamsHash(
6969
): string {
7070
let paramsDict: any;
7171

72-
if (params.type === "STDIO") {
72+
// Default to "STDIO" if type is undefined
73+
if (!params.type || params.type === "STDIO") {
7374
paramsDict = {
7475
uuid,
75-
type: params.type,
76+
type: "STDIO", // Explicitly set type to "STDIO" for consistent hashing
7677
command: params.command,
7778
args: params.args,
7879
env: params.env

0 commit comments

Comments
 (0)