Vietnamese Water Utility API MCP server

TypeScript-based bridge to a Vietnamese water utility company's ABP Framework API, enabling employee management, breakfast registration, chemical tracking, equipment monitoring, and vehicle dispatching through a service-oriented architecture with axios HTTP requests.
Back to servers
Setup instructions
Provider
nstanw
Release date
Mar 13, 2025
Language
TypeScript

The MCP API Service is a middleware server that follows the Model Context Protocol (MCP), enabling Claude AI to communicate with internal system APIs. It acts as an intermediary, receiving commands from Claude, processing them, and returning formatted results after interacting with your internal APIs.

Getting Started

Installation

To set up the MCP API Service, follow these steps:

  1. Clone the repository
  2. Install the required dependencies:
npm install
  1. Build the server:
npm run build
  1. To run the server in development mode with automatic rebuilding:
npm run watch

Available Features

The MCP API Service currently supports the following scenarios:

  • check_connection - Verifies connectivity to the API server
  • search_employee - Searches for employees by name or ID
  • register_breakfast - Registers employees for breakfast
  • update_hoa_chat - Updates chemical information by shift
  • chuyen_nhan_vien_thi_cong - Transfers construction contractors

Using the MCP Inspector

Debugging MCP can be challenging due to the nature of stdin/stdout communication. To make this easier, you can use the MCP Inspector:

npm run inspector

The inspector provides a web interface that allows you to:

  • Monitor requests sent to the server
  • View response results for each request
  • Check error logs separately
  • Monitor system performance

Adding New Scenarios

Step 1: Add Endpoints

Define new endpoints in src/config.ts:

export const CONFIG = {
  // ...existing code...
  TOOLS: {
    // ...existing code...
    NEW_API_GROUP: {
      ACTION_API: '/api/services/app/NewService/NewAction'
    }
  }
}

Step 2: Create Interfaces

Define interfaces in src/types.ts for the input/output data:

export interface NewActionInput {
  Param1: string;
  Param2: number;
  // Other parameters...
}

Step 3: Create or Update Services

Create a new file in src/services/ or add to an existing service:

// src/services/new-service.service.ts
import { NewActionInput } from '../types.js';
import { ApiClient } from '../utils/api-client.js';
import { Logger } from '../utils/logger.js';
import { CONFIG } from '../config.js';

export class NewService {
  private logger = new Logger();

  async newAction(input: NewActionInput) {
    try {
      this.logger.debug('Calling new action API', {
        url: CONFIG.TOOLS.NEW_API_GROUP.ACTION_API,
        input
      });
      
      const response = await ApiClient.post(
        CONFIG.TOOLS.NEW_API_GROUP.ACTION_API, 
        null,
        { params: input }
      );
      
      this.logger.info('Action completed successfully', { input });
      return response.result;
    } catch (error) {
      this.logger.error('Error performing action', { error, input });
      throw error;
    }
  }
}

Step 4: Update Index

In src/index.ts:

  • Add the new service (if applicable)
  • Define the new tool in the tools list
  • Add a case handler in the handleToolCall function

Best Practices

When working with the MCP API Service, follow these guidelines:

  • Consistency: Maintain naming conventions and use established code patterns
  • Error Handling: Always implement try/catch blocks and log complete error information
  • Logging: Log each step (debug before API calls, info on success) with complete parameters
  • Validation: Check required parameters and validate input data types

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "api-service" '{"command":"npm","args":["run","start"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "api-service": {
            "command": "npm",
            "args": [
                "run",
                "start"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "api-service": {
            "command": "npm",
            "args": [
                "run",
                "start"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later