Services¶
The holodeck.services package contains client classes for interacting with
external services such as the MCP Registry API.
MCP Registry Client¶
MCPRegistryClient provides methods to search, retrieve, and list MCP servers
from the official registry at https://registry.modelcontextprotocol.io.
MCPRegistryClient(base_url=DEFAULT_BASE_URL, timeout=DEFAULT_TIMEOUT)
¶
Client for MCP Registry API.
Provides methods to search, retrieve, and list MCP servers from the official registry.
Example
client = MCPRegistryClient() result = client.search(query="filesystem") for server in result.servers: ... print(f"{server.name}: {server.description}")
Initialize client with base URL and timeout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str
|
Registry API base URL |
DEFAULT_BASE_URL
|
timeout
|
float
|
Request timeout in seconds (default: 5.0) |
DEFAULT_TIMEOUT
|
Source code in src/holodeck/services/mcp_registry.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
search(query=None, limit=25, cursor=None)
¶
Search for MCP servers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str | None
|
Optional search term (substring match on name) |
None
|
limit
|
int
|
Maximum results per page (default 25) |
25
|
cursor
|
str | None
|
Pagination cursor for next page |
None
|
Returns:
| Type | Description |
|---|---|
SearchResult
|
SearchResult with servers and pagination info |
Raises:
| Type | Description |
|---|---|
RegistryConnectionError
|
Network/timeout issues |
RegistryAPIError
|
API returned error status |
Source code in src/holodeck/services/mcp_registry.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
get_server(name, version='latest')
¶
Get specific server by name and version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Server name (reverse-DNS format) |
required |
version
|
str
|
Version string or "latest" |
'latest'
|
Returns:
| Type | Description |
|---|---|
RegistryServer
|
RegistryServer with full details |
Raises:
| Type | Description |
|---|---|
ServerNotFoundError
|
Server doesn't exist |
RegistryConnectionError
|
Network/timeout issues |
Source code in src/holodeck/services/mcp_registry.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
list_versions(name)
¶
List available versions for a server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Server name (reverse-DNS format) |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
List of version strings (newest first) |
Raises:
| Type | Description |
|---|---|
ServerNotFoundError
|
Server doesn't exist |
RegistryConnectionError
|
Network/timeout issues |
Source code in src/holodeck/services/mcp_registry.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | |
close()
¶
Close the underlying HTTP session.
Should be called when done with the client to release resources. Alternatively, use the client as a context manager.
Example
with MCPRegistryClient() as client: ... result = client.search("filesystem")
Session automatically closed¶
Source code in src/holodeck/services/mcp_registry.py
80 81 82 83 84 85 86 87 88 89 90 91 92 | |
Module-Level Functions¶
find_stdio_package¶
find_stdio_package(server)
¶
Find a package that supports stdio transport.
Prioritizes supported registry types (npm, pypi, docker, oci) when multiple stdio packages are available.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server
|
RegistryServer
|
Registry server with packages |
required |
Returns:
| Type | Description |
|---|---|
RegistryServerPackage | None
|
First stdio-compatible package with supported registry type, |
RegistryServerPackage | None
|
or any stdio package as fallback, or None if none found |
Source code in src/holodeck/services/mcp_registry.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 | |
registry_to_mcp_tool¶
registry_to_mcp_tool(server, package=None, transport_override=None)
¶
Convert registry server to MCPTool configuration.
Transforms an MCP server from the registry into a tool configuration that can be added to agent.yaml or global config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server
|
RegistryServer
|
RegistryServer from registry API |
required |
package
|
RegistryServerPackage | None
|
Specific package to use (defaults to first package) |
None
|
transport_override
|
str | None
|
Optional transport type override |
None
|
Returns:
| Type | Description |
|---|---|
MCPTool
|
MCPTool configuration ready for YAML serialization |
Raises:
| Type | Description |
|---|---|
ValueError
|
If server has no packages |
Source code in src/holodeck/services/mcp_registry.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |