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

Prerequisites

  • Python 3.11+
  • A Civic account at app.civic.com with a configured toolkit
  • A Civic 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:

Environment Variables

Get Your Credentials

How to generate a Civic token and configure toolkit URL parameters

Connecting to Civic

Use MCPStreamableHttpPlugin as an async context manager to load all Civic tools into the kernel:
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:

Reference Implementation

semantic-kernel-reference-implementation-civic

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

Next Steps

Agent Deployment

Production deployment guide: profile locking, URL params, authentication

Guardrails

Constrain what tools your agent can call

Audit Trail

Query what your agent did via Civic Chat

Get Credentials

Token generation and URL parameter reference