Skip to main content
Glama
xiejianjun000

pollution-permit-mcp


AIGC: Label: "1" ContentProducer: 001191440300708461136T1XGW3 ProduceID: c3e1d189ed77864364abef970f361174_cc96e0c0a1e511f1abe1525400e6dd8f ReservedCode1: NJWv7pof6N4zs+DCuplZqym42Cus+bRWvStMbVpSzCwaQatuiHqVSoqLluXUc3DFHznps6pKH2yl0CzMRN0VafbyYMwviAhLbyPc/zOKHRlhIXaJ44xs8iQRgxXni3BMOMnMZpK1aZBQ2voImDv35w31/lwbAwrJrW3uzKLynrUZJDUQbbYK460tPi8= ContentPropagator: 001191440300708461136T1XGW3 PropagateID: c3e1d189ed77864364abef970f361174_cc96e0c0a1e511f1abe1525400e6dd8f ReservedCode2: NJWv7pof6N4zs+DCuplZqym42Cus+bRWvStMbVpSzCwaQatuiHqVSoqLluXUc3DFHznps6pKH2yl0CzMRN0VafbyYMwviAhLbyPc/zOKHRlhIXaJ44xs8iQRgxXni3BMOMnMZpK1aZBQ2voImDv35w31/lwbAwrJrW3uzKLynrUZJDUQbbYK460tPi8=

National Pollution Discharge Permit Public Portal MCP Server

A transparent MCP service built on the National Pollution Discharge Permit Management Information Platform public portal (permit.mee.gov.cn). Enter any company name and instantly retrieve the permit original and copy, discharge outlet coordinates, post-permit management status in real time, and full text of policies and regulations.

Related MCP server: Bidding MCP Server

Features

Capability

Description

Company search

Paginated queries by province/city/unit name/permit number/industry, covering 38,000+ pages nationwide

Permit details

Basic info, original version, copy summary, hidden coordinate fields, discharge outlet points (AES auto-decryption)

Full copy text

Page-by-page PNG download (~42 pages), integrated with upstream OCR to reconstruct full text (process flow/products/discharge standards)

Post-permit management

Compliance reports (report period/treatment facility operation/compliance status), supervision and enforcement, self-monitoring entry

Announcements

Rectification deadlines, cancellation/revocation/loss declarations

Policies & regulations

6 major category directories + full text + attachment downloads

Engineering

WebShield session auto-maintenance, 1s rate limiting, exponential backoff retry, SQLite cache

Quick Start

pip install -r requirements.txt
python server.py

Once connected via the standard MCP client protocol, tools can be invoked.

Tool List

Tool

Purpose

search_licenses

Query the public license info list (returns dataid)

get_license_detail

Details: text info + coordinates + discharge outlet points

get_license_pages

List of copy image pages

download_license_page

Download a single copy page PNG (for OCR)

get_qrcode_info

Discharge outlet QR code URL

get_post_permit_status

Post-permit management: compliance reports/supervision/self-monitoring

get_rectification

Rectification deadline public notice

get_announcements

Cancellation/revocation/loss announcements

list_policy_docs

Policy and regulation category directory

get_policy_detail

Full text of policies and regulations

get_discharge_points

Decrypted discharge outlet point results

get_monitoring_data

Self-monitoring platform integration URL

Architecture

server.py (FastMCP 入口)
  └─ permit_mcp/tools.py      工具定义(12 个)
      ├─ client.py            WebShield 会话 / 限速 / 重试 / 缓存
      ├─ parser.py            HTML→JSON / AES-ECB 解密 / 表格解析
      └─ config.py            接口地址与常量

Key Implementation Details

  1. No login required: The public portal needs no account, only a WebShield session token (obtained by automatically visiting the homepage to warm up).

  2. List API: POST /perxxgkinfo/syssb/xkgg/xkgg!licenseInformation.action, parameters province/city/unitName/licenseNumber/industry/pageIndex/pageSize.

  3. Detail API: GET xkgkAction!xkgk.action?xkgk=getxxgkContent&dataid=<ID>, coordinates are stored in hidden input fields; discharge outlet points are inline AES-128-ECB ciphertext, with the key hardcoded in the page JS and decrypted automatically.

  4. Copy images: showImage.action?dataid=<ID> to get pkid and page count → downFilePng.action?datafileid=<pkid>_<page number> to download PNGs page by page.

  5. Post-permit management: Compliance reports use the async JSON API hpsp-company-sewage!getZxbgByYear.action (parameters reportYear/dataid), returning annual/quarterly reports and permitrep report document links; self-monitoring integrates with wryjc.mee.gov.cn.

  6. Regulation full text: lawsStandardList.action?columntype=<category> lists the directory → getNewsDetail.action?pkid=<UUID> returns plain-text body (extracted from the .file-bottom container, navigation noise removed).

  7. Announcement tables: Cancellation/revocation/loss are plain table lists (no detail links), parsed by dynamic mapping based on column headers.

Self-Test Results (2026-08-27)

Verification item

Result

Dependency environment

fastmcp 2.14.7 + pydantic 2.13.4 no conflicts (do not use 3.4.x, its wheel is an empty shell)

12 MCP tools registered

All passed

stdio protocol connectivity (list_tools / call_tool)

Passed

search_licenses (Mage Home)

10 hits, 38,132 pages in full database

get_license_detail

Coordinates 112.92680/23.45318, 12 discharge outlets, AES decryption OK

get_license_pages + download_license_page

42-page list, single page PNG 102,757 bytes

get_post_permit_status

Fetched 2024/2025 annual reports + self-monitoring entry

get_announcements

10 cancellation notices/page, 16,118 pages in full database

get_policy_detail

Full text of the "Regulations on the Administration of Pollutant Discharge Permits" 8,099 characters, no navigation noise

Fix log: client.py deadlock (Lock→RLock), get_license_pages parsing, download_license_page missing dataid/fileType parameters, announcement table parser, regulation body container extraction.

Compliance Notes

  • Only accesses public portal data, no login, no CAPTCHA bypass.

  • Built-in 1-second request interval rate limiting and local caching to avoid putting pressure on the site.

  • Real-time discharge data belongs to the automatic monitoring private network (not a public API); the service provides the self-monitoring platform entry rather than unauthorized scraping.

Known Limitations

  • The copy is image-based and requires an OCR layer (can integrate PaddleOCR / Hunyuan vision models) to convert to text.

  • When some companies have no compliance report/supervision enforcement records, the corresponding tables being empty is normal.

  • get_rectification (rectification deadline) API currently returns empty data; parameters require further investigation. (AI-generated content, for reference only)

Maintenance

ActivityMaintained
ResponsivenessSyncing

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

  • F
    license
    Not graded
    quality
    F
    maintenance
    Enables querying Chinese enterprise business data including company profiles, shareholder information, investments, branch offices, and key personnel through fuzzy search and detailed lookups.
    4
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides comprehensive access to Chinese bidding and tendering data, enabling users to search for companies, analyze bidding statistics, query tender announcements, and discover project opportunities for market analysis and business development.
    10
  • F
    license
    Not graded
    quality
    D
    maintenance
    Provides comprehensive enterprise qualification and certificate data, including honors, administrative licenses, and professional background statistics. It enables users to search for companies and verify their bidding eligibility or compliance status through natural language queries.
    3

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/xiejianjun000/pollution-permit-mcp'

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