Skip to main content
Glama
credentials_service.py1.73 kB
""" Trusty Sign - Credentials Service Manages digital signature credentials for users NOW USES: TrustyVault MCP tools (centralized credential management) REPLACED: Direct database access (oauth_server.database) """ import logging import os import httpx from typing import Optional from dataclasses import dataclass logger = logging.getLogger(__name__) # TrustyVault MCP server URL TRUSTYVAULT_MCP_URL = os.getenv( 'TRUSTYVAULT_MCP_URL', 'http://localhost:8100/mcp/execute' ) @dataclass class FirmaCredentials: """Digital signature credentials""" username: str password: str pin: str class CredentialsService: """ Service for managing digital signature credentials NOW USES: TrustyVault MCP vault_get_credentials / vault_set_credentials """ async def _call_mcp(self, tool_name: str, params: dict) -> dict: """Call TrustyVault MCP tool via HTTP.""" try: async with httpx.AsyncClient(timeout=30.0) as client: response = await client.post( TRUSTYVAULT_MCP_URL, json={"tool": tool_name, "params": params} ) response.raise_for_status() # Parse SSE response (simplified) lines = response.text.strip().split('\n') for line in lines: if line.startswith('data: '): import json return json.loads(line[6:]) raise ValueError("No data in MCP response") except Exception as e: logger.error(f"MCP call failed ({tool_name}): {e}") return {"success": False, "error": str(e)}

Latest Blog Posts

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/ilvolodel/iris-legacy'

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