Skip to main content

Scalar Agent SDK - Connect your AI agent to Scalar's OpenAPI MCP servers

Project description

Scalar Agent SDK (Python)

Connect your AI agent to Scalar's OpenAPI MCP servers. Provides native integrations for the OpenAI Agents SDK and Anthropic Claude Agent SDK.

Installation

pip install scalar-agent

With provider extras:

# For Anthropic
pip install "scalar-agent[anthropic]"

# For OpenAI
pip install "scalar-agent[openai]"

# Both
pip install "scalar-agent[all]"

Setup

from scalar_agent import agent_scalar

scalar = agent_scalar(token="your-personal-token")
installation = scalar.installation("your-installation-id")

Providers

OpenAI Agents SDK

Returns params for MCPServerStreamableHttp from openai-agents. The agent runtime handles tool discovery and execution natively.

from scalar_agent import agent_scalar
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

scalar = agent_scalar(token="your-personal-token")
installation = scalar.installation("your-installation-id")

server = MCPServerStreamableHttp(**installation.create_openai_mcp())
await server.connect()

agent = Agent(name="api-agent", mcp_servers=[server])

result = await Runner.run(agent, "Which APIs are available that let me create a planet?")
print(result.final_output)

await server.cleanup()

Anthropic Claude Agent SDK

Returns an MCP server configuration for claude_agent_sdk.

from scalar_agent import agent_scalar
from claude_agent_sdk import query
from claude_agent_sdk.types import ClaudeAgentOptions, ResultMessage

scalar = agent_scalar(token="your-personal-token")
installation = scalar.installation("your-installation-id")

async for message in query(
    prompt="Which APIs are available that let me create a planet?",
    options=ClaudeAgentOptions(
        mcp_servers={"scalar": installation.create_anthropic_mcp()},
        allowed_tools=["mcp__scalar__*"],
    ),
):
    if isinstance(message, ResultMessage):
        print(message.result)

Configuration

Parameter Type Description
token str Your Scalar Personal Token used to authenticate requests to your MCP
base_url str Base URL of the Scalar MCP server. Defaults to the Scalar environment

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scalar_agent-0.1.0.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scalar_agent-0.1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file scalar_agent-0.1.0.tar.gz.

File metadata

  • Download URL: scalar_agent-0.1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for scalar_agent-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f6acb9698eaf03d6ff2e9337eb4b484b42ed14128fb05444dab9ab7cf8941a4
MD5 c48d15c16bc9a45dd0fd273948b25b1e
BLAKE2b-256 aca0b7b0d90ae25532fb3447a35736ecb0f6f60893a2064a304f2472b95a0808

See more details on using hashes here.

File details

Details for the file scalar_agent-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: scalar_agent-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for scalar_agent-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 811a3789c77695ac61521ae291d965e0d435fc4f0c2909054f9356c5ad3c2e97
MD5 1023c93108a757148e4d2d97b20767d2
BLAKE2b-256 951116ba96161d5ccb2f1db0e7468dfa3ab091cff424b8a155f501a8531cda14

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page