swosei/NextAgency-MCP
If you are the rightful owner of NextAgency-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This is an unofficial, community-maintained MCP server for NextAgency's API, providing a lightweight, multi-tenant server with OAuth2 authentication.
NextAgency-MCP
Note: This is an unofficial, community-maintained MCP server for NextAgency's API. It is not officially supported by NextAgency.
A lightweight, multi-tenant MCP server that exposes NextAgency's API as MCP tools with OAuth2 authentication and automatic token refresh.
Features
Setup & Security
- Dead-Simple Setup - Get running in 2 commands
- Secure OAuth2 - Authorization code flow with automatic refresh
- OS Keychain Storage - Tokens encrypted in your system keychain
Capabilities
- Multi-Tenant - Supports any
{tenant}.nextbroker.io
or{tenant}.nextbroker.info
subdomain - 45+ MCP Tools - Full CRUD for Cases, Contacts, Tasks, Notes, Employees, Benefits, Carriers, Sub-Agents, Addresses, and VOIP
- Web UI - Built-in Setup Wizard and Tool Explorer
Integrations
- Auto-Configure - One-click setup for Cursor, Claude Desktop, VS Code MCP, Claude Code CLI, and Continue.dev
Quick Start
Installation (2 commands)
git clone https://github.com/your-org/NextAgency-MCP.git
cd NextAgency-MCP
npm run setup
That's it! The Web UI will open automatically at http://localhost:8787
Setup Wizard
The Web UI guides you through a simple 4-step process:
-
Enter Credentials
- NextAgency tenant subdomain (e.g.,
yahoo
) - Base domain (
nextbroker.io
for production,nextbroker.info
for testing) - OAuth Client ID and Client Secret
- NextAgency tenant subdomain (e.g.,
-
Authorize
- Click "Next: Authorize" to authenticate with NextAgency
- Grant permissions to the MCP server
-
Auto-Configure
- Setup wizard auto-detects your installed MCP clients
- Select your client from the dropdown
- Click "Auto-Configure" for one-click setup
-
Done!
- Restart your MCP client
- Start using NextAgency tools in your AI assistant
Management Commands
# Start all services (Web UI + APIs)
npm run start:all
# Stop all services
npm run stop:all
# View logs
tail -f logs/*.log
# Rebuild after code changes
npm run build
Available Services
Once started, you have access to:
- Web UI: http://localhost:8787
- Tool Explorer: http://localhost:8787/explorer (test tools without an MCP client)
- Setup Wizard API: http://localhost:8789 (backend for setup wizard)
- Tool Explorer API: http://localhost:8788 (backend for tool explorer)
Manual Configuration
If auto-configuration doesn't work, or you're helping an LLM configure the server, use these manual instructions.
Configuration Format by Client
Cursor, Claude Desktop, and Continue.dev
Add this to your client's config file:
{
"mcpServers": {
"nextagency": {
"command": "nextagency-mcp",
"args": [],
"env": {
"NEXTA_CONFIG": "~/.nextagency-mcp/config.json"
}
}
}
}
Claude Code CLI
Add this to ~/.claude.json
:
{
"mcpServers": {
"nextagency": {
"command": "nextagency-mcp",
"args": [],
"env": {
"NEXTA_CONFIG": "~/.nextagency-mcp/config.json"
}
}
}
}
Note: Claude Code CLI detection may not work on Linux. If the setup wizard doesn't detect it, manually add the config above to ~/.claude.json
.
VS Code MCP (Native MCP Support)
VS Code uses a different format. Add this to your mcp.json
file:
{
"servers": {
"nextagency": {
"type": "stdio",
"command": "nextagency-mcp",
"args": [],
"env": {
"NEXTA_CONFIG": "~/.nextagency-mcp/config.json"
}
}
}
}
To open the config file in VS Code, run: "MCP: Open User Configuration"
Config File Locations by OS
šŖ Windows
- Cursor:
%APPDATA%\Cursor\User\settings.json
- Claude Desktop:
%APPDATA%\Claude\claude_desktop_config.json
- Claude Code CLI:
%USERPROFILE%\.claude.json
- VS Code MCP:
%APPDATA%\Code\User\mcp.json
- Continue.dev:
%USERPROFILE%\.continue\config.json
š macOS
- Cursor:
~/.cursor/config/cursor-settings.json
- Claude Desktop:
~/Library/Application Support/Claude/claude_desktop_config.json
- Claude Code CLI:
~/.claude.json
- VS Code MCP:
~/Library/Application Support/Code/User/mcp.json
- Continue.dev:
~/.continue/config.json
š§ Linux
- Cursor:
~/.config/Cursor/User/settings.json
or~/.cursor/config/cursor-settings.json
- Claude Desktop:
~/.config/Claude/claude_desktop_config.json
- Claude Code CLI:
~/.claude.json
- VS Code MCP:
~/.config/Code/User/mcp.json
or~/.config/Code - OSS/User/mcp.json
- Continue.dev:
~/.continue/config.json
Available Tools
Cases (Businesses)
list_cases
- List all cases with paginationget_case
- Get a specific case by IDsearch_cases
- Search cases by querycreate_case
- Create a new caseupdate_case
- Update an existing case
Contacts
list_contacts
- List all contactsget_contact
- Get specific contactsearch_contacts
- Search contacts by querysearch_contacts_by_phone
- Search by phone numbercreate_contact
- Create new contactupdate_contact
- Update existing contact
Tasks
list_tasks
- List tasks for a caseget_task
- Get specific tasksearch_tasks
- Search taskscreate_task
- Create new taskupdate_task
- Update existing task
Notes
list_notes
- List notes for a caseget_note
- Get specific notecreate_note
- Create note with attachmentsupdate_note
- Update existing note
Employees
list_employees
- List employees for a caseget_employee
- Get specific employeesearch_employees
- Search employeescreate_employee
- Create new employeeupdate_employee
- Update existing employee
VOIP Recordings
list_voip_recordings
- List all VOIP recordingsget_voip_recording
- Get specific recordingsearch_voip_by_referenceable
- Search by Business or Contactcreate_voip_recording
- Create new recording
Benefits
list_benefits
- List benefits for a caseget_benefit
- Get specific benefitcreate_benefit
- Create new benefitupdate_benefit
- Update existing benefit
Carriers
list_carriers
- List all carriersget_carrier
- Get specific carriersearch_carriers
- Search carrierscreate_carrier
- Create new carrierupdate_carrier
- Update existing carrier
Sub-Agents
list_sub_agents
- List all sub-agentsget_sub_agent
- Get specific sub-agentsearch_sub_agents
- Search sub-agentscreate_sub_agent
- Create new sub-agentupdate_sub_agent
- Update existing sub-agent
Addresses
list_addresses
- List all addressesget_address
- Get specific addressupdate_address
- Update existing address
System
check_auth_status
- Check authentication status and token expiry
Authentication
NextAgency-MCP uses OAuth2 authorization code flow:
- Authorization - User visits
/oauth/authorize
to grant access - Token Exchange - Authorization code is exchanged for access + refresh tokens
- Secure Storage - Tokens are encrypted in OS keychain (via Keytar)
- Auto-Refresh - Access tokens are automatically refreshed before expiry
- 401 Retry - Failed requests are retried once after refreshing token
Configuration Storage
Configuration is stored in ~/.nextagency-mcp/config.json
:
{
"tenant": "yahoo",
"clientId": "your-client-id",
"clientSecret": "your-client-secret",
"redirectUri": "http://localhost:8787/callback",
"baseUrl": "nextbroker.io"
}
Tokens are NEVER stored in this file - they're encrypted in your OS keychain.
Troubleshooting
Services won't start
Check if ports are already in use:
lsof -i :8787 # Web UI
lsof -i :8788 # Tool Explorer API
lsof -i :8789 # Setup Wizard API
Stop all services and try again:
npm run stop:all
npm run start:all
"No configuration found"
Run the setup wizard:
npm run start:all
# Visit http://localhost:8787
"Not authenticated"
Your tokens may have expired. Re-run the setup wizard to re-authenticate:
npm run start:all
# Visit http://localhost:8787
"Failed to refresh token"
Your refresh token has expired. Re-authenticate through the setup wizard.
MCP client can't find the server
Make sure nextagency-mcp
is in your PATH after building:
npm run build
cd server
npm link
Verify it's accessible:
which nextagency-mcp
Check if services are running
# Check PIDs
cat .pids/*.pid
# Check logs
tail -f logs/*.log
# Test services directly
curl http://localhost:8787 # Web UI
curl http://localhost:8788/api/health # Tool Explorer
curl http://localhost:8789/api/health # Setup Wizard
For LLMs Helping Users
When helping users set up NextAgency-MCP, use these commands:
First-time setup
npm run setup
Start services
npm run start:all
Stop services
npm run stop:all
Check status
# Check if services are running
curl http://localhost:8787
curl http://localhost:8788/api/health
curl http://localhost:8789/api/health
# View logs
tail -f logs/*.log
Direct users to the Web UI
Always direct users to http://localhost:8787 for setup. The wizard handles everything automatically.
Manual configuration
If auto-configure doesn't work, use the config file paths listed in "Config File Locations by OS" above. Remember:
- VS Code MCP uses
servers
format withtype: "stdio"
- Claude Code CLI uses
mcpServers
format (may not auto-detect on Linux) - All other clients use
mcpServers
format
Test the server
After configuration, test in the Tool Explorer:
http://localhost:8787/explorer
Development
# Install dependencies
npm install
# Run server in dev mode
npm run dev --workspace=server
# Run web UI in dev mode
npm run dev --workspace=web
# Build all workspaces
npm run build
# Run tests
npm test
Project Structure
NextAgency-MCP/
āāā server/ # MCP server implementation
ā āāā src/
ā ā āāā auth/ # OAuth2 + token management
ā ā āāā api/ # NextAgency API client
ā ā āāā mcp/ # MCP tool definitions
ā ā āāā config/ # Configuration management
ā ā āāā index.ts # Entry point
ā āāā package.json
āāā web/ # Setup wizard & Tool Explorer
ā āāā src/
ā ā āāā components/ # React components
ā ā āāā server.ts # Setup wizard backend
ā ā āāā api-server.ts # Tool Explorer backend
ā ā āāā main.tsx
ā āāā package.json
āāā scripts/ # Setup and management scripts
ā āāā install.sh # Installation script
ā āāā setup.sh # Complete setup (install + start)
ā āāā start-all.sh # Start all services
ā āāā stop-all.sh # Stop all services
āāā package.json # Root workspace config
Security
- ā Tokens encrypted in OS keychain
- ā No tokens in config files or logs
- ā Automatic token refresh
- ā HTTPS only for API calls
- ā Strict endpoint allowlist
API Documentation
See the NextAgency API Documentation for detailed endpoint specifications.
Contributing
Contributions are welcome! Please open an issue or PR.
License
MIT
Support
For issues or questions, please open a GitHub issue.