Circle MCP Server
Enables AI assistants to interact with Circle.so communities through Google OAuth 2.0, providing 20+ tools for comprehensive community management.
README
Circle MCP Server
Production-grade Model Context Protocol (MCP) server for the Circle community platform. This server enables AI assistants to interact with Circle.so communities through Google OAuth 2.0 authentication and provides 20+ tools for comprehensive community management.
š Table of Contents
- Features
- Architecture
- Prerequisites
- Installation
- Configuration
- Building & Testing
- IDE Integration
- Available Tools
- Usage Examples
- Troubleshooting
- Development
- License
⨠Features
Core Capabilities
- š Google OAuth 2.0 Integration - Secure authentication via Google accounts
- š Circle API Integration - Seamless integration with Circle.so communities
- š”ļø JWT Token Management - Automatic token refresh and secure storage
- š¦ Rate Limiting - Built-in protection against API rate limits
- š Request Retry Logic - Exponential backoff for failed requests
- š Comprehensive Logging - Winston-based structured logging
- šÆ 20+ Tools - Complete Circle API coverage
- š§ Type-Safe - Full TypeScript implementation with Zod validation
Security Features
- ā Secure credential storage
- ā Automatic token refresh
- ā OAuth 2.0 authorization code flow
- ā Read-only mode support
- ā Environment-based configuration
šļø Architecture
āāāāāāāāāāāāāāāāāāā
ā AI Assistant ā (Claude Desktop, VS Code, etc.)
āāāāāāāāāā¬āāāāāāāāā
ā MCP Protocol (stdio)
ā¼
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Circle MCP Server ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Integrated Auth Manager ā ā
ā ā āā GCP OAuth 2.0 ā ā
ā ā āā Circle JWT Auth ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā Circle API Client ā ā
ā ā āā Rate Limiting ā ā
ā ā āā Retry Logic ā ā
ā ā āā Error Handling ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā 20+ MCP Tools ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāā¬āāāāāāāāāāāāāāāāāāāā
ā HTTPS
ā¼
āāāāāāāāāāāāāāāāāāāā
ā Circle.so API ā
āāāāāāāāāāāāāāāāāāāā
Authentication Flow:
- User triggers
authenticate_with_googletool - OAuth server starts on localhost:3000
- Browser opens for Google sign-in
- User authorizes the application
- Server receives OAuth callback with authorization code
- Exchanges code for GCP access/refresh tokens
- Retrieves user email from Google
- Authenticates with Circle API using email
- Stores both GCP and Circle tokens securely
š¦ Prerequisites
Before you begin, ensure you have:
- Node.js v18 or higher (Download)
- npm v9 or higher (comes with Node.js)
- TypeScript knowledge (helpful but not required)
- Google Cloud Platform account (free tier works)
- Circle.so community with headless access token
- AI Assistant that supports MCP (Claude Desktop, VS Code with Cline, etc.)
š Installation
1. Clone or Download the Project
cd /path/to/your/projects
# If you have this as a git repo:
git clone <repository-url> circle-mcp
cd circle-mcp
# Or if you already have the folder:
cd circle-mcp
2. Install Dependencies
npm install
This installs all required packages:
@modelcontextprotocol/sdk- MCP protocol implementationgoogle-auth-library- Google OAuth 2.0googleapis- Google APIsexpress- OAuth callback serveraxios- HTTP clientwinston- Loggingzod- Schema validation- And more...
āļø Configuration
1. Google Cloud Platform (GCP) Setup
Step 1.1: Create a GCP Project
- Go to Google Cloud Console
- Click "Select a project" ā "New Project"
- Enter project name (e.g., "Circle MCP Auth")
- Click "Create"
Step 1.2: Enable Google+ API
- In your project, go to APIs & Services ā Library
- Search for "Google+ API"
- Click on it and press Enable
Step 1.3: Configure OAuth Consent Screen
- Go to APIs & Services ā OAuth consent screen
- Choose External (unless you have a Google Workspace)
- Fill in the required fields:
- App name: Circle MCP Server
- User support email: Your email
- Developer contact: Your email
- Click Save and Continue
- Scopes: Skip this step (click Save and Continue)
- Test users: Add your Google account email
- Click Save and Continue
Step 1.4: Create OAuth 2.0 Credentials
- Go to APIs & Services ā Credentials
- Click Create Credentials ā OAuth 2.0 Client ID
- Choose Web application
- Configure:
- Name: Circle MCP OAuth Client
- Authorized redirect URIs: Add
http://localhost:3000/auth/google/callback
- Click Create
- Save your credentials:
- Copy the Client ID (ends with
.apps.googleusercontent.com) - Copy the Client Secret (starts with
GOCSPX-)
- Copy the Client ID (ends with
2. Environment Variables
Create a .env file in the project root:
# Create .env file
touch .env
Add the following configuration:
# Circle.so Configuration
CIRCLE_HEADLESS_TOKEN=your_circle_headless_token
CIRCLE_COMMUNITY_URL=https://your-community.circle.so
CIRCLE_HEADLESS_BASE_URL=https://app.circle.so
# Google Cloud Platform OAuth 2.0
GCP_CLIENT_ID=your-client-id-here.apps.googleusercontent.com
GCP_CLIENT_SECRET=GOCSPX-your-client-secret-here
GCP_REDIRECT_URI=http://localhost:3000/auth/google/callback
OAUTH_PORT=3000
# Server Configuration
READ_ONLY_MODE=false
LOG_LEVEL=info
How to Get Circle Credentials:
-
Circle Headless Token:
- Log in to your Circle community admin panel
- Go to Settings ā API
- Generate a headless access token
- Copy the token
-
Circle Community URL:
- Your community's URL (e.g.,
https://learn.1to10x.ai)
- Your community's URL (e.g.,
Configuration Options:
| Variable | Required | Description | Example |
|---|---|---|---|
CIRCLE_HEADLESS_TOKEN |
Yes | Circle API headless token | abc123... |
CIRCLE_COMMUNITY_URL |
Yes | Your Circle community URL | https://community.circle.so |
GCP_CLIENT_ID |
Yes | Google OAuth Client ID | 123-abc.apps.googleusercontent.com |
GCP_CLIENT_SECRET |
Yes | Google OAuth Client Secret | GOCSPX-abcd1234 |
GCP_REDIRECT_URI |
Yes | OAuth callback URL | http://localhost:3000/auth/google/callback |
OAUTH_PORT |
No | OAuth server port (default: 3000) | 3000 |
READ_ONLY_MODE |
No | Disable write operations (default: false) | false |
LOG_LEVEL |
No | Logging level (default: info) | info |
šØ Building & Testing
Build the Project
npm run build
This compiles TypeScript to JavaScript in the dist/ folder.
Verify Setup
node verify-setup.js
This checks:
- ā All required files exist
- ā Dependencies are installed
- ā Environment variables are configured
- ā TypeScript compiles without errors
- ā Port 3000 is available
- ā GCP credentials are valid
Test OAuth Flow
# Configuration test
node test-oauth-flow.js
# Automated server test
node test-oauth-automated.js
# Interactive OAuth testing
node test-oauth-interactive.js
Run the Server
npm start
š„ļø IDE Integration
1. Claude Desktop
Claude Desktop is Anthropic's official desktop app that supports MCP servers.
Step 1.1: Install Claude Desktop
Download from claude.ai
Step 1.2: Locate Configuration File
The configuration file location depends on your OS:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Windows:
%APPDATA%\Claude\claude_desktop_config.json
Linux:
~/.config/Claude/claude_desktop_config.json
Step 1.3: Edit Configuration
Open claude_desktop_config.json and add:
{
"mcpServers": {
"circle": {
"command": "node",
"args": ["C:\\Users\\admin\\Desktop\\circle-mcp\\dist\\index.js"],
"env": {
"CIRCLE_HEADLESS_TOKEN": "your_circle_token_here",
"CIRCLE_COMMUNITY_URL": "https://your-community.circle.so",
"CIRCLE_HEADLESS_BASE_URL": "https://app.circle.so",
"GCP_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GCP_CLIENT_SECRET": "GOCSPX-your-secret",
"GCP_REDIRECT_URI": "http://localhost:3000/auth/google/callback",
"OAUTH_PORT": "3000",
"LOG_LEVEL": "info"
}
}
}
}
Important Notes:
- Replace
C:\\Users\\admin\\Desktop\\circle-mcp\\dist\\index.jswith your actual path - On Windows, use double backslashes (
\\) or forward slashes (/) - On macOS/Linux, use forward slashes (
/) - Replace all credential placeholders with your actual values
Step 1.4: Restart Claude Desktop
- Quit Claude Desktop completely
- Relaunch Claude Desktop
- The Circle MCP server will start automatically
Step 1.5: Verify Integration
In Claude Desktop, type:
Can you check if the Circle MCP server is connected?
If connected, Claude can use tools like:
Please authenticate with Google so I can access Circle features.
2. VS Code with Cline
Cline is a VS Code extension that supports MCP servers.
Step 2.1: Install Cline Extension
- Open VS Code
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "Cline"
- Click Install
Step 2.2: Configure Cline
- Open Command Palette (Ctrl+Shift+P / Cmd+Shift+P)
- Type "Cline: Open Settings"
- Navigate to MCP Servers section
- Click "Edit in settings.json"
Add this configuration:
{
"cline.mcpServers": {
"circle": {
"command": "node",
"args": ["/absolute/path/to/circle-mcp/dist/index.js"],
"env": {
"CIRCLE_HEADLESS_TOKEN": "your_token",
"CIRCLE_COMMUNITY_URL": "https://your-community.circle.so",
"GCP_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GCP_CLIENT_SECRET": "GOCSPX-your-secret",
"GCP_REDIRECT_URI": "http://localhost:3000/auth/google/callback"
}
}
}
}
Step 2.3: Reload VS Code
- Open Command Palette
- Type "Developer: Reload Window"
- Press Enter
Step 2.4: Use Circle Tools in Cline
Open Cline chat and try:
Authenticate with Google to access Circle community
3. Other MCP Clients
MCP Inspector (Testing Tool)
For development and debugging:
npx @modelcontextprotocol/inspector node dist/index.js
Then open http://localhost:6274 in your browser.
Custom Integration
Any MCP-compatible client can connect using stdio transport:
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
const transport = new StdioClientTransport({
command: 'node',
args: ['/path/to/circle-mcp/dist/index.js'],
env: { /* environment variables */ }
});
const client = new Client({
name: 'my-client',
version: '1.0.0'
}, {
capabilities: {}
});
await client.connect(transport);
š ļø Available Tools
The Circle MCP server provides 20+ tools across multiple categories:
Authentication Tools
| Tool | Description | Auth Required |
|---|---|---|
authenticate_with_google |
Start Google OAuth flow | No |
check_auth_status |
Check current authentication status | No |
logout |
Logout and clear tokens | Yes |
Profile Tools
| Tool | Description | Auth Required |
|---|---|---|
get_my_profile |
Get your Circle profile | Yes |
update_my_profile |
Update your profile | Yes |
Course Tools
| Tool | Description | Auth Required |
|---|---|---|
get_my_courses |
Get courses you're enrolled in | Yes |
get_course_details |
Get detailed course information | Yes |
Post Tools
| Tool | Description | Auth Required |
|---|---|---|
get_posts |
Get posts from community | Yes |
create_post |
Create a new post | Yes |
update_post |
Update an existing post | Yes |
delete_post |
Delete a post | Yes |
like_post |
Like a post | Yes |
unlike_post |
Unlike a post | Yes |
Space Tools
| Tool | Description | Auth Required |
|---|---|---|
get_spaces |
Get all community spaces | Yes |
get_space_members |
Get members of a space | Yes |
Event Tools
| Tool | Description | Auth Required |
|---|---|---|
get_events |
Get upcoming events | Yes |
get_event_details |
Get event details | Yes |
rsvp_event |
RSVP to an event | Yes |
Notification Tools
| Tool | Description | Auth Required |
|---|---|---|
get_notifications |
Get your notifications | Yes |
mark_notification_read |
Mark notification as read | Yes |
Message Tools
| Tool | Description | Auth Required |
|---|---|---|
get_direct_messages |
Get your direct messages | Yes |
send_direct_message |
Send a direct message | Yes |
Feed Tools
| Tool | Description | Auth Required |
|---|---|---|
get_feed |
Get your personalized feed | Yes |
Comment Tools
| Tool | Description | Auth Required |
|---|---|---|
get_post_comments |
Get comments on a post | Yes |
create_comment |
Create a comment | Yes |
update_comment |
Update a comment | Yes |
delete_comment |
Delete a comment | Yes |
š Usage Examples
Example 1: Authenticate with Google
User prompt in Claude Desktop:
Please authenticate with Google so I can access Circle features
What happens:
- MCP server receives
authenticate_with_googletool call - OAuth server starts on http://localhost:3000
- Browser opens for Google sign-in
- User signs in and authorizes
- Tokens are exchanged and stored
- Circle authentication completes
Example 2: Get Your Profile
User prompt:
Show me my Circle profile
MCP tool called:
{
"name": "get_my_profile",
"arguments": {}
}
Response:
{
"name": "John Doe",
"email": "john@example.com",
"bio": "Community member",
"member_since": "2024-01-15"
}
Example 3: Get Your Courses
User prompt:
What courses am I enrolled in?
MCP tool called:
{
"name": "get_my_courses",
"arguments": {}
}
Example 4: Create a Post
User prompt:
Create a post in the General space with title "Hello World" and body "This is my first post!"
MCP tool called:
{
"name": "create_post",
"arguments": {
"space_id": "12345",
"title": "Hello World",
"body": "This is my first post!"
}
}
Example 5: Get Events
User prompt:
Show me upcoming events in the community
MCP tool called:
{
"name": "get_events",
"arguments": {}
}
š Troubleshooting
Issue: "GCP_CLIENT_ID not configured"
Solution:
- Ensure
.envfile exists in project root - Add
GCP_CLIENT_IDwith your actual Google OAuth Client ID - Verify the Client ID ends with
.apps.googleusercontent.com
Issue: "redirect_uri_mismatch"
Error Message:
Error 400: redirect_uri_mismatch
Solution:
- Go to Google Cloud Console
- Navigate to APIs & Services ā Credentials
- Click on your OAuth 2.0 Client ID
- Under "Authorized redirect URIs", add exactly:
http://localhost:3000/auth/google/callback - Click Save
- Wait 5 minutes for changes to propagate
Issue: "Port 3000 already in use"
Solution:
Change the port in .env:
OAUTH_PORT=3001
GCP_REDIRECT_URI=http://localhost:3001/auth/google/callback
Remember: Update the redirect URI in Google Cloud Console too!
Issue: "User not found in Circle community"
Error Message:
Circle authentication failed: User not found
Solution:
- Ensure your Google account email is registered in the Circle community
- Go to your Circle community and check your account email
- Make sure it matches the Google account you're using to authenticate
Issue: Browser doesn't open during OAuth
Solution:
- Check the terminal for the OAuth URL
- Manually copy and paste the URL into your browser
- Complete the authentication flow
Issue: TypeScript compilation errors
Solution:
# Clean and rebuild
rm -rf dist node_modules
npm install
npm run build
Issue: "Cannot find module" errors
Solution:
# Reinstall dependencies
npm install
Issue: MCP Server not showing in Claude Desktop
Solution:
- Check
claude_desktop_config.jsonsyntax (valid JSON) - Verify the path to
dist/index.jsis absolute and correct - Ensure the server builds successfully (
npm run build) - Restart Claude Desktop completely (quit and relaunch)
- Check Claude Desktop logs:
- macOS:
~/Library/Logs/Claude/mcp*.log - Windows:
%APPDATA%\Claude\logs\mcp*.log
- macOS:
Issue: OAuth authentication fails silently
Solution:
- Check if you added your email as a test user in GCP OAuth consent screen
- Verify your GCP project has Google+ API enabled
- Check server logs for detailed error messages
- Try the interactive test:
node test-oauth-interactive.js
šØāš» Development
Project Structure
circle-mcp/
āāā src/
ā āāā index.ts # Entry point
ā āāā server.ts # MCP server implementation
ā āāā config/
ā ā āāā config.ts # Configuration management
ā āāā auth/
ā ā āāā gcp-auth.ts # Google OAuth 2.0
ā ā āāā integrated-auth-manager.ts # Auth orchestration
ā ā āāā oauth-server.ts # OAuth callback server
ā ā āāā token-manager.ts # Token refresh logic
ā ā āāā user-storage.ts # User data persistence
ā āāā api/
ā ā āāā client.ts # Circle API client
ā ā āāā endpoints.ts # API endpoints
ā āāā tools/
ā ā āāā auth-wrapper.ts # Authentication wrapper
ā ā āāā profile.ts # Profile tools
ā ā āāā courses.ts # Course tools
ā ā āāā posts.ts # Post tools
ā ā āāā spaces.ts # Space tools
ā ā āāā events.ts # Event tools
ā ā āāā notifications.ts # Notification tools
ā ā āāā messages.ts # Message tools
ā ā āāā feed.ts # Feed tools
ā ā āāā comments.ts # Comment tools
ā āāā types/
ā ā āāā circle.ts # TypeScript types
ā āāā utils/
ā āāā error-handler.ts # Error handling
ā āāā logger.ts # Winston logger
ā āāā validators.ts # Input validation
āāā dist/ # Compiled JavaScript
āāā test-oauth-flow.js # Configuration test
āāā test-oauth-automated.js # Automated tests
āāā test-oauth-interactive.js # Interactive OAuth test
āāā verify-setup.js # Setup verification
āāā package.json
āāā tsconfig.json
āāā .env # Environment variables (create this)
āāā README.md
Available Scripts
# Development
npm run build # Compile TypeScript
npm run typecheck # Type check without building
npm start # Start the MCP server
npm run dev # Development mode with watch
# Testing
node verify-setup.js # Verify complete setup
node test-oauth-flow.js # Test OAuth configuration
node test-oauth-automated.js # Automated server tests
node test-oauth-interactive.js # Interactive OAuth testing
# Debugging
npx @modelcontextprotocol/inspector node dist/index.js # MCP Inspector
Adding New Tools
- Create a new file in
src/tools/your-tool.ts - Import the authentication wrapper:
import { withAuthentication } from './auth-wrapper.js'; - Define your tool with authentication:
export function registerYourTools( server: McpServer, apiClient: CircleAPIClient, authManager: IntegratedAuthManager ) { server.registerTool( 'your_tool_name', { description: 'What your tool does', inputSchema: zodToJsonSchema(YourInputSchema) }, withAuthentication(authManager, async (params) => { const email = (params as any).authenticatedEmail; // Your implementation }) ); } - Register in
src/server.ts
Environment Variables for Development
# Enable debug logging
LOG_LEVEL=debug
# Test with read-only mode
READ_ONLY_MODE=true
# Use different OAuth port
OAUTH_PORT=3001
Running Tests
# Full test suite
npm run build
node verify-setup.js
node test-oauth-automated.js
node test-oauth-interactive.js
Debugging Tips
-
Enable debug logging:
LOG_LEVEL=debug -
Check MCP Inspector:
npx @modelcontextprotocol/inspector node dist/index.js -
Monitor server logs:
- Logs are output to stderr
- In Claude Desktop, check log files in the Claude logs directory
-
Test authentication separately:
node test-oauth-interactive.js
š License
MIT License - see LICENSE file for details
š¤ Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
š Support
If you encounter issues:
- Check the Troubleshooting section
- Review server logs for detailed error messages
- Run
node verify-setup.jsto check configuration - Test OAuth flow with
node test-oauth-interactive.js - Check GCP OAuth consent screen configuration
- Verify your email is added as a test user (if app is in testing mode)
š Quick Start Summary
# 1. Install dependencies
npm install
# 2. Create .env file with your credentials
cp .env.example .env # Then edit with your values
# 3. Build the project
npm run build
# 4. Verify setup
node verify-setup.js
# 5. Test OAuth
node test-oauth-interactive.js
# 6. Add to Claude Desktop config
# Edit claude_desktop_config.json (see IDE Integration section)
# 7. Restart Claude Desktop and start chatting!
Built with ā¤ļø using Model Context Protocol
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.