Skip to main content
Use this prompt with your preferred AI assistant (Claude, Cursor, ChatGPT, etc.) to connect your AI agent to Civic. The prompt covers guardrails, audit logging, secret management, and access to 95+ MCP servers.

How to Use

  1. Copy the prompt below and paste it into your AI assistant
  2. Tell the assistant which agent framework you’re using (Anthropic SDK, LangChain, OpenAI Agents, etc.)
  3. The assistant will walk you through setting up your MCP connection with the correct code for your framework
  4. Configure security at app.civic.com — guardrails, toolkits, and audit are managed in the platform, not in code

Integration Prompt

CIVIC_URL=https://app.civic.com/hub/mcp?profile=your-toolkit CIVIC_TOKEN=your-token-here
Note: Use client.messages.create (NOT client.beta.messages). The parameter is mcp_servers (not tools). Field is authorization_token, not { type: 'bearer', token }.

OpenAI Agents SDK (TypeScript)

Note: openai is bundled as a dependency of @openai/agents — no separate install needed.

LangChain / LangGraph (Python)

Package: pip install langchain-mcp-adapters langgraph

Pydantic AI (Python)

Package: pip install pydantic-ai

Vercel AI SDK (TypeScript)

Packages: pnpm install ai @ai-sdk/anthropic @modelcontextprotocol/sdk v6+: import experimental_createMCPClient from "@ai-sdk/mcp" instead of "ai".

Any Other Framework (Generic MCP)

Package: pip install mcp

Interactive Clients (Claude Desktop, Cursor, VS Code, etc.)

No code needed. Add this MCP URL in your client’s MCP settings:
A browser window will open for OAuth sign-in. That’s it.

Step 3: Configure Security (In the Platform, Not Code)

After connecting, the developer configures security at app.civic.com:
  • Guardrails: Block PII, credit cards, prompt injection; redact sensitive data from responses
  • Toolkits: Group MCP servers into focused profiles (e.g., “support” = Gmail + Slack)
  • Audit logs: Query what the agent did via Civic Chat
  • Revocation: Instantly block tools, servers, or entire toolkits
None of this requires application code. It’s all managed in the Civic platform.

Error Handling

When integrating Civic, add handling for these failure cases: Authentication failures — Token expired (30-day expiry) or missing. The MCP client will receive an HTTP 401. Handle by prompting the developer to regenerate the token at app.civic.com.
Guardrail blocks — If a guardrail blocks a tool call (e.g., PII detected in the request), the tool call returns an error response — not a crash. The agent will see the error and can inform the user or try a different approach. No special error handling is needed; the agent handles this naturally. No tools returned — The MCP URL may be missing ?profile=your-toolkit, or the toolkit has no servers configured. Check CIVIC_URL includes the profile parameter. Transport mismatch — Civic uses Streamable HTTP. If you see connection errors, verify your framework is not trying to connect via stdio or plain SSE.

Common Issues

  • Auth errors: Token may be expired (30-day expiry). Regenerate at app.civic.com
  • No tools: MCP URL may be missing ?profile=your-toolkit. Check the toolkit name
  • Connection errors: Civic uses Streamable HTTP transport, not stdio or plain SSE
  • Docs: Full framework guides at https://docs.civic.com/civic/quickstart

All Framework Guides

Correct vs. Incorrect Output

After pasting the prompt, review what your AI assistant generates. Here’s how to tell if it got it right:
The AI generated an MCP connection. Guardrails, audit, and revocation are handled by Civic server-side. No security code needed in your app.

Verify Your Integration

After the AI generates code, check these three things before running:
1

Environment variables, not hardcoded tokens

Confirm CIVIC_URL and CIVIC_TOKEN are read from process.env or os.environ — never hardcoded in source. If the AI put a token string directly in the code, move it to .env.
2

Correct transport type

Civic uses Streamable HTTP, not stdio or plain SSE. Look for streamable_http, StreamableHTTPClientTransport, or type: "url" in the generated code. If you see type: "stdio" or a subprocess spawn — that’s wrong.
3

No invented APIs

The generated code should only call your framework’s standard MCP client methods (e.g., messages.create, hostedMcpTool, MCPServerStreamableHTTP). If it imports from civic, @civic/hub, or civic-guardrails — those packages don’t exist.

What the AI Assistant Will Do

When you use this prompt, the AI assistant will:
  1. Ask which framework you’re using (Anthropic SDK, OpenAI Agents, LangChain, etc.)
  2. Generate the connection code — typically 5-15 lines to connect to Civic via MCP
  3. Set up environment variables for your MCP URL and token
  4. Point you to app.civic.com for guardrail and toolkit configuration

Supported AI Assistants

This prompt has been tested with:
  • Claude (Anthropic)
  • Cursor (with Claude)
  • ChatGPT (OpenAI)
  • GitHub Copilot Chat
Make sure your AI assistant has the ability to run terminal commands and edit files in your project.