from upsonic import Task, Agent
# MCP server with authentication
class AuthenticatedMCP:
command = "npx"
args = ["-y", "@company/private-mcp-server"]
env = {
"API_KEY": "your_api_key_here",
"API_SECRET": "your_api_secret_here",
"AUTH_TOKEN": "bearer_token_here"
}
# Multiple servers with different auth
class GitHubMCP:
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxx"
}
class SlackMCP:
command = "uvx"
args = ["mcp-server-slack"]
env = {
"SLACK_BOT_TOKEN": "xoxb-xxxxx",
"SLACK_TEAM_ID": "T1234567"
}
# Create task with authenticated tools
task = Task(
description="Fetch the latest open issues from the repository 'my-project/repo' using the GitHub tool, then send a summary of these issues to the '#dev-team' channel on Slack.",
tools=[GitHubMCP, SlackMCP]
)
# Create agent
agent = Agent(
name="Integration Agent",
model="openai/gpt-4o"
)
# Execute
result = agent.do(task)
print(result)