Skip to main content

Semantic Kernel

Connect a Semantic Kernel agent to Leadovaro using MCPStreamableHttpPlugin. The plugin registers all Leadovaro tools as kernel functions and makes them available to your agent.

Prerequisites​

  • Python 3.11+
  • A Leadovaro account at app.leadovaro.com with a configured toolkit
  • A Leadovaro token and an Anthropic API key

Installation​

Semantic Kernel requires Pydantic v2 (not v3/v4). Use a dedicated virtual environment if you have other packages installed:

pip install "semantic-kernel" "anthropic" "pydantic>=2.0.0,<3.0.0" python-dotenv

Environment Variables​

LEADOVARO_URL=/_sites/app.leadovaro.com/hub/mcp?profile=your-toolkit
LEADOVARO_TOKEN=your-leadovaro-token
ANTHROPIC_API_KEY=your-anthropic-key
Get Your Credentials

How to generate a Leadovaro token and configure toolkit URL parameters

Connecting to Leadovaro​

Use MCPStreamableHttpPlugin as an async context manager to load all Leadovaro tools into the kernel:

import os
import asyncio
from dotenv import load_dotenv
from semantic_kernel import Kernel
from semantic_kernel.connectors.mcp import MCPStreamableHttpPlugin
from semantic_kernel.connectors.ai.anthropic import AnthropicChatCompletion
from semantic_kernel.connectors.ai.function_choice_behavior import FunctionChoiceBehavior

load_dotenv()

async def main():
kernel = Kernel()

svc = AnthropicChatCompletion(
ai_model_id="claude-sonnet-4-6",
api_key=os.environ["ANTHROPIC_API_KEY"],
)
kernel.add_service(svc)

async with MCPStreamableHttpPlugin(
name="leadovaro-platform", # name is required
url=os.environ["LEADOVARO_URL"],
headers={"Authorization": f"Bearer {os.environ['LEADOVARO_TOKEN']}"},
) as leadovaro_plugin:
kernel.add_plugin(leadovaro_plugin)

plugin = kernel.plugins.get("leadovaro-platform")
print(f"{len(plugin.functions)} tools loaded")

settings = svc.get_prompt_execution_settings_class()()
settings.function_choice_behavior = FunctionChoiceBehavior.Auto()

result = await kernel.invoke_prompt(
"What events do I have today?",
settings=settings,
)
print(result)

asyncio.run(main())
note

The name parameter is required for MCPStreamableHttpPlugin. Use kernel.invoke_prompt() directly — not kernel.get_service(AnthropicChatCompletion) followed by chat_completion.get_chat_message_contents(), which raises a KernelServiceNotFoundError.

Production Configuration​

For production agents, lock to a specific toolkit using the profile URL parameter:

LEADOVARO_URL=/_sites/app.leadovaro.com/hub/mcp?profile=your-production-toolkit

Reference Implementation​

semantic-kernel-reference-implementation-leadovaro

Complete implementation with FastAPI chat UI, isolated venv setup, and deployment guide

Next Steps​