Overview
Integrate Civic Nexus with Anthropic’s Messages API using the native MCP connector feature. This is built directly into the API - no separate MCP client needed!Native MCP Support: The Anthropic Messages API includes built-in MCP connector support. Just add the
mcp_servers
parameter to your API calls.Prerequisites
Prerequisites:
- Node.js 18+ project (Next.js 14+ or any Node.js framework)
- Civic account - Create account
- Connect services at nexus.civic.com (GitHub, Slack, etc.)
- Anthropic API Key - Get yours at console.anthropic.com
- Complete Civic Auth setup (see Access Token Setup below)
Access Token Setup (Next.js + Civic Auth)
Why Civic Auth? Nexus 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 a.env.local
file in your project root:
Getting your Civic Client ID:
- Visit auth.civic.com
- Create a new application or use an existing one
- Copy the Client ID from your application settings
Installation
Install the required packages:Basic Setup
Create Message with MCP Connector
- Add
mcp_servers
parameter to your messages.create() call - Include the beta header:
"anthropic-beta": "mcp-client-2025-04-04"
- Pass your Civic access token as
authorization_token
- That’s it! No tool looping, no MCP client setup
Complete Example: Next.js API Route
Streaming Responses
For real-time streaming:Tool Configuration (Optional)
Restrict which tools Claude can use:Key Advantages
Native Integration
Built directly into Messages API - no extra SDKs
Automatic Tools
Claude discovers and calls tools automatically
Simple Setup
Just add mcp_servers parameter to API calls
Streaming Support
Real-time responses with stream: true
Nexus Authentication
Required MCP Server Config
Required MCP Server Config
Required Beta Header
Required Beta Header
Getting the Access Token
Getting the Access Token
Response Format
Claude returnsmcp_tool_use
blocks in the response:
Current Limitations
The MCP connector currently only supports:
- Tool calls (not MCP resources or prompts)
- HTTP servers (not STDIO servers)
- SSE and Streamable HTTP transports
Comparison with Other Approaches
Feature | Anthropic MCP Connector | OpenAI Agents SDK | Vercel AI SDK |
---|---|---|---|
Setup Complexity | Low | Low | Medium |
MCP SDK Needed | No | No | Yes |
Tool Looping | No (automatic) | No (automatic) | Yes (manual) |
Best For | Direct API usage | Quick prototypes | Next.js apps |
Streaming | Yes | Yes | Yes |
Next Steps
1
Test with Simple Queries
Try “list my GitHub repos” or “search Slack messages about X”
2
Connect More Services
Visit nexus.civic.com to connect additional tools
3
Configure Tool Access
Use tool_configuration to restrict which tools Claude can use
4
Deploy
Deploy your application to production