Skip to main content
Glama
rodrigoai

Customer Registration MCP Server

by rodrigoai

Customer Management & Payment Plans MCP Server & Chatbot

This project provides two main components:

  1. MCP Server: A Model Context Protocol server for customer management, address lookup, and payment plan retrieval

  2. AI Chatbot: An OpenAI GPT-4o-mini powered chatbot that integrates with the MCP server via REST API

Features

MCP Server

  • ✅ MCP-compliant server implementation (stdio transport)

  • ✅ Bearer token authentication

  • ✅ Three integrated tools:

    • createCustomer - Customer registration with validation

    • getAddressByZipcode - Brazilian CEP address lookup

    • list_payment_plans - Payment plan retrieval (credit card, PIX, bank slip)

  • ✅ Required field validation

  • ✅ Comprehensive error handling

  • ✅ Development logging

  • ✅ TypeScript implementation

AI Chatbot

  • ✅ OpenAI GPT-4o-mini integration

  • ✅ Configurable tone/style via environment variables

  • ✅ REST API endpoint (/api/chat)

  • ✅ Automatic MCP tool invocation based on conversation

  • ✅ Conversation history management

  • ✅ Express-based HTTP server

Related MCP server: API Registry MCP Server

Prerequisites

  • Node.js 18+

  • Yarn package manager

Installation

  1. Install dependencies:

yarn install
  1. Configure environment variables:

Copy the example file and edit with your values:

cp .env.example .env

Edit .env:

# MCP Server Configuration
CUSTOMER_API_HOST=https://your-api-host.com
CUSTOMER_API_TOKEN=your_bearer_token_here
NODE_ENV=development

# Payment Plans Configuration
CHECKOUT_ID=your_checkout_id_here
PRODUCT_ID=36,42

# Chatbot Configuration
OPENAI_API_KEY=sk-your-openai-api-key-here
OPENAI_MODEL=gpt-5-nano
AGENT_TONE=Professional, helpful, and efficient
# Alternative: AGENT_STYLE=Encouraging, visionary, witty

# Chatbot Server Port (optional, defaults to 3000)
CHATBOT_PORT=3000

Note: AGENT_TONE or AGENT_STYLE controls the chatbot's personality.

Usage

Running the MCP Server (standalone)

Development Mode:

yarn dev

Or with watch mode:

yarn watch

Production Mode:

# Build
yarn build

# Run
yarn start

Running the AI Chatbot Server

Development Mode:

yarn chatbot:dev

Production Mode:

# Build
yarn chatbot:build

# Run
yarn chatbot:start

The chatbot server will start on port 3000 (or your configured CHATBOT_PORT).

Chatbot API Endpoints

POST /api/chat

Send a message to the chatbot:

curl -X POST http://localhost:3000/api/chat \
  -H "Content-Type: application/json" \
  -d '{
    "message": "Register a customer: John Doe, john@example.com, +1234567890",
    "context": {}
  }'

Response:

{
  "reply": "Great! I've successfully registered John Doe as a customer. The customer ID is 12345.",
  "actions": [
    {
      "tool": "createCustomer",
      "input": {
        "name": "John Doe",
        "email": "john@example.com",
        "phone": "+1234567890"
      },
      "result": {
        "status": "success",
        "customerId": 12345,
        "data": {...}
      }
    }
  ]
}

POST /api/chat/reset

Reset the conversation history:

curl -X POST http://localhost:3000/api/chat/reset

GET /health

Health check:

curl http://localhost:3000/health

MCP Tools

Tool 1: createCustomer

Required Parameters

  • name (string): Customer full name

  • email (string): Customer email address (validated)

  • phone (string): Customer phone number

Optional Parameters

  • retention (boolean): Retention flag

  • identification (string): Customer ID document (e.g., CPF)

  • zipcode (string): ZIP/Postal code

  • state (string): State/Province

  • street (string): Street name

  • number (string): Street number

  • neighborhood (string): Neighborhood

  • city (string): City

  • list_ids (number): List ID for categorization

  • create_deal (boolean): Whether to create a deal

  • tags (string): Tags for the customer

  • url (string): URL reference

  • utm_term (string): UTM term parameter

  • utm_medium (string): UTM medium parameter

  • utm_source (string): UTM source parameter

  • utm_campaign (string): UTM campaign parameter

  • company_id (string): Company ID

  • utm_content (string): UTM content parameter

Example Request

{
  "name": "Tony Stark",
  "email": "newone@avengers.com",
  "phone": "(12) 99756-0001",
  "city": "São Paulo",
  "retention": true,
  "identification": "251.482.720-58",
  "tags": "coyo-jan"
}

Example Success Response

{
  "status": "success",
  "customerId": 12345,
  "data": {
    "id": 12345,
    "name": "Tony Stark",
    "email": "newone@avengers.com",
    ...
  }
}

Example Error Response

{
  "status": "error",
  "error": "Validation failed",
  "errors": [
    "email is required",
    "phone is required"
  ]
}

Tool 2: getAddressByZipcode

Lookup Brazilian addresses by CEP (zipcode).

Required Parameters

  • zipcode (string): Brazilian CEP in format XXXXX-XXX or XXXXXXXX (8 digits)

Example Request

{
  "zipcode": "01310-100"
}

Example Success Response

{
  "cep": "01310-100",
  "logradouro": "Avenida Paulista",
  "bairro": "Bela Vista",
  "localidade": "São Paulo",
  "uf": "SP"
}

Tool 3: list_payment_plans

Retrieve available payment plans for checkout offers. Configuration is read from environment variables (CHECKOUT_ID and PRODUCT_ID).

Required Parameters

None - the tool uses configuration from environment variables.

Configuration (Environment Variables)

  • CHECKOUT_ID (string): Checkout page identifier

  • PRODUCT_ID (string): Comma-separated product IDs (e.g., "36,42")

Example Response

{
  "checkout_id": "checkout_abc123",
  "product_id": "36,42",
  "plans": {
    "credit_card": [
      { "installments": 1, "value": 1096.00 },
      { "installments": 2, "value": 548.00 },
      { "installments": 3, "value": 365.33 },
      { "installments": 6, "value": 182.67 },
      { "installments": 12, "value": 91.33 }
    ],
    "pix": [
      { "value": 1096.00 }
    ],
    "bank_slip": [
      { "value": 1096.00 }
    ]
  },
  "payment_summary": "Temos pagamentos em até 12x de R$ 91,33 no cartão de crédito, ou à vista no PIX por R$ 1.096,00 ou boleto por R$ 1.096,00."
}

Notes

  • The API is called once with the full product_id string (comma-separated)

  • Backend processes multiple product IDs and returns combined payment conditions

  • Fine, fine_tax, and late_interest fields are automatically ignored

  • Payment summary is generated in Portuguese (Brazil)

Example Error Response

{
  "error": "Request failed with status code 401",
  "statusCode": 401
}

Configuring with MCP Clients

To use this server with an MCP-compatible client (like Claude Desktop), add the following to your MCP settings configuration:

{
  "mcpServers": {
    "customer-registration": {
      "command": "node",
      "args": ["/absolute/path/to/mcpNova/build/index.js"],
      "env": {
        "CUSTOMER_API_HOST": "https://your-api-host.com",
        "CUSTOMER_API_TOKEN": "your_bearer_token_here",
        "NODE_ENV": "production",
        "CHECKOUT_ID": "your_checkout_id",
        "PRODUCT_ID": "36,42"
      }
    }
  }
}

How the Chatbot Works

  1. User sends a message to /api/chat

  2. Chatbot adds message to conversation history

  3. OpenAI GPT-4o-mini processes the message with configured system prompt

  4. If LLM determines an action is needed (e.g., createCustomer, getAddressByZipcode, list_payment_plans), it responds with JSON

  5. Chatbot extracts the action and calls MCP server via stdio

  6. MCP server executes the appropriate tool:

    • Customer registration via external API

    • Address lookup via ViaCEP

    • Payment plans retrieval via external API

  7. Result is returned to LLM for a friendly follow-up message in Portuguese

  8. Final response sent back to user

Example Chatbot Conversations

Customer Registration:

User: Preciso cadastrar um cliente: João Silva, joao@email.com, (11) 98765-4321

Chatbot: Perfeito! Cadastrei o João Silva com sucesso. O ID do cliente é 67890.

Address Lookup:

User: Qual endereço do CEP 01310-100?

Chatbot: `O CEP 01310-100 corresponde a:

  • Avenida Paulista

  • Bairro: Bela Vista

  • São Paulo - SP`

Payment Plans:

User: Quais são as formas de pagamento?

Chatbot: `Temos as seguintes opções:

  • Cartão de crédito: até 12x de R$ 91,33

  • PIX à vista: R$ 1.096,00

  • Boleto à vista: R$ 1.096,00`

Multi-turn with Address:

User: Quero cadastrar um cliente

Chatbot: `Claro! Preciso de:

  • Nome completo

  • E-mail

  • Telefone`

User: Nome: Maria Santos, Email: maria@email.com, Telefone: (21) 99999-8888, CEP: 20040-020

Chatbot: (looks up CEP) Encontrei o endereço: Avenida Rio Branco, Centro, Rio de Janeiro - RJ. Vou cadastrar a Maria Santos com essas informações.

(creates customer)

Chatbot: Pronto! Maria Santos cadastrada com sucesso. ID: 11223

Project Structure

mcpNova/
├── src/
│   ├── index.ts                  # MCP Server (stdio)
│   ├── chatbotServer.ts          # Express REST API server
│   └── services/
│       ├── customerService.ts    # Customer API integration
│       ├── viaCepService.ts      # Brazilian address lookup
│       ├── paymentPlansService.ts # Payment plans retrieval
│       ├── mcpClient.ts          # MCP client (stdio communication)
│       └── chatbotService.ts     # OpenAI integration & logic
├── build/                        # Compiled TypeScript
├── package.json
├── tsconfig.json
├── .env                          # Environment variables (gitignored)
├── .env.example                  # Environment template
└── README.md

API Endpoint

POST https://{{host}}/api/v1/customers

Headers:

  • Authorization: Bearer {{TOKEN}}

  • Content-Type: application/json

Development Logging

When NODE_ENV=development, the server logs:

  • Request URLs and payloads

  • Response status and data

  • API errors with details

Error Handling

The server handles:

  • Missing or invalid required fields

  • HTTP errors from the external API

  • Network connectivity issues

  • Invalid Bearer tokens

  • Malformed requests

Security

  • Environment variables are used for sensitive data (API host and token)

  • .env files are gitignored

  • Bearer token is never logged or exposed

  • Email validation prevents basic injection attempts

License

MIT

Available Tools

1 tool
createCustomerC

Create a new customer in the external API. Requires name, email, and phone. Supports optional fields like address, UTM parameters, and more.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYesCustomer full name (required)
emailYesCustomer email address (required)
phoneYesCustomer phone number (required)
retentionNoRetention flag
identificationNoCustomer identification document (e.g., CPF)
zipcodeNoZIP/Postal code
stateNoState/Province
streetNoStreet name
numberNoStreet number
neighborhoodNoNeighborhood
cityNoCity
list_idsNoList ID for categorization
create_dealNoWhether to create a deal
tagsNoTags for the customer
urlNoURL reference
utm_termNoUTM term parameter
utm_mediumNoUTM medium parameter
utm_sourceNoUTM source parameter
utm_campaignNoUTM campaign parameter
company_idNoCompany ID
utm_contentNoUTM content parameter

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It states it's a creation tool, implying mutation, but lacks details on permissions, side effects, error handling, or response format. It mentions 'external API' but doesn't clarify authentication or rate limits, leaving behavioral traits largely undisclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with core purpose and required fields, followed by optional examples. It's efficient with two sentences, though 'and more' is vague and could be omitted for better precision.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a mutation tool with 21 parameters, no annotations, and no output schema, the description is incomplete. It lacks critical context like response format, error conditions, authentication needs, or system behavior, making it inadequate for safe and effective use by an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all 21 parameters. The description adds minimal value by listing required fields and examples of optional fields (address, UTM parameters), but doesn't provide additional meaning beyond the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool creates a new customer in an external API with specific required fields (name, email, phone). It distinguishes the action (create) and resource (customer), but without sibling tools, differentiation isn't applicable. It's not tautological as it adds details beyond the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, prerequisites, or context. It mentions 'external API' but doesn't specify scenarios or constraints, leaving the agent with minimal usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.1/5.0
Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap between tools. The tool has a clear and distinct purpose: creating a new customer.

Naming Consistency5/5

The single tool name 'createCustomer' uses a consistent verb_noun pattern (create + Customer). Since there is only one tool, naming consistency is inherently perfect.

Tool Count2/5

A single tool for a 'Customer Registration' server is too few for the apparent scope. Registration typically involves more operations like retrieving, updating, or deleting customer data, making this server feel incomplete and under-scoped.

Completeness2/5

The server is severely incomplete for customer registration. It only provides a create operation, lacking essential tools for reading, updating, or deleting customers, which are fundamental for any registration system. This will likely cause agent failures when trying to manage customer data.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI assistants to interact with GoHighLevel's complete API including contacts, opportunities, calendars, workflows, communications, and business management tools. Supports both Bearer token and OAuth2 authentication with automatic token management.
    38
    8
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables discovery, registration, and management of external API endpoints through natural language, supporting multiple authentication methods (public, API key, bearer token) with automatic endpoint testing and documentation parsing.
  • F
    license
    A
    quality
    D
    maintenance
    Enables interaction with any REST API through token or login authentication, with automatic Swagger/OpenAPI documentation integration for endpoint discovery and comprehensive HTTP request support.
    7
  • A
    license
    B
    quality
    D
    maintenance
    Connects AI assistants to the Hub API, enabling them to manage resources such as customer leads through structured tools. It provides validated operations for creating customer records, supporting specific Brazilian fiscal ID (CPF/CNPJ) validation rules.
    1
    10
    1
    ISC

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rodrigoai/mcpNova'

If you have feedback or need assistance with the MCP directory API, please join our Discord server