Overview
Build AI applications with Civic and the Vercel AI SDK. Your agents can access external tools via MCP — GitHub, Slack, Google Workspace, and more.Framework: This guide is written for Next.js projects. The core MCP client setup works with any JavaScript framework, but the authentication examples below use Next.js-specific APIs.
Quick Start
The fastest way to get started is with the starter template:AI Chatbot Starter
Clone our Next.js + Vercel AI SDK template with Civic pre-configured. Includes authentication, streaming, and tool calling out of the box.
Build From Scratch
Prerequisites
- Next.js 14+ project with App Router
- Civic account at app.civic.com with at least one MCP server connected
- Node.js 18+
Installation
Vercel AI SDK version:
experimental_createMCPClient ships in the ai package for AI SDK v5. If you’re on v6+, install @ai-sdk/mcp and import from there instead:Authentication
Why user auth for tool calls? Civic needs to know which user’s toolkit and permissions to use. For multi-user apps, each user gets their own access token tied to their Civic account. Why Civic Auth? Civic needs to identify which user is accessing tools and authorize their permissions. Civic Auth provides the secure access token. (Support for additional identity providers coming soon.)- 1. next.config.ts
- 2. API Route
- 3. Middleware
- 4. Get Token
Full Integration Guide
Complete Next.js setup with frontend components, configuration options, and deployment details
AI Prompt for Next.js
Use Claude, ChatGPT, or other AI assistants to automatically set up Civic Auth
Get your Client ID at auth.civic.com
Environment Variables
Create Civic Tools Helper
App Router API Route
Using Anthropic/Claude? Replace the model:
Next Steps
1
Try the Starter Template
Clone ai-chatbot for a working example with UI, auth, and streaming
2
Connect Your Services
Visit app.civic.com to connect GitHub, Slack, Notion, and other services
3
Test Tool Calls
Run locally and ask your AI to “list my GitHub repos” or “search Slack messages”
4
Deploy to Production
Deploy to Vercel — all environment variables are pre-configured in the starter template
Starter Template
Full Next.js + Vercel AI SDK example with Civic integration
Get Help
Developer Slack

