Skip to content

Commit 09ef218

Browse files
committed
Refactor paper management system and update server tools; enhance research entry structure and streamline JSON data handling.
1 parent 04d9a1a commit 09ef218

File tree

4 files changed

+163
-143
lines changed

4 files changed

+163
-143
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
[
2+
{
3+
"id": 1,
4+
"topic": "few shot learning",
5+
"created": "2025-07-14T14:50:54.749520",
6+
"status": "complete",
7+
"papers_found": [
8+
{
9+
"title": "EASY: Ensemble Augmented-Shot Y-shaped Learning: State-Of-The-Art Few-Shot Classification with Simple Ingredients",
10+
"authors": "Yassir Bendou, Yuqing Hu, Raphael Lafargue, Giulia Lioi, Bastien Pasdeloup, St\u00e9phane Pateux, Vincent Gripon",
11+
"url": "https://hf.co/papers/2201.09699"
12+
},
13+
{
14+
"title": "Few-shot Learning with Multilingual Language Models",
15+
"authors": "Xi Victoria Lin, Todor Mihaylov, Mikel Artetxe, Tianlu Wang, Shuohui Chen, Daniel Simig, Myle Ott, Naman Goyal",
16+
"url": "https://hf.co/papers/2112.10668"
17+
},
18+
{
19+
"title": "Enhancing Environmental Robustness in Few-shot Learning via Conditional Representation Learning",
20+
"authors": "Qianyu Guo, Jingrong Wu, Tianxing Wu, Haofen Wang, Weifeng Ge, Wenqiang Zhang",
21+
"url": "https://hf.co/papers/2502.01183"
22+
},
23+
{
24+
"title": "Pushing the Limits of Simple Pipelines for Few-Shot Learning: External Data and Fine-Tuning Make a Difference",
25+
"authors": "Shell Xu Hu, Da Li, Jan St\u00fchmer, Minyoung Kim, Timothy M. Hospedales",
26+
"url": "https://hf.co/papers/2204.07305"
27+
}
28+
],
29+
"repositories_found": [
30+
{
31+
"name": "oscarknagg/few-shot",
32+
"url": "https://github.com/oscarknagg/few-shot",
33+
"stars": 1259
34+
},
35+
{
36+
"name": "sicara/easy-few-shot-learning",
37+
"url": "https://github.com/sicara/easy-few-shot-learning",
38+
"stars": 1225
39+
},
40+
{
41+
"name": "RL-VIG/LibFewShot",
42+
"url": "https://github.com/RL-VIG/LibFewShot",
43+
"stars": 1028
44+
},
45+
{
46+
"name": "huggingface/setfit",
47+
"url": "https://github.com/huggingface/setfit",
48+
"stars": 2522
49+
},
50+
{
51+
"name": "tata1661/FSL-Mate",
52+
"url": "https://github.com/tata1661/FSL-Mate",
53+
"stars": 1746
54+
}
55+
],
56+
"notes": "Comprehensive research completed on few-shot learning. Found key papers covering state-of-the-art methods, environmental robustness, multilingual approaches, and simple pipeline improvements. Identified practical implementations including comprehensive libraries (LibFewShot, FSL-Mate), ready-to-use frameworks (SetFit by HuggingFace), and tutorial-focused repositories (easy-few-shot-learning). The research spans both theoretical advances and practical implementation resources."
57+
}
58+
]

AIResearchHub/paper_manager.py

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def __init__(self):
1616
def load_papers(self) -> list[dict]:
1717
"""Load papers from JSON file."""
1818
if self.papers_file.exists():
19-
return json.loads(self.papers_file.read_text())
19+
return json.loads(self.papers_file.read_text())
2020
return []
2121

2222
def save_papers(self, papers: list[dict]):
@@ -51,10 +51,8 @@ def add_paper_to_research(self, research_id: int, paper_data: dict):
5151
entry["papers_found"].append({
5252
"title": paper_data.get("title", ""),
5353
"authors": paper_data.get("authors", ""),
54-
"url": paper_data.get("url", ""),
55-
"added": datetime.now().isoformat()
54+
"url": paper_data.get("url", "")
5655
})
57-
entry["status"] = "active"
5856
break
5957

6058
self.save_papers(papers)
@@ -68,10 +66,8 @@ def add_repo_to_research(self, research_id: int, repo_data: dict):
6866
entry["repositories_found"].append({
6967
"name": repo_data.get("name", ""),
7068
"url": repo_data.get("url", ""),
71-
"stars": repo_data.get("stars", 0),
72-
"added": datetime.now().isoformat()
69+
"stars": repo_data.get("stars", 0)
7370
})
74-
entry["status"] = "active"
7571
break
7672

7773
self.save_papers(papers)
@@ -80,17 +76,8 @@ def get_research_summary(self) -> dict[str, Any]:
8076
"""Get summary of all research activities."""
8177
papers = self.load_papers()
8278

83-
if not papers:
84-
return {"total_research": 0, "entries": []}
85-
86-
status_counts = {}
87-
for entry in papers:
88-
status = entry.get("status", "pending")
89-
status_counts[status] = status_counts.get(status, 0) + 1
90-
9179
return {
9280
"total_research": len(papers),
93-
"status_breakdown": status_counts,
9481
"entries": papers,
9582
"last_updated": datetime.now().isoformat()
9683
}
@@ -104,7 +91,6 @@ def update_research_status(self, research_id: int, status: str, notes: str = "")
10491
entry["status"] = status
10592
if notes:
10693
entry["notes"] = notes
107-
entry["last_updated"] = datetime.now().isoformat()
10894
break
10995

11096
self.save_papers(papers)

AIResearchHub/server.py

Lines changed: 18 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import json
22

3-
from mcp.server.fastmcp import FastMCP
3+
from fastmcp import FastMCP
44
from paper_manager import PaperManager
55

66
# Initialize MCP server and paper manager
@@ -31,31 +31,20 @@ async def research_topic(topic: str) -> dict:
3131
@mcp.tool(description="Get GitHub search strategies for finding implementations")
3232
async def get_github_searches(topic: str) -> dict:
3333
"""
34-
Generate optimized GitHub search commands for finding code implementations
34+
Generate GitHub search commands for finding code implementations
3535
3636
Args:
3737
topic: Research topic to find implementations for
3838
3939
Returns:
4040
GitHub search strategies and commands
4141
"""
42-
# Generate targeted search variations
43-
searches = [
44-
f"{topic} machine learning",
45-
f"{topic} python implementation",
46-
f"{topic} pytorch tensorflow",
47-
f"{topic} algorithm code"
48-
]
49-
5042
return {
5143
"success": True,
5244
"topic": topic,
53-
"github_searches": searches,
54-
"commands": [
55-
f"Search repos: {topic} stars:>50",
56-
f"Search code: {topic} language:python"
57-
],
58-
"instructions": "Use GitHub MCP with these search terms to find implementations"
45+
"github_searches": [f"{topic} implementation", f"{topic} python"],
46+
"commands": [f"Search repos: {topic} stars:>10"],
47+
"instructions": "Use GitHub MCP with these search terms"
5948
}
6049

6150
@mcp.tool(description="Add a paper to a research entry")
@@ -116,62 +105,25 @@ async def add_repository(research_id: int, name: str, url: str = "", stars: int
116105
"message": f"Repository '{name}' added to research #{research_id}"
117106
}
118107

119-
@mcp.tool(description="Search local research database")
120-
async def search_research(query: str) -> dict:
121-
"""
122-
Search your local research database for matching content
123-
124-
Args:
125-
query: Search term to match against research entries
126-
127-
Returns:
128-
Matching research entries
129-
"""
130-
papers = paper_manager.load_papers()
131-
matching_entries = []
132-
133-
for entry in papers:
134-
if (query.lower() in entry["topic"].lower() or
135-
any(query.lower() in paper.get("title", "").lower()
136-
for paper in entry.get("papers_found", [])) or
137-
any(query.lower() in repo.get("name", "").lower()
138-
for repo in entry.get("repositories_found", []))):
139-
matching_entries.append(entry)
140-
141-
return {
142-
"success": True,
143-
"query": query,
144-
"matches_found": len(matching_entries),
145-
"entries": matching_entries
146-
}
147-
148108
@mcp.tool(description="Update research status and add notes")
149109
async def update_research_status(research_id: int, status: str, notes: str = "") -> dict:
150110
"""
151111
Update the status of a research entry
152112
153113
Args:
154114
research_id: ID of the research entry to update
155-
status: New status (pending, active, complete, archived)
115+
status: New status (pending, active, complete)
156116
notes: Optional notes about the research progress
157117
158118
Returns:
159119
Success status and details
160120
"""
161-
valid_statuses = ["pending", "active", "complete", "archived"]
162-
if status not in valid_statuses:
163-
return {
164-
"success": False,
165-
"error": f"Invalid status. Must be one of: {', '.join(valid_statuses)}"
166-
}
167-
168121
paper_manager.update_research_status(research_id, status, notes)
169122

170123
return {
171124
"success": True,
172125
"research_id": research_id,
173126
"status": status,
174-
"notes": notes,
175127
"message": f"Research #{research_id} status updated to '{status}'"
176128
}
177129

@@ -181,46 +133,18 @@ def research_workflow_prompt(topic: str) -> str:
181133
return f"""Research Topic: {topic}
182134
183135
WORKFLOW:
184-
1. Use: research_topic(topic="{topic}")
185-
- Creates tracking entry with research ID
186-
187-
2. Search for papers using HuggingFace MCP tools:
188-
- Use: mcp_huggingface_paper_search(query="{topic}")
189-
- For each important paper, use: add_paper(research_id, title, authors, url)
190-
191-
3. Use: get_github_searches(topic="{topic}")
192-
- Get optimized search strategies for code implementations
193-
194-
4. Search for repositories using GitHub MCP tools:
195-
- Use: mcp_github_search_repositories(query="...")
196-
- For each important repo, use: add_repository(research_id, name, url, stars)
197-
198-
5. Use: search_research(query="{topic}")
199-
- Review your complete research collection
200-
201-
6. Use: update_research_status(research_id, "complete", "Research completed with X papers and Y repositories")
202-
- Mark research as complete when finished
203-
204-
7. Check research://status for your research dashboard
205-
206-
GOAL: Build comprehensive knowledge linking papers with implementations
207-
NOTE: Remember to save findings and update status when complete!
208-
209-
AI RESEARCH HUB TOOLS:
210-
- research_topic() - Start new research
211-
- add_paper() - Save paper findings
212-
- add_repository() - Save repo findings
213-
- get_github_searches() - Get search strategies
214-
- search_research() - Search saved research
215-
- update_research_status() - Update status
216-
217-
STATUS OPTIONS:
218-
- "pending": Just started, no findings yet
219-
- "active": Currently gathering papers/repos (auto-set when adding content)
220-
- "complete": Research finished with comprehensive findings
221-
- "archived": Older research for reference"""
222-
223-
@mcp.resource("research://status")
136+
1. research_topic(topic="{topic}") - Create research entry
137+
2. Search HuggingFace papers: mcp_huggingface_paper_search(query="{topic}")
138+
3. get_github_searches(topic="{topic}") - Get search strategies
139+
4. Search GitHub repos: mcp_github_search_repositories(query="{topic}")
140+
5. Add findings: add_paper() and add_repository()
141+
6. update_research_status(research_id, "complete") - Mark done
142+
7. Check research://status for dashboard
143+
144+
TOOLS: research_topic, add_paper, add_repository, get_github_searches, update_research_status
145+
GOAL: Link papers with implementations"""
146+
147+
@mcp.resource("status://dashboard")
224148
def research_status() -> str:
225149
"""Current research status and saved topics"""
226150
summary = paper_manager.get_research_summary()

0 commit comments

Comments
 (0)