Skip to main content
Glama

Smart Code Search MCP Server

base_parser.py2.51 kB
"""Base parser interface for all language parsers""" from abc import ABC, abstractmethod from typing import List, Dict, Any, Optional from pathlib import Path class BaseParser(ABC): """Abstract base class for all language parsers""" @abstractmethod def parse(self, code: str, file_path: Optional[Path] = None) -> Any: """Parse source code and return parse tree""" pass @abstractmethod def extract_symbols(self, code: str) -> List[Dict[str, Any]]: """Extract all symbols (functions, classes, etc.) from code Returns list of dicts with: - name: Symbol name - type: Symbol type (function, class, method, etc.) - line_num: Starting line number - signature: Full signature if applicable - docstring: Documentation if available """ pass @abstractmethod def extract_functions(self, code: str) -> List[Dict[str, Any]]: """Extract function definitions from code""" pass @abstractmethod def extract_classes(self, code: str) -> List[Dict[str, Any]]: """Extract class definitions from code""" pass @abstractmethod def extract_imports(self, code: str) -> List[str]: """Extract import statements from code""" pass @abstractmethod def extract_type_info(self, code: str, symbol_name: str = None) -> Dict[str, Any]: """Extract type information for symbols Returns dict with: - parameters: List of parameter info with types - return_type: Return type annotation - exceptions_raised: List of exceptions that may be raised - type_annotations: Dict of other type annotations """ pass @abstractmethod def extract_dependencies(self, code: str) -> Dict[str, Any]: """Extract dependency information Returns dict with: - imports: List of imported modules - calls: List of function calls made - inherits_from: Base classes (for classes) """ pass @abstractmethod def extract_documentation(self, code: str) -> Dict[str, Any]: """Extract documentation and comments Returns dict with: - todo_items: List of TODO/FIXME/XXX comments - inline_comments: List of inline comments - docstrings: Docstrings for symbols """ pass

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/stevenjjobson/scs-mcp'

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