mcp_registry_client
MCP Registry Client - A Python client for the MCP server registry.
Package
Bases: BaseModel
Package information for an MCP server.
Source code in mcp_registry_client/models.py
RegistryAPIError
Bases: RegistryClientError
Exception raised when the registry API returns an error.
Source code in mcp_registry_client/client.py
__init__(message, status_code=None)
Init.
Takes - message: str - error message from registry API - status_code: int - status from registry API
Source code in mcp_registry_client/client.py
RegistryClient
Async client for the MCP registry API.
Source code in mcp_registry_client/client.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 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 144 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 181 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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | |
__aenter__()
async
__aexit__(exc_type, exc_val, exc_tb)
async
__init__(base_url=None, timeout=None, config=None)
Initialize the registry client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
str | None
|
Base URL for the registry API (overrides config) |
None
|
timeout
|
float | None
|
Request timeout in seconds (overrides config) |
None
|
config
|
ClientConfig | None
|
Client configuration (if None, loads from environment) |
None
|
Source code in mcp_registry_client/client.py
close()
async
get_server_by_id(server_id)
async
Get a specific server by its ID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
server_id
|
str
|
The server ID from the registry |
required |
Returns:
| Type | Description |
|---|---|
Server | None
|
Server details if the server is active, None otherwise |
Raises:
| Type | Description |
|---|---|
RegistryAPIError
|
If the API request fails |
RegistryClientError
|
If response parsing fails |
Source code in mcp_registry_client/client.py
get_server_by_name(name)
async
Get a server by its name.
This method searches for servers, finds a match, and then fetches the full server details using the server ID. Only active servers are returned.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The server name to search for |
required |
Returns:
| Type | Description |
|---|---|
Server | None
|
Server details if found and active, None otherwise |
Raises:
| Type | Description |
|---|---|
RegistryAPIError
|
If the API request fails |
Source code in mcp_registry_client/client.py
search_servers(name)
async
Search for MCP servers in the registry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name filter for servers (required to avoid returning hundreds of servers) |
required |
Returns:
| Type | Description |
|---|---|
SearchResponse
|
Search response with list of servers matching the name filter |
Raises:
| Type | Description |
|---|---|
RegistryAPIError
|
If the API request fails |
RegistryClientError
|
If response parsing fails |
Source code in mcp_registry_client/client.py
RegistryClientError
Repository
Bases: BaseModel
Repository information for an MCP server.
Source code in mcp_registry_client/models.py
SearchResponse
Server
Bases: BaseModel
MCP server definition.