@@ -57,6 +57,19 @@ export async function bundler<T extends string>(props: Props<T>): Promise<{
57
57
} ;
58
58
}
59
59
60
+ /**
61
+ * Extracts the environment variables from the name.
62
+ *
63
+ * @param name - The name of the MCP server.
64
+ * @param env - The environment variables. { ENV_KEY: "ENV_TARGET" }
65
+ * ENV_TARGET is the target environment variable name, so example: "slack", "notion", "github", etc.
66
+ * @param envMapper - The environment variable mapper. { ENV_KEY: "ENV_VALUE" }
67
+ * ENV_VALUE is the value of the environment variable, so example: "gh_12309wqje123", "nt_12309wqje123", etc.
68
+ * @returns The environment variables.
69
+ */
70
+ function extractEnvFromName ( name : string , env : Record < string , string > , envMapper : Record < string , string > ) {
71
+ return Object . fromEntries ( Object . entries ( env ) . filter ( ( [ , value ] ) => value === name ) . map ( ( [ key ] ) => [ key , envMapper [ key ] ] ) ) ;
72
+ }
60
73
/**
61
74
* Connects to the MCP servers and returns the client transport.
62
75
*
@@ -99,17 +112,3 @@ export async function connectMcp(props: {
99
112
await props . adapter . connect ( transport ) ;
100
113
}
101
114
}
102
-
103
- /**
104
- * Extracts the environment variables from the name.
105
- *
106
- * @param name - The name of the MCP server.
107
- * @param env - The environment variables. { ENV_KEY: "ENV_TARGET" }
108
- * ENV_TARGET is the target environment variable name, so example: "slack", "notion", "github", etc.
109
- * @param envMapper - The environment variable mapper. { ENV_KEY: "ENV_VALUE" }
110
- * ENV_VALUE is the value of the environment variable, so example: "gh_12309wqje123", "nt_12309wqje123", etc.
111
- * @returns The environment variables.
112
- */
113
- const extractEnvFromName = ( name : string , env : Record < string , string > , envMapper : Record < string , string > ) => {
114
- return Object . fromEntries ( Object . entries ( env ) . filter ( ( [ , value ] ) => value === name ) . map ( ( [ key ] ) => [ key , envMapper [ key ] ] ) ) ;
115
- }
0 commit comments