File size: 505 Bytes
7cd5aef
8e8bfa6
7cd5aef
3cb1988
 
b69651d
7cd5aef
 
 
b69651d
7cd5aef
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# mcp/mygene.py
from functools import lru_cache
from mcp.clients import BaseClient
from typing import Dict


class MyGeneClient(BaseClient):
    def __init__(self):
        super().__init__("https://mygene.info/v3", api_key_env="MYGENE_KEY")

    @lru_cache(512)
    async def fetch(self, symbol: str) -> Dict:
        q = {"q": symbol, "fields": "symbol,name,summary,alias,entrezgene,location", "size": 1}
        return (await self.request("GET", "query", params=q))["hits"][0]

mygene = MyGeneClient()