MCPcopy Create free account
hub / github.com/IBM/mcp-cli / load_async

Method load_async

src/mcp_cli/config/models.py:172–185  ·  view source on GitHub ↗

Async load from file (future-proof for async I/O).

(cls, config_path: Path)

Source from the content-addressed store, hash-verified

170
171 @classmethod
172 async def load_async(cls, config_path: Path) -> MCPConfig:
173 """Async load from file (future-proof for async I/O)."""
174 import asyncio
175 import json
176
177 if not config_path.exists():
178 return cls()
179
180 # Use asyncio for file I/O
181 loop = asyncio.get_event_loop()
182 data = await loop.run_in_executor(None, config_path.read_text)
183 parsed = json.loads(data)
184
185 return cls.model_validate(parsed) # type: ignore[no-any-return]
186
187 @classmethod
188 def load_sync(cls, config_path: Path) -> MCPConfig:

Callers 3

Calls

no outgoing calls

Tested by 2