Skip to main content

Overview

Server-Sent Events (SSE) based servers for remote MCP tool access.

Usage

from upsonic import Task, Agent

# Define SSE-based MCP servers
class FetchMCP:
    url = "https://your-mcp-server.com/sse"

class SearchMCP:
    url = "https://search-mcp-server.com/sse"

# Create task with MCP tools
task = Task(
    description="Search for the latest technology news in Europe using the SearchMCP tool, then use FetchMCP to retrieve the full content of the top 3 articles.",
    tools=[FetchMCP, SearchMCP]
)

# Create agent
agent = Agent(
    name="News Agent",
    model="openai/gpt-4o"
)

# Execute
result = agent.do(task)
print(result)

Parameters

  • url (str): The SSE endpoint URL of the MCP server
  • tool_name_prefix (str): Optional prefix to add to all tool names (prevents collisions)

Using Tool Name Prefix

Add a tool_name_prefix when using multiple SSE-based MCP servers with overlapping tool names:
class FetchMCP:
    url = "https://fetch-mcp.example.com/sse"
    tool_name_prefix = "fetch"  # Tools become: fetch_get_url, etc.

class SearchMCP:
    url = "https://search-mcp.example.com/sse"
    tool_name_prefix = "search"  # Tools become: search_query, etc.

Characteristics

  • Remote server access over HTTP
  • Real-time event streaming
  • Suitable for cloud-hosted MCP servers
  • No local installation required