ExMCP.SpecSync.FileMapper (ex_mcp v0.9.2)

View Source

Maps GitHub paths to local paths for MCP specification files.

Handles the conversion from the upstream repository structure (MDX files with JSX components) to clean local Markdown files.

Summary

Functions

Returns the list of known doc file paths to fetch for a given version.

Maps a GitHub doc path to its local equivalent.

Checks if a file path is an MDX file that should be converted.

Processes MDX content into clean Markdown.

Returns the list of schema file paths to fetch for a given version.

Functions

doc_files_for_version(version)

@spec doc_files_for_version(String.t()) :: [String.t()]

Returns the list of known doc file paths to fetch for a given version.

These are the standard documentation files present in most versions.

github_to_local(path)

@spec github_to_local(String.t()) :: String.t()

Maps a GitHub doc path to its local equivalent.

Examples

iex> FileMapper.github_to_local("docs/specification/2025-11-25/index.mdx")
"2025-11-25/Specification.md"

iex> FileMapper.github_to_local("docs/specification/2025-11-25/basic/lifecycle.mdx")
"2025-11-25/BaseProtocol/Lifecycle.md"

iex> FileMapper.github_to_local("schema/2025-11-25/schema.ts")
"2025-11-25/schema.ts"

mdx_file?(path)

@spec mdx_file?(String.t()) :: boolean()

Checks if a file path is an MDX file that should be converted.

process_mdx_content(content)

@spec process_mdx_content(String.t()) :: String.t()

Processes MDX content into clean Markdown.

Strips JSX components, import statements, and other MDX-specific syntax while preserving the documentation content.

schema_files_for_version(version)

@spec schema_files_for_version(String.t()) :: [String.t()]

Returns the list of schema file paths to fetch for a given version.