academia-mcp 1.10.4__tar.gz → 1.10.5__tar.gz
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.
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/PKG-INFO +1 -1
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/visit_webpage.py +30 -25
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp.egg-info/PKG-INFO +1 -1
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/pyproject.toml +1 -1
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/LICENSE +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/README.md +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/__init__.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/__main__.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/files.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/latex_templates/agents4science_2025/agents4science_2025.sty +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/latex_templates/agents4science_2025/agents4science_2025.tex +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/llm.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/pdf.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/py.typed +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/server.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/settings.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/__init__.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/anthology_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/arxiv_download.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/arxiv_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/bitflip.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/document_qa.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/hf_datasets_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/latex.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/py.typed +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/review.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/s2.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/show_image.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/speech_to_text.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/tools/web_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp/utils.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp.egg-info/SOURCES.txt +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp.egg-info/dependency_links.txt +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp.egg-info/entry_points.txt +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp.egg-info/requires.txt +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/academia_mcp.egg-info/top_level.txt +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/setup.cfg +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_anthology_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_arxiv_download.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_arxiv_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_bitflip.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_document_qa.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_extract_json.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_hf_dataset_search.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_latex.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_review.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_s2.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_show_image.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_speech_to_text.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_visit_webpage.py +0 -0
- {academia_mcp-1.10.4 → academia_mcp-1.10.5}/tests/test_web_search.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: academia-mcp
|
3
|
-
Version: 1.10.
|
3
|
+
Version: 1.10.5
|
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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import re
|
2
2
|
import json
|
3
|
-
from typing import Optional
|
3
|
+
from typing import Optional, Dict, Any, cast
|
4
4
|
|
5
5
|
from markdownify import markdownify # type: ignore
|
6
6
|
|
@@ -14,7 +14,7 @@ AVAILABLE_PROVIDERS = ("basic", "exa", "tavily")
|
|
14
14
|
ERROR_MESSAGE = "Failed to get content from the page. Try to use another provider."
|
15
15
|
|
16
16
|
|
17
|
-
def _exa_visit_webpage(url: str) -> str:
|
17
|
+
def _exa_visit_webpage(url: str) -> Dict[str, Any]:
|
18
18
|
key = settings.EXA_API_KEY or ""
|
19
19
|
assert key, "Error: EXA_API_KEY is not set and no api_key was provided"
|
20
20
|
payload = {
|
@@ -24,11 +24,11 @@ def _exa_visit_webpage(url: str) -> str:
|
|
24
24
|
response = post_with_retries(EXA_CONTENTS_URL, payload=payload, api_key=key)
|
25
25
|
results = response.json()["results"]
|
26
26
|
if not results:
|
27
|
-
return
|
28
|
-
return
|
27
|
+
return {"error": ERROR_MESSAGE}
|
28
|
+
return cast(Dict[str, Any], results[0])
|
29
29
|
|
30
30
|
|
31
|
-
def _tavily_visit_webpage(url: str) -> str:
|
31
|
+
def _tavily_visit_webpage(url: str) -> Dict[str, Any]:
|
32
32
|
key = settings.TAVILY_API_KEY or ""
|
33
33
|
assert key, "Error: TAVILY_API_KEY is not set and no api_key was provided"
|
34
34
|
payload = {
|
@@ -37,8 +37,25 @@ def _tavily_visit_webpage(url: str) -> str:
|
|
37
37
|
response = post_with_retries(TAVILY_EXTRACT_URL, payload=payload, api_key=key)
|
38
38
|
results = response.json()["results"]
|
39
39
|
if not results:
|
40
|
-
return
|
41
|
-
return
|
40
|
+
return {"error": ERROR_MESSAGE}
|
41
|
+
return {"text": results[0]["raw_content"]}
|
42
|
+
|
43
|
+
|
44
|
+
def _basic_visit_webpage(url: str) -> Dict[str, Any]:
|
45
|
+
try:
|
46
|
+
response = get_with_retries(url)
|
47
|
+
content_type = response.headers.get("content-type", "").lower()
|
48
|
+
if not content_type or (
|
49
|
+
not content_type.startswith("text/") and "html" not in content_type
|
50
|
+
):
|
51
|
+
if settings.EXA_API_KEY:
|
52
|
+
return _exa_visit_webpage(url)
|
53
|
+
return {"error": f"Unsupported content-type: {content_type or 'unknown'}"}
|
54
|
+
markdown_content = markdownify(response.text).strip()
|
55
|
+
markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
|
56
|
+
return {"text": markdown_content}
|
57
|
+
except Exception as e:
|
58
|
+
return {"error": str(e) + "\n" + ERROR_MESSAGE}
|
42
59
|
|
43
60
|
|
44
61
|
def visit_webpage(url: str, provider: Optional[str] = "basic") -> str:
|
@@ -59,24 +76,12 @@ def visit_webpage(url: str, provider: Optional[str] = "basic") -> str:
|
|
59
76
|
), f"Invalid provider: {provider}. Available providers: {AVAILABLE_PROVIDERS}"
|
60
77
|
|
61
78
|
if provider == "exa" and settings.EXA_API_KEY:
|
62
|
-
|
79
|
+
result = _exa_visit_webpage(url)
|
63
80
|
elif provider == "tavily" and settings.TAVILY_API_KEY:
|
64
|
-
|
81
|
+
result = _tavily_visit_webpage(url)
|
65
82
|
else:
|
66
|
-
|
83
|
+
result = _basic_visit_webpage(url)
|
67
84
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
except Exception as e:
|
72
|
-
return json.dumps({"id": url, "error": str(e)})
|
73
|
-
content_type = response.headers.get("content-type", "").lower()
|
74
|
-
if not content_type or (not content_type.startswith("text/") and "html" not in content_type):
|
75
|
-
if settings.EXA_API_KEY:
|
76
|
-
return _exa_visit_webpage(url)
|
77
|
-
return json.dumps(
|
78
|
-
{"id": url, "error": f"Unsupported content-type: {content_type or 'unknown'}"}
|
79
|
-
)
|
80
|
-
markdown_content = markdownify(response.text).strip()
|
81
|
-
markdown_content = re.sub(r"\n{3,}", "\n\n", markdown_content)
|
82
|
-
return sanitize_output(json.dumps({"id": url, "text": markdown_content}))
|
85
|
+
result["id"] = url
|
86
|
+
result["provider"] = provider
|
87
|
+
return sanitize_output(json.dumps(result, ensure_ascii=False))
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: academia-mcp
|
3
|
-
Version: 1.10.
|
3
|
+
Version: 1.10.5
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|