PyerP MCP Server

PyerP MCP Server

An MCP server that enables LLM agents to interact with PyerP ERP systems via a REST API. It allows users to search, read, create, and update ERP records such as inventory, clients, and users using natural language.

Category
访问服务器

README

PyerP MCP Server

An MCP (Model Context Protocol) server that exposes a PyerP ERP system to LLM agents. The server translates MCP tool calls into HTTP requests against the PyerP REST API, giving any MCP-compatible client (Claude Desktop, OpenCode, Cursor, etc.) the ability to search, read, create and update ERP records through natural language.

Architecture

┌──────────────┐       MCP (stdio/SSE/HTTP)       ┌────────────────┐
│  LLM Client  │ ◄──────────────────────────────► │  PyerP MCP     │
│  (Claude,    │                                   │  Server         │
│   Cursor…)   │                                   │  (server.py)    │
└──────────────┘                                   └───────┬────────┘
                                                           │ httpx
                                                           ▼
                                                   ┌────────────────┐
                                                   │  PyerP REST    │
                                                   │  API (Flask)   │
                                                   └────────────────┘

The server itself is stateless. It authenticates to PyerP via api_key query parameter, exactly as the native web client does.

Requirements

  • Python 3.10+
  • A running PyerP instance with API access
  • A valid PyerP API key

Installation

# Clone the repository
git clone <repo-url> PyerP-MCP
cd PyerP-MCP

# Install dependencies (pick one)
pip install -e .            # pip
# or
uv pip install -e .         # uv

Configuration

Copy the example environment file and fill in your values:

cp .env.example .env
Variable Default Description
PYERP_BASE_URL http://localhost:5000 Base URL of your PyerP instance (no trailing slash)
PYERP_API_KEY (empty) API key for authentication. Required.
PYERP_DEFAULT_MODULE admin Default module used when module is omitted in tool calls
PYERP_REQUEST_TIMEOUT 30 HTTP request timeout in seconds

Running the Server

stdio (default, for Claude Desktop / OpenCode / Cursor)

python server.py

SSE transport

python server.py --sse

Streamable HTTP transport

python server.py --streamable-http

With uv (no install needed)

uv run --with "mcp[cli]" --with httpx --with python-dotenv server.py

Client Configuration Examples

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "pyerp": {
      "command": "python",
      "args": ["/absolute/path/to/PyerP-MCP/server.py"],
      "env": {
        "PYERP_BASE_URL": "http://localhost:5000",
        "PYERP_API_KEY": "your_api_key_here"
      }
    }
  }
}

OpenCode

Add to your OpenCode MCP configuration:

{
  "mcpServers": {
    "pyerp": {
      "command": "python",
      "args": ["/absolute/path/to/PyerP-MCP/server.py"],
      "env": {
        "PYERP_BASE_URL": "http://localhost:5000",
        "PYERP_API_KEY": "your_api_key_here"
      }
    }
  }
}

Available Tools

Search

Tool Description
search Search records with AND logic. Multiple param/value pairs must all match.
search_or Search records with OR logic. Any param/value pair can match.

Both tools accept: search_param, search_value, module, model, search_order_by, search_order, solve_references, page, page_size.

Search parameter behavior:

  • Multiple params with matching values (e.g. "name,email" + "John,john@test.com") applies AND/OR between each pair.
  • One param with multiple values (e.g. "status" + "active,pending") matches any value for that column (OR/IN).
  • Use "null" as a value to match NULL fields.
  • The g_ prefix on column names is added automatically; you do not need to include it.

Retrieve

Tool Description
get_record Get a single record by entity_id or entity_uuid.
get_record_with_references Same as above but with foreign key references resolved to human-readable values.
get_all_records Paginated list of all records (newest first). Max 1000 per page.
get_all_records_with_references Paginated list with FK references resolved. Max 10 per page.
get_detail Full detail view: inline fields with labels, reference dropdowns, and related sub-lists.

Create & Update

Tool Description
create_record Create a new record. Pass field values as a data dictionary.
update_record Update an existing record by entity_uuid. Only include changed fields.

Metadata

Tool Description
check_api_status Health check on a PyerP API module.

Available Resources

The server exposes two static MCP resources that LLM clients can read for context:

URI Description
pyerp://info/field-conventions Column prefix conventions (g_, ref_, enc_, etc.) and system column documentation.
pyerp://info/api-guide Quick reference with current configuration, available modules/models, and workflow examples.

PyerP Concepts

Modules

A PyerP instance is organized into modules. Each module exposes its own API under /api_{module}/. The main module is admin, which manages most data models.

Module Description
admin Users, roles, permissions, clients, products, providers, warehouse, inventory, etc.
contacts Contact management
media File/media management
templates Template management
messenger Email & SMS messaging
communications Communications management
reports Reporting

Additional modules may be dynamically loaded depending on the PyerP instance configuration.

Models (Tables)

Within the admin module, common models include:

users, roles, permissions, clients, products, providers, warehouse, inventory, inventory_movements, remissions, price_rate, patients, diagnoses, health_providers, media

Field Naming Conventions

Prefix Meaning Example
g_ General/regular field g_name, g_email, g_status
ref_ Foreign key reference ref_roles (references roles table)
uref_ Unique foreign key (1-to-1) uref_profile
enc_ Encrypted field enc_password
bol_ Boolean bol_active
int_ Integer int_quantity
dec_ Decimal dec_price
json_ JSON data json_metadata
dt_ Date/time dt_scheduled

System columns (entity_id, entity_uuid, created_at, updated_at, deleted, deleted_at) are auto-managed. Do not include them in create/update calls.

Soft Delete

PyerP uses soft deletes. All records have a deleted column (0 = active, 1 = deleted). All queries automatically filter WHERE deleted = 0.

Usage Examples

"Show me the first 20 users"
→ get_all_records(module="admin", model="users", page_size=20)

"Search for a client named ACME"
→ search(search_param="name", search_value="ACME", module="admin", model="clients")

"Find products that are active or pending"
→ search_or(search_param="status", search_value="active,pending", module="admin", model="products")

"Show me the full details of user with entity_id 5"
→ get_detail(entity_id=5, module="admin", model="users")

"Create a new provider"
→ create_record(data={"g_name": "New Provider", "g_email": "info@provider.com"}, module="admin", model="providers")

"Update client 789456123 phone number"
→ update_record(entity_uuid="789456123", data={"g_phone": "5559876543"}, module="admin", model="clients")

Project Structure

PyerP-MCP/
├── server.py          # MCP server (tools, resources, helpers)
├── pyproject.toml     # Project metadata and dependencies
├── .env.example       # Configuration template
├── README.md          # This file
└── agents.md          # LLM agent prompt guide

License

See the PyerP main repository for license information.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选
mcp-server-qdrant

mcp-server-qdrant

这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。

官方
精选
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选