Skip to main content
Glama

MCP Source Relation Server

rust.py1.51 kB
import re from pathlib import Path from typing import Set from .base import BaseAnalyzer class RustAnalyzer(BaseAnalyzer): """Rust用アナライザー""" @property def file_extensions(self) -> list[str]: return [".rs"] def analyze_imports(self, content: str, file_path: Path) -> Set[str]: imports = set() patterns = [ r"mod\s+([a-zA-Z_][a-zA-Z0-9_]*);", # mod宣言 r"use\s+(?:crate|super|self)::([^;]+);", # use文 ] for pattern in patterns: for match in re.finditer(pattern, content): module_path = match.group(1) components = module_path.split("::") # モジュールパスを解決 current_dir = file_path.parent for component in components: # modディレクトリ内のファイルをチェック mod_file = current_dir / component / "mod.rs" if mod_file.exists(): normalized_path = self.normalize_path(mod_file) imports.add(normalized_path) # 直接のRustファイルをチェック rs_file = current_dir / f"{component}.rs" if rs_file.exists(): normalized_path = self.normalize_path(rs_file) imports.add(normalized_path) current_dir = current_dir / component return imports

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/owayo/mcp-source-relation'

If you have feedback or need assistance with the MCP directory API, please join our Discord server