Skip to main content
Glama
permissions.py1.24 kB
import functools from typing import Callable, Any from core.config import is_readonly_mode def check_readonly_permission(func: Callable) -> Callable: """ Decorator to check if an operation is allowed in readonly mode. This decorator should be applied to all write operations (create, update, delete). In readonly mode, these operations will raise a PermissionError. """ @functools.wraps(func) def wrapper(*args, **kwargs) -> Any: if is_readonly_mode(): operation_name = func.__name__ raise PermissionError( f"Operation '{operation_name}' is not allowed in readonly mode. " f"Only read/get operations are permitted when --readonly flag is used." ) return func(*args, **kwargs) return wrapper def is_write_operation(func_name: str) -> bool: """ Check if a function name represents a write operation. Args: func_name: The name of the function to check Returns: True if the function is a write operation, False otherwise """ write_operations = ['create', 'update', 'delete', 'patch', 'replace'] return any(op in func_name.lower() for op in write_operations)

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/bourbonkk/k8s-pilot'

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