Open History to see the last commit
1import type { MCPServerOptions } from './create-server'
2
3// Keeps the options of each server for `directMCPClient`.
4// This module imports nothing at runtime, so the client entry point can read
5// the options without loading the server SDK.
6const serverOptionsByServer = new WeakMap<object, MCPServerOptions>()
7
8/** Internal. Records the options that `server` was created with. */
9export function rememberServerOptions(
10 server: object,
11 options: MCPServerOptions,
12) {
13 serverOptionsByServer.set(server, options)
14}
15
16/** Internal. Returns the options that `server` was created with. */
17export function optionsOfServer(server: object) {
18 return serverOptionsByServer.get(server)
19}