π― Production-Ready NetSapiens Integration
Comprehensive MCP server providing AI agents with full access to NetSapiens VoIP platform
A Model Context Protocol (MCP) server that provides AI agents with seamless access to the NetSapiens VoIP platform. This server enables AI applications to interact with NetSapiens functionality including user management, call detail records, and system information.
- π₯ User Management: Search users, get details, devices, answer rules, greetings, and voicemails
- π Phone Number Management: List and manage phone numbers across domains
- π― Call Center Operations: Manage call queues, agents, login/logout, and statistics
- π Call Analytics: Access CDR records, agent statistics, and call patterns
- π’ Domain Administration: Complete domain management and configuration
- π€ Auto Attendant: Configure and manage automated attendants
- π΅ Media Management: Handle greetings, voicemail, and music on hold
- π° Billing Integration: Access billing information and usage data
- π§ Real-time Operations: Live access to NetSapiens platform data
- β‘ Error Handling: Robust error handling with detailed logging
- π‘οΈ Rate Limiting: Built-in rate limiting for API protection
- π TypeScript: Full TypeScript support with comprehensive type safety
oitvoip-mcp-server/
βββ src/
β βββ index.ts # Main MCP server implementation
β βββ netsapiens-client.ts # NetSapiens API client
βββ types/
β βββ config.ts # TypeScript type definitions
βββ docs/ # Documentation
βββ build/ # Compiled JavaScript output
βββ package.json # Project dependencies
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
- Node.js 18.0.0 or higher
- npm or yarn package manager
- NetSapiens API credentials
npm install -g oitvoip-mcp-server-
Clone the repository
git clone https://github.com/OITApps/oitvoip-mcp-server.git cd oitvoip-mcp-server -
Install dependencies
npm install
-
Build the project
npm run build
-
Configure in your MCP client
Add the server to your MCP client configuration with your NetSapiens credentials (see MCP Client Setup section below)
For development with hot reloading:
npm run devThis MCP server is configured entirely through your MCP client's configuration file. No separate .env file is needed - all configuration is passed through environment variables in the MCP client config.
NETSAPIENS_API_URL: Your NetSapiens API endpoint (usuallyhttps://api.ucaasnetwork.com)NETSAPIENS_API_TOKEN: Your NetSapiens API token
DEBUG: Set totrueto enable debug logging (default:false)NETSAPIENS_TIMEOUT: API request timeout in milliseconds (default:30000)
For OpenCode, add the MCP server to your configuration file at ~/.opencode/mcp.json:
If installed via npm:
{
"mcpServers": {
"oitvoip": {
"command": "oitvoip-mcp-server",
"env": {
"NETSAPIENS_API_URL": "https://api.ucaasnetwork.com",
"NETSAPIENS_API_TOKEN": "your_api_token_here"
}
}
}
}If installed from source:
{
"mcpServers": {
"oitvoip": {
"command": "node",
"args": ["/path/to/oitvoip-mcp-server/build/index.js"],
"env": {
"NETSAPIENS_API_URL": "https://api.ucaasnetwork.com",
"NETSAPIENS_API_TOKEN": "your_api_token_here"
}
}
}
}For Claude Desktop, add the server to your configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
If installed via npm:
{
"mcpServers": {
"oitvoip": {
"command": "oitvoip-mcp-server",
"env": {
"NETSAPIENS_API_URL": "https://api.ucaasnetwork.com",
"NETSAPIENS_API_TOKEN": "your_api_token_here"
}
}
}
}If installed from source:
{
"mcpServers": {
"oitvoip": {
"command": "node",
"args": ["/path/to/oitvoip-mcp-server/build/index.js"],
"env": {
"NETSAPIENS_API_URL": "https://api.ucaasnetwork.com",
"NETSAPIENS_API_TOKEN": "your_api_token_here"
}
}
}
}For Cursor, add the server to your MCP configuration file at ~/.cursor/mcp.json:
If installed via npm:
{
"mcpServers": {
"oitvoip": {
"command": "oitvoip-mcp-server",
"env": {
"NETSAPIENS_API_URL": "https://api.ucaasnetwork.com",
"NETSAPIENS_API_TOKEN": "your_api_token_here"
}
}
}
}If installed from source:
{
"mcpServers": {
"oitvoip": {
"command": "node",
"args": ["/path/to/oitvoip-mcp-server/build/index.js"],
"env": {
"NETSAPIENS_API_URL": "https://api.ucaasnetwork.com",
"NETSAPIENS_API_TOKEN": "your_api_token_here"
}
}
}
}- Replace
/path/to/oitvoip-mcp-serverwith the actual path to your installation - Replace
your_api_token_herewith your actual NetSapiens API token - All configuration is handled through the MCP client - no separate
.envfile is needed - After configuration, restart your MCP client to load the server
Search for users in the NetSapiens system by username.
{
"name": "search_users",
"arguments": {
"query": "john.doe",
"domain": "company.com",
"limit": 20
}
}Retrieve detailed information about a specific user.
{
"name": "get_user",
"arguments": {
"userId": "john.doe",
"domain": "company.com"
}
}Get devices assigned to a specific user.
{
"name": "get_user_devices",
"arguments": {
"userId": "john.doe",
"domain": "company.com"
}
}Get phone numbers for a domain.
{
"name": "get_phone_numbers",
"arguments": {
"domain": "company.com",
"limit": 50
}
}Get details of a specific phone number.
{
"name": "get_phone_number",
"arguments": {
"domain": "company.com",
"phoneNumber": "+15551234567"
}
}Get list of domains in the NetSapiens system.
{
"name": "get_domains",
"arguments": {}
}Get detailed information about a specific domain.
{
"name": "get_domain",
"arguments": {
"domain": "company.com"
}
}Get call queues for a domain.
{
"name": "get_call_queues",
"arguments": {
"domain": "company.com"
}
}Get details of a specific call queue.
{
"name": "get_call_queue",
"arguments": {
"domain": "company.com",
"queueId": "sales-queue"
}
}Get agents assigned to a call queue.
{
"name": "get_call_queue_agents",
"arguments": {
"domain": "company.com",
"queueId": "sales-queue"
}
}Get agents for a domain.
{
"name": "get_agents",
"arguments": {
"domain": "company.com"
}
}Login an agent to a call queue.
{
"name": "login_agent",
"arguments": {
"domain": "company.com",
"queueId": "sales-queue",
"agentId": "agent001"
}
}Logout an agent from a call queue.
{
"name": "logout_agent",
"arguments": {
"domain": "company.com",
"queueId": "sales-queue",
"agentId": "agent001"
}
}Retrieve call detail records with optional filtering.
{
"name": "get_cdr_records",
"arguments": {
"startDate": "2024-01-01",
"endDate": "2024-01-31",
"user": "john.doe",
"domain": "company.com",
"limit": 100
}
}Get agent statistics for a domain.
{
"name": "get_agent_statistics",
"arguments": {
"domain": "company.com",
"agentId": "agent001"
}
}Get auto attendants for a domain.
{
"name": "get_auto_attendants",
"arguments": {
"domain": "company.com"
}
}Get answer rules for a user.
{
"name": "get_user_answer_rules",
"arguments": {
"userId": "john.doe",
"domain": "company.com"
}
}Get specific answer rule for a user.
{
"name": "get_user_answer_rule",
"arguments": {
"userId": "john.doe",
"domain": "company.com",
"timeframe": "business"
}
}Get greetings for a user.
{
"name": "get_user_greetings",
"arguments": {
"userId": "john.doe",
"domain": "company.com"
}
}Get voicemails for a user.
{
"name": "get_user_voicemails",
"arguments": {
"userId": "john.doe",
"domain": "company.com"
}
}Get music on hold files for a domain.
{
"name": "get_music_on_hold",
"arguments": {
"domain": "company.com"
}
}Get billing information for a domain.
{
"name": "get_billing",
"arguments": {
"domain": "company.com"
}
}Test connectivity to the NetSapiens API.
{
"name": "test_connection",
"arguments": {}
}// Search for users with "john" in a specific domain
const result = await mcp.callTool('search_users', {
query: 'john',
domain: 'company.com',
limit: 10
});// Get detailed information about a specific user
const result = await mcp.callTool('get_user', {
userId: 'john.doe',
domain: 'company.com'
});// Get call records for a specific user in the last month
const result = await mcp.callTool('get_cdr_records', {
startDate: '2024-01-01',
endDate: '2024-01-31',
user: 'john.doe',
domain: 'company.com'
});// Get devices assigned to a user
const result = await mcp.callTool('get_user_devices', {
userId: 'john.doe',
domain: 'company.com'
});npm run build- Compile TypeScript to JavaScriptnpm run dev- Run in development mode with hot reloadingnpm start- Run the compiled servernpm run watch- Watch mode for developmentnpm run clean- Clean build directory
src/
βββ index.ts # Main server entry point
βββ netsapiens-client.ts # NetSapiens API client
βββ tools/ # Individual tool implementations
types/
βββ config.ts # Configuration types
βββ netsapiens.ts # NetSapiens API types
- Define the tool in the
ListToolsRequestSchemahandler - Add a handler method in the
CallToolRequestSchemahandler - Implement the tool logic in the NetSapiens client
- Update type definitions as needed
- API Tokens: Configure your NetSapiens API tokens securely in your MCP client configuration
- Token Security: Use strong API tokens and rotate them regularly
- Access Control: Ensure API tokens have minimal required permissions
- Rate Limiting: Built-in rate limiting prevents API abuse
- Error Handling: Secure error logging without exposing sensitive data
- Input Validation: All inputs are validated before processing
- Secure MCP Configuration: Store your MCP client configuration files securely
- Strong API Tokens: Use secure NetSapiens API tokens and rotate regularly
- Monitor Access: Check NetSapiens access logs for unauthorized usage
- Regular Audits: Run
npm auditregularly for dependency vulnerabilities - Keep Updated: Maintain latest versions for security patches
- HTTPS Only: All API communications use secure HTTPS connections
- Environment Isolation: Use different tokens for development/production environments
-
Connection Failed
- Verify your API URL and token in
.env - Check network connectivity to NetSapiens server
- Ensure API token has proper permissions
- Verify your API URL and token in
-
Build Errors
- Run
npm run cleanand rebuild - Check TypeScript configuration
- Verify all dependencies are installed
- Run
-
Tool Not Found
- Ensure the tool name matches exactly
- Check the tool is properly registered in
ListToolsRequestSchema
Enable debug logging by setting DEBUG=true in your .env file:
DEBUG=true- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
OITVOIP provides comprehensive VoIP solutions powered by the NetSapiens platform. This MCP server enables seamless integration between AI applications and our VoIP infrastructure.
Built with β€οΈ by the OITVOIP team
From frontend finesse to backend brilliance - we stack it all! β