-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
30 lines (24 loc) · 761 Bytes
/
Copy pathserver.py
File metadata and controls
30 lines (24 loc) · 761 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from typing import Any
import httpx
from mcp.server.fastmcp import FastMCP
from logger import logger
mcp = FastMCP("ashby")
# Constants
ASHBY_URL = "https://api.ashbyhq.com/posting-api/job-board/moonshot-ai?includeCompensation=true"
async def make_ashby_request(url: str) -> dict[str, Any] | None:
async with httpx.AsyncClient() as client:
try:
response = await client.get(url, timeout=30.0)
response.raise_for_status()
return response.json()
except Exception:
return None
@mcp.tool()
async def get_jobs() -> str:
data = await make_ashby_request(ASHBY_URL)
jobs = data["jobs"]
return str(jobs)
def main():
mcp.run(transport='stdio')
if __name__ == "__main__":
main()