academia-mcp 1.2.1__py3-none-any.whl → 1.2.2__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.
@@ -28,16 +28,31 @@ def web_search(
28
28
  limit: The maximum number of items to return. 20 by default, maximum 25.
29
29
  provider: The provider to use. "exa", "tavily" or "brave". "tavily" by default.
30
30
  """
31
- assert provider in (
32
- "exa",
33
- "tavily",
34
- "brave",
35
- ), "Error: provider must be either 'exa', 'tavily' or 'brave'"
31
+ providers = ("tavily", "brave", "exa")
32
+ assert provider in providers, "Error: provider must be either 'exa', 'tavily' or 'brave'"
33
+
34
+ is_tavily_available = os.getenv("TAVILY_API_KEY") is not None
35
+ is_exa_available = os.getenv("EXA_API_KEY") is not None
36
+ is_brave_available = os.getenv("BRAVE_API_KEY") is not None
37
+ assert is_tavily_available or is_exa_available or is_brave_available
38
+ availability = {
39
+ "tavily": is_tavily_available,
40
+ "brave": is_brave_available,
41
+ "exa": is_exa_available,
42
+ }
43
+
44
+ if not availability[provider]:
45
+ for p in providers:
46
+ if availability[p]:
47
+ provider = p
48
+ break
36
49
 
37
50
  if provider == "exa":
38
51
  return exa_web_search(query, limit)
39
- if provider == "brave":
52
+ elif provider == "brave":
40
53
  return brave_web_search(query, limit)
54
+
55
+ assert provider == "tavily"
41
56
  return tavily_web_search(query, limit)
42
57
 
43
58
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: academia-mcp
3
- Version: 1.2.1
3
+ Version: 1.2.2
4
4
  Summary: MCP server that provides different tools to search for scientific publications
5
5
  Author-email: Ilya Gusev <phoenixilya@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/IlyaGusev/academia_mcp
@@ -16,10 +16,10 @@ academia_mcp/tools/md_to_pdf.py,sha256=Ovc_-8j7gIZNEM1d0ZDH-8qbtfZLSaNmCm5DQjrtM
16
16
  academia_mcp/tools/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  academia_mcp/tools/s2_citations.py,sha256=dqrBp76RrX1zH2XzcMAoWBbvbtyhxLeF-xnqOKD_JiM,4852
18
18
  academia_mcp/tools/visit_webpage.py,sha256=0zAZYeQxPDu0OjgAAvbMLZh0ttaS5q-_4WhgsEPrbsI,1542
19
- academia_mcp/tools/web_search.py,sha256=NAkbXdD9mKxsIXhWN32dRd_EiaB3G6ENy-n-bc7HAaQ,5448
20
- academia_mcp-1.2.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
21
- academia_mcp-1.2.1.dist-info/METADATA,sha256=mLcD1By5dg9L8hNMlybFg5IUjS4S7uzXggGshnTESV8,1899
22
- academia_mcp-1.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
- academia_mcp-1.2.1.dist-info/entry_points.txt,sha256=gxkiKJ74w2FwJpSECpjA3XtCfI5ZfrM6N8cqnwsq4yY,51
24
- academia_mcp-1.2.1.dist-info/top_level.txt,sha256=CzGpRFsRRJRqWEb1e3SUlcfGqRzOxevZGaJWrtGF8W0,13
25
- academia_mcp-1.2.1.dist-info/RECORD,,
19
+ academia_mcp/tools/web_search.py,sha256=P74HF5agF-cWOGUYmrDcr_R-Ay3xz9fNdhFov8vtt9o,6025
20
+ academia_mcp-1.2.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
21
+ academia_mcp-1.2.2.dist-info/METADATA,sha256=SC1JQUbH4sbFFZFcuTeC-iwEVIhMbQqXlSL2sB6riqM,1899
22
+ academia_mcp-1.2.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
23
+ academia_mcp-1.2.2.dist-info/entry_points.txt,sha256=gxkiKJ74w2FwJpSECpjA3XtCfI5ZfrM6N8cqnwsq4yY,51
24
+ academia_mcp-1.2.2.dist-info/top_level.txt,sha256=CzGpRFsRRJRqWEb1e3SUlcfGqRzOxevZGaJWrtGF8W0,13
25
+ academia_mcp-1.2.2.dist-info/RECORD,,