serverdex 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
serverdex/__init__.py
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Serverdex — a tiny Python client for the Serverdex directory of MCP servers.
|
|
2
|
+
|
|
3
|
+
Serverdex (https://serverdex.io) indexes the official Model Context Protocol
|
|
4
|
+
registry: 60,000+ MCP servers, searchable, with install configs, GitHub signals
|
|
5
|
+
and category rankings. This client wraps the public JSON API — no API key, no
|
|
6
|
+
dependencies (standard library only).
|
|
7
|
+
|
|
8
|
+
import serverdex
|
|
9
|
+
serverdex.search("postgres", limit=5)
|
|
10
|
+
serverdex.get("io-github-ccxt-ccxt-mcp")
|
|
11
|
+
serverdex.categories()
|
|
12
|
+
"""
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import json
|
|
16
|
+
import urllib.error
|
|
17
|
+
import urllib.parse
|
|
18
|
+
import urllib.request
|
|
19
|
+
from typing import Any, Optional
|
|
20
|
+
|
|
21
|
+
__all__ = ["Client", "ServerdexError", "search", "get", "categories", "__version__"]
|
|
22
|
+
__version__ = "0.1.0"
|
|
23
|
+
|
|
24
|
+
_BASE = "https://serverdex.io/api/v1"
|
|
25
|
+
_UA = f"serverdex-python/{__version__} (+https://serverdex.io)"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class ServerdexError(RuntimeError):
|
|
29
|
+
"""Raised when the Serverdex API returns an error or is unreachable."""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Client:
|
|
33
|
+
"""Client for the Serverdex public API (https://serverdex.io).
|
|
34
|
+
|
|
35
|
+
All methods return plain Python dicts/lists parsed from the JSON API.
|
|
36
|
+
"""
|
|
37
|
+
|
|
38
|
+
def __init__(self, base_url: str = _BASE, timeout: float = 20.0) -> None:
|
|
39
|
+
self.base_url = base_url.rstrip("/")
|
|
40
|
+
self.timeout = timeout
|
|
41
|
+
|
|
42
|
+
def _get(self, path: str, params: Optional[dict] = None) -> Any:
|
|
43
|
+
url = self.base_url + path
|
|
44
|
+
if params:
|
|
45
|
+
clean = {k: v for k, v in params.items() if v is not None}
|
|
46
|
+
if clean:
|
|
47
|
+
url += "?" + urllib.parse.urlencode(clean)
|
|
48
|
+
req = urllib.request.Request(url, headers={"User-Agent": _UA, "Accept": "application/json"})
|
|
49
|
+
try:
|
|
50
|
+
with urllib.request.urlopen(req, timeout=self.timeout) as resp:
|
|
51
|
+
return json.loads(resp.read().decode("utf-8"))
|
|
52
|
+
except urllib.error.HTTPError as exc: # pragma: no cover - network
|
|
53
|
+
raise ServerdexError(f"Serverdex API returned HTTP {exc.code} for {url}") from exc
|
|
54
|
+
except urllib.error.URLError as exc: # pragma: no cover - network
|
|
55
|
+
raise ServerdexError(f"Could not reach the Serverdex API: {exc.reason}") from exc
|
|
56
|
+
|
|
57
|
+
def search(
|
|
58
|
+
self,
|
|
59
|
+
query: Optional[str] = None,
|
|
60
|
+
*,
|
|
61
|
+
category: Optional[str] = None,
|
|
62
|
+
sort: Optional[str] = None,
|
|
63
|
+
limit: int = 10,
|
|
64
|
+
page: int = 1,
|
|
65
|
+
) -> list:
|
|
66
|
+
"""Search MCP servers. Returns a list of server dicts.
|
|
67
|
+
|
|
68
|
+
query: words to search for (omit to browse). category: a category slug
|
|
69
|
+
(see categories()). sort: "new" (default), "name" or "stars".
|
|
70
|
+
"""
|
|
71
|
+
data = self._get("/servers", {"q": query, "category": category, "sort": sort, "limit": limit, "page": page})
|
|
72
|
+
return data.get("data", [])
|
|
73
|
+
|
|
74
|
+
def get(self, slug: str) -> dict:
|
|
75
|
+
"""Get everything about one server by slug (from a serverdex.io/server/<slug> URL)."""
|
|
76
|
+
data = self._get("/servers/" + urllib.parse.quote(slug, safe=""))
|
|
77
|
+
return data.get("data", {})
|
|
78
|
+
|
|
79
|
+
def categories(self) -> list:
|
|
80
|
+
"""List the directory's categories with live server counts."""
|
|
81
|
+
data = self._get("/categories")
|
|
82
|
+
return data.get("data", [])
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
_default = Client()
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def search(query: Optional[str] = None, **kwargs) -> list:
|
|
89
|
+
"""Module-level shortcut for Client().search()."""
|
|
90
|
+
return _default.search(query, **kwargs)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def get(slug: str) -> dict:
|
|
94
|
+
"""Module-level shortcut for Client().get()."""
|
|
95
|
+
return _default.get(slug)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def categories() -> list:
|
|
99
|
+
"""Module-level shortcut for Client().categories()."""
|
|
100
|
+
return _default.categories()
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: serverdex
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tiny Python client for Serverdex — search 60,000+ MCP servers from the official registry.
|
|
5
|
+
Project-URL: Homepage, https://serverdex.io
|
|
6
|
+
Project-URL: Documentation, https://serverdex.io/developers
|
|
7
|
+
Project-URL: Source, https://github.com/hellolistifyai/serverdex-py
|
|
8
|
+
Author-email: Serverdex <hello@serverdex.io>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,ai,claude,cursor,directory,llm,mcp,model-context-protocol,serverdex
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Requires-Python: >=3.8
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# serverdex
|
|
22
|
+
|
|
23
|
+
A tiny Python client for [Serverdex](https://serverdex.io) — the directory of Model Context Protocol (MCP) servers. Serverdex indexes 60,000+ MCP servers from the official registry, with install configs, GitHub signals and category rankings.
|
|
24
|
+
|
|
25
|
+
No API key, no dependencies (standard library only).
|
|
26
|
+
|
|
27
|
+
## Install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install serverdex
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Use
|
|
34
|
+
|
|
35
|
+
```python
|
|
36
|
+
import serverdex
|
|
37
|
+
|
|
38
|
+
# Search the directory
|
|
39
|
+
for s in serverdex.search("postgres", limit=5):
|
|
40
|
+
print(s["name"], "—", s["url"])
|
|
41
|
+
|
|
42
|
+
# Filter by category and sort by stars
|
|
43
|
+
serverdex.search(category="databases", sort="stars", limit=10)
|
|
44
|
+
|
|
45
|
+
# Get one server by slug (from a serverdex.io/server/<slug> URL)
|
|
46
|
+
server = serverdex.get("io-github-ccxt-ccxt-mcp")
|
|
47
|
+
print(server["description"], server["repository_url"])
|
|
48
|
+
|
|
49
|
+
# List categories with live server counts
|
|
50
|
+
for c in serverdex.categories():
|
|
51
|
+
print(c["name"], c["servers"])
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Or with an explicit client:
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from serverdex import Client
|
|
58
|
+
|
|
59
|
+
client = Client()
|
|
60
|
+
results = client.search("calendar", sort="new", limit=20)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
- `search(query=None, *, category=None, sort=None, limit=10, page=1)` — list of server dicts.
|
|
66
|
+
- `get(slug)` — one server's full details.
|
|
67
|
+
- `categories()` — categories with live counts.
|
|
68
|
+
|
|
69
|
+
Backed by the public Serverdex API at `https://serverdex.io/api/v1`. Browse the directory at [serverdex.io](https://serverdex.io).
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
serverdex/__init__.py,sha256=R02oeMsjrJcjiIMGZiE5P3mewWF4rhFvRmAgrOPD1wI,3592
|
|
2
|
+
serverdex-0.1.0.dist-info/METADATA,sha256=u8YP3OO9iBiTdUpkt78EWsl4EYYxZPZw98IEUtNGS54,2253
|
|
3
|
+
serverdex-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
4
|
+
serverdex-0.1.0.dist-info/licenses/LICENSE,sha256=lUUZ0nQirMVGhVZXoV5atVCJgtKwQ_g7Wp99HilGKlw,1066
|
|
5
|
+
serverdex-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Serverdex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|