11import  json 
22
3- from  mcp . server . fastmcp  import  FastMCP 
3+ from  fastmcp  import  FastMCP 
44from  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" )  
3232async  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 }  ,
45-         f"{ topic }  , 
46-         f"{ topic }  ,
47-         f"{ topic }  
48-     ]
49-     
5042    return  {
5143        "success" : True ,
5244        "topic" : topic ,
53-         "github_searches" : searches ,
54-         "commands" : [
55-             f"Search repos: { topic }  ,
56-             f"Search code: { topic }  
57-         ],
58-         "instructions" : "Use GitHub MCP with these search terms to find implementations" 
45+         "github_searches" : [f"{ topic }  , f"{ topic }  ],
46+         "commands" : [f"Search repos: { topic }  ],
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 } { 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" ) 
149109async  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 }  
176128    }
177129
@@ -181,46 +133,18 @@ def research_workflow_prompt(topic: str) -> str:
181133    return  f"""Research Topic: { topic }  
182134
183135WORKFLOW: 
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 }  
137+ 2. Search HuggingFace papers: mcp_huggingface_paper_search(query="{ topic }  
138+ 3. get_github_searches(topic="{ topic }  
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" ) 
224148def  research_status () ->  str :
225149    """Current research status and saved topics""" 
226150    summary  =  paper_manager .get_research_summary ()
0 commit comments