Skip to main content
Connect a LlamaIndex agent to Civic using BasicMCPClient and McpToolSpec. LlamaIndex’s MCP integration discovers all available tools and exposes them to a FunctionAgent.

Prerequisites

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

Installation

Environment Variables

Get Your Credentials

How to generate a Civic token and configure toolkit URL parameters

Connecting to Civic

Use BasicMCPClient to connect (URL is positional, not a keyword argument), then convert tools with McpToolSpec:
Pass the URL as a positional argument to BasicMCPClient — using url= as a keyword will raise an error. Use FunctionAgent from llama_index.core.agent.workflowReActAgent.from_tools is not available in LlamaIndex v0.14+.

Production Configuration

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

Reference Implementation

llamaindex-reference-implementation-civic

Complete implementation with FastAPI chat UI 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