Skip to main content

Cek Data Pelanggan PLN

Project description

MCP Gateway

MCP (Model Context Protocol) Gateway can translate MCP tool callings to traditional HTTP API requests. It can provide a configurable way to get existing HTTP API to MCP territory.

Getting Started

Create config file from config.example.yaml:

$ cp config.example.yaml config.yaml

Edit config.yaml file, map all APIs to MCP tools.

Then start launch it with SSE transport:

$ uv run mcp-gateway
INFO:     Started server process [15400]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3001 (Press CTRL+C to quit)

Default is 3001.

Server Control

Change Port

Provide parameter --port=<port_no> in command line will change the port to SSE/HTTP transport.

Launch gateway with port 3002:

$ uv run mcp-gateway --port=3002
INFO:     Started server process [15400]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:3002 (Press CTRL+C to quit)

Transport Types

The gateway supports three transport types:

SSE Transport (Default)

$ uv run mcp-gateway --transport=sse

HTTP Streaming Transport

Provide parameter --transport=http in command line to use HTTP streaming transport:

$ uv run mcp-gateway --transport=http
Starting HTTP streaming server on http://0.0.0.0:3001
Endpoint: POST /stream

The HTTP streaming transport provides:

  • Endpoint: POST /stream
  • Content-Type: application/json
  • Response: Streaming JSON responses
  • CORS: Enabled for cross-origin requests

Example usage with curl:

curl -X POST http://localhost:3001/stream \
  -H "Content-Type: application/json" \
  -d '{"method": "tools/list", "params": {}}'

stdio Transport

Provide parameter --transport=stdio in command line will change the transport to stdio.

E.G.:

$ uv run mcp-gateway --transport=stdio

It's meaningless to manually launch gateway in stdio transport. You can configure in Cursor or Cline like:

{
    "mcpServers": {
        "mcp-gateway": {
          "command": "uv",
          "args": ["run", "mcp-gateway", "--transport=stdio"]
        }
      }
}

Or MCP Inspector with form values:

Item Value
Transport Type STDIO
Command uv
Arguments run mcp-gateway --transport=stdio

Configuration File

There is two parts in configuration YAML, server and tools. server defines the basic info for gateway server use. tools defines the mapping from single MCP tool to HTTP API request.

server:
  name: rest-amap-server
  config:
    apiKey: foo
tools:
- name: maps-geo
  description: "将详细的结构化地址转换为经纬度坐标。支持对地标性名胜景区、建筑物名称解析为经纬度坐标"
  args:
  - name: address
    description: "待解析的结构化地址信息"
    required: true
  - name: city
    description: "指定查询的城市"
    required: false
  requestTemplate:
    url: "https://restapi.amap.com/v3/geocode/geo?key={{.config.apiKey}}&address={{.args.address}}&city={{.args.city}}&source=ts_mcp"
    method: GET
    headers:
    - key: x-api-key
      value: "{{.config.apiKey}}"
    - key: Content-Type
      value: application/json
  responseTemplate:
    body: |
      # 地理编码信息
      {{- range $index, $geo := .Geocodes }}
      ## 地点 {{add $index 1}}

      - **国家**: {{ $geo.Country }}
      - **省份**: {{ $geo.Province }}
      - **城市**: {{ $geo.City }}
      - **城市代码**: {{ $geo.Citycode }}
      - **区/县**: {{ $geo.District }}
      - **街道**: {{ $geo.Street }}
      - **门牌号**: {{ $geo.Number }}
      - **行政编码**: {{ $geo.Adcode }}
      - **坐标**: {{ $geo.Location }}
      - **级别**: {{ $geo.Level }}
      {{- end }}

Server

Item Description
name Server name
config Key/Value pairs that can be referenced by var {{.config.xxx}} in templates

Tools

tools is list of MCP tools mapping. Single tool props. are defined as follows:

Item Description
name Tool name (Function name), which is provided to LLM.
description Tool description through which LLM can understand what the tool could do.
args Arguments of tool (Function arguments).
requestTemplate Request mapping to target HTTP API.
responseTemplate Response mapping for response of target HTTP API.

Single argument props. are defined as follows:

Item Type Description
name Argument name, which is provided to LLM.
description Argument description through which LLM can understand and decide what value should be filled.
required Boolean Required argument or not.

Request template props. are defined as follows:

Item Description
method HTTP method
url Target HTTP API url template
headers HTTP headers

HTTP headers are defined as follows:

Item Description
key Header key
value Header value template

Response template props are defined as follows:

Item Description
body Response body template

Contribution

All kinds of contribution are welcomed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file iflow_mcp_cek_id_pln_prabayar_dan_pascab-0.1.9.tar.gz.

File metadata

File hashes

Hashes for iflow_mcp_cek_id_pln_prabayar_dan_pascab-0.1.9.tar.gz
Algorithm Hash digest
SHA256 26382eae2af837ddb4f85b2b7e6a016b05f2ec5d80d7b446c30964d65a670a95
MD5 83a07c2cc2a991d88f494fb2b7f7d302
BLAKE2b-256 9e97d01edd8927ecf8a6c9e53d3e7736d2cc4dbc97d1e5b72c53d7fa3597b3de

See more details on using hashes here.

File details

Details for the file iflow_mcp_cek_id_pln_prabayar_dan_pascab-0.1.9-py3-none-any.whl.

File metadata

File hashes

Hashes for iflow_mcp_cek_id_pln_prabayar_dan_pascab-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 0da9361aa87e3393370de951e42109abda2799e3a2020f4d95581b93fa07de39
MD5 c9477a6d0c20f6541e00bcb235778f2c
BLAKE2b-256 1c9e05b303cbdd34e4e4c51b453c510541cf3703e42b5c9b229e13482535e75b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page