MCP TypeScript SDK (V2) / @modelcontextprotocol/codemod / migrations/v1-to-v2/mappings/importMap
migrations/v1-to-v2/mappings/importMap
Interfaces
ImportMapping
Defined in: migrations/v1-to-v2/mappings/importMap.ts:1
Properties
isV2Gap?
optionalisV2Gap?:boolean
Defined in: migrations/v1-to-v2/mappings/importMap.ts:26
Marks a module-level removal as a known v2 gap (downgrades the removal diagnostic to the v2-gap category). For per-symbol removals use removedSymbols.
migrationHint?
optionalmigrationHint?:string
Defined in: migrations/v1-to-v2/mappings/importMap.ts:28
Emitted as an info diagnostic after a successful move, suggesting eventual migration to v2 equivalents.
removalMessage?
optionalremovalMessage?:string
Defined in: migrations/v1-to-v2/mappings/importMap.ts:18
removedSymbols?
optionalremovedSymbols?:Record<string,string>
Defined in: migrations/v1-to-v2/mappings/importMap.ts:24
Symbols from this module that have no v2 export anywhere. They are dropped from the rewritten import and the call site gets an action-required marker carrying the message, instead of an import of a member the target package does not have.
renamedSymbols?
optionalrenamedSymbols?:Record<string,string>
Defined in: migrations/v1-to-v2/mappings/importMap.ts:4
schemaSymbolTarget?
optionalschemaSymbolTarget?:string
Defined in: migrations/v1-to-v2/mappings/importMap.ts:17
Route an imported symbol to this package (instead of target) when its rename-resolved name is a Zod schema constant re-exported by core — a member of SPEC_SCHEMA_NAMES (spec schemas, for sdk/types.js) or AUTH_SCHEMA_NAMES (OAuth/OpenID schemas, for sdk/shared/auth.js). The schemas now live in @modelcontextprotocol/core (so <Name>Schema.parse(...) keeps working), while the corresponding types/constants/guards resolve by context. Matching on membership (not a *Schema suffix) keeps TYPES whose name ends in Schema — e.g. the elicitation primitives BooleanSchema/StringSchema/EnumSchema — routed by context, where their types live. symbolTargetOverrides (exact-name) takes precedence.
status
status:
"moved"|"removed"|"renamed"
Defined in: migrations/v1-to-v2/mappings/importMap.ts:3
subpathSuffix?
optionalsubpathSuffix?:string
Defined in: migrations/v1-to-v2/mappings/importMap.ts:33
Subpath suffix appended after RESOLVE_BY_CONTEXT resolves the base package (e.g. /validators/ajv). The final target becomes @modelcontextprotocol/{client,server}<subpathSuffix>.
symbolTargetOverrides?
optionalsymbolTargetOverrides?:Record<string,string>
Defined in: migrations/v1-to-v2/mappings/importMap.ts:6
Route specific symbols to a different target package than target.
target
target:
string
Defined in: migrations/v1-to-v2/mappings/importMap.ts:2
Variables
IMPORT_MAP
constIMPORT_MAP:Record<string,ImportMapping>
Defined in: migrations/v1-to-v2/mappings/importMap.ts:48
RS_ONLY_AUTH_SYMBOLS
constRS_ONLY_AUTH_SYMBOLS:ReadonlySet<string>
Defined in: migrations/v1-to-v2/mappings/importMap.ts:41
Resource-server auth helpers whose maintained v2 home is @modelcontextprotocol/express; the server-legacy/auth copy they route to by default is a frozen v1 snapshot, so import and re-export sites get a marker prompting a deliberate re-point.
Functions
isAuthImport()
isAuthImport(
specifier):boolean
Defined in: migrations/v1-to-v2/mappings/importMap.ts:257
Parameters
specifier
string
Returns
boolean
lookupImportMapping()
lookupImportMapping(
specifier):ImportMapping|undefined
Defined in: migrations/v1-to-v2/mappings/importMap.ts:282
Resolves the v2 mapping for a v1 SDK import/export/mock specifier, tolerating JS extension variance. An exact match always wins; otherwise the specifier is matched ignoring a trailing .js/.mjs/.cjs (or its absence).
Parameters
specifier
string
Returns
ImportMapping | undefined