-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.py
More file actions
28 lines (23 loc) · 933 Bytes
/
Copy pathserver.py
File metadata and controls
28 lines (23 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from mcp.server.fastmcp import FastMCP
from agents import run_research
import os
# Initialize the MCP Server
# "dependencies" tells the client (VS Code) what python libraries to install if it manages the environment
mcp = FastMCP("Deep Researcher", dependencies=["crewai", "linkup-sdk", "python-dotenv"])
@mcp.tool()
def research_topic(topic: str) -> str:
"""
Performs deep internet research on a specific topic using AI agents.
Args:
topic: The subject to research (e.g., "Latest trends in AI 2025")
"""
try:
# Ensure the key is loaded
if not os.getenv("LINKUP_API_KEY"):
return "Error: LINKUP_API_KEY not found in environment variables."
return run_research(topic)
except Exception as e:
return f"Research failed: {str(e)}"
# Run the server using stdio (Standard Input/Output)
if __name__ == "__main__":
mcp.run(transport="stdio")