ERPNext and Frappe REST/RPC MCP Server for Agentic AI!
Project description
Erpnext MCP
ERPNext and Frappe Framework enterprise resources planner. Built with the highest architectural standards, incorporating dynamic facades, custom API routing, and FastMCP tool decoration.
Documentation — Installation, deployment, usage across the MCP, API, and CLI interfaces, and guidance for provisioning the ERPNext / Frappe platform are maintained in the official documentation.
Table of Contents
- Overview
- Features
- Installation
- Usage
- Configuration
- MCP Tools
- Architecture
- Deployment
- Documentation
- Contributing
- License
Overview
Erpnext MCP provides a high-performance, model-optimized interface to Erpnext capabilities. It isolates the model from underlying API transport complexity, ensuring safe, idempotent, and highly traceable system interactions.
Features
- Dynamic Facade Orchestration: Integrates multi-inheritance clients cleanly under a single facade.
- Battle-Tested Resilience: Out-of-the-box credential authentication, connection polling, and request retry strategies.
- FastMCP Declarative Tools: Fast, native schema registration with full inline validation.
- Complete Test Intent Diversity: Deep, automated unit, integration, and mock tests ensuring high code coverage.
⚙️ Dynamic Tool Selection & Visibility
This MCP server supports dynamic toolset selection and visibility filtering at runtime. This allows you to restrict the set of exposed tools in order to prevent blowing up the LLM's context window.
You can configure tool filtering via multiple input channels:
- CLI Arguments: Pass
--toolsor--toolsets(or their disabled counterparts--disabled-toolsand--disabled-toolsets) during startup. - Environment Variables: Define standard environment variables:
MCP_ENABLED_TOOLS/MCP_DISABLED_TOOLSMCP_ENABLED_TAGS/MCP_DISABLED_TAGS
- HTTP SSE Request Headers: Pass custom headers during transport initialization:
x-mcp-enabled-tools/x-mcp-disabled-toolsx-mcp-enabled-tags/x-mcp-disabled-tags
- HTTP SSE Request Query Parameters: Append query parameters directly to your transport connection URL:
?tools=tool1,tool2?tags=tag1
When query strings or parameters are supplied, an LLM-free Knowledge Graph resolution layer (using DynamicToolOrchestrator) matches query intents against known tool tags, names, or descriptions, with safe fallback and automated 24-hour background cache refreshing.
Installation
Pick the extra that matches what you want to run:
| Extra | Installs | Use when |
|---|---|---|
erpnext-agent[mcp] |
Slim MCP server only (agent-utilities[mcp] — FastMCP/FastAPI) |
You only run the MCP server (smallest install / image) |
erpnext-agent[agent] |
Full agent runtime (agent-utilities[agent,logfire] — Pydantic AI + the epistemic-graph engine) |
You run the integrated agent |
erpnext-agent[all] |
Everything (mcp + agent + logfire) |
Development / both surfaces |
# MCP server only (recommended for tool hosting — slim deps)
uv pip install "erpnext-agent[mcp]"
# Full agent runtime (Pydantic AI + epistemic-graph engine)
uv pip install "erpnext-agent[agent]"
# Everything (development)
uv pip install "erpnext-agent[all]" # or: python -m pip install "erpnext-agent[all]"
Container images (:mcp vs :agent)
One multi-stage docker/Dockerfile builds two right-sized images, selected by --target:
| Image tag | Build target | Contents | Entrypoint |
|---|---|---|---|
knucklessg1/erpnext-agent:mcp |
--target mcp |
erpnext-agent[mcp] — slim, no engine/pydantic-ai/dspy/llama-index/tree-sitter |
erpnext-mcp |
knucklessg1/erpnext-agent:latest |
--target agent (default) |
erpnext-agent[agent] — full agent runtime + epistemic-graph engine |
erpnext-agent |
docker build --target mcp -t knucklessg1/erpnext-agent:mcp docker/ # slim MCP server
docker build --target agent -t knucklessg1/erpnext-agent:latest docker/ # full agent
Knowledge-graph database (epistemic-graph)
The full agent ([agent] / :latest) embeds the epistemic-graph engine (pulled in
transitively via agent-utilities[agent]). For production — or to share one knowledge graph
across multiple agents — run epistemic-graph as its own database container and point the
agent at it instead of embedding it. Deployment recipes (single-node + Raft HA), connection
config, and the full database architecture (with diagrams) are documented in the
epistemic-graph deployment guide.
The slim [mcp] server does not require the database.
Usage
You can launch the FastMCP server in stdio mode via Python module execution:
import asyncio
from erpnext_agent.mcp_server import get_mcp_instance
async def main():
mcp = get_mcp_instance()
# Execute stdio loop or launch server
print("MCP Server ready.")
if __name__ == "__main__":
asyncio.run(main())
For direct shell launch, execute:
python -m erpnext_agent.mcp_server
Configuration
The package is fully configurable via the environment variables listed below.
Connection & Credentials
| Variable | Description | Default |
|---|---|---|
ERPNEXT_URL |
ERPNext / Frappe server endpoint URL (falls back to ERPNEXT_AGENT_BASE_URL) |
http://localhost:8000 |
ERPNEXT_TOKEN |
API token authentication (api_key:api_secret) |
— |
ERPNEXT_AGENT_BASE_URL |
Endpoint URL fallback when ERPNEXT_URL is unset |
— |
ERPNEXT_AGENT_USERNAME |
Username for password-based login | — |
ERPNEXT_AGENT_PASSWORD |
Password for password-based login | — |
ERPNEXT_AGENT_SSL_VERIFY |
TLS certificate verification | True |
MCP server / transport
| Variable | Description | Default |
|---|---|---|
TRANSPORT |
stdio, streamable-http, or sse |
stdio |
HOST |
Bind host (HTTP transports) | 0.0.0.0 |
PORT |
Bind port (HTTP transports) | 8000 |
MCP_TOOL_MODE |
Tool surface: condensed, verbose, or both |
condensed |
Tool toggles
Each action-routed tool can be disabled individually via its toggle env var (set to false):
AUTHENTICATIONTOOL, RESOURCETOOL (see the MCP Tools table above).
A local template is supplied inside .env.example. Copy this file as .env and fill out your specific service endpoint parameters before starting execution.
MCP Tools
Auto-generated from the live MCP server — do not edit by hand.
Condensed action-routed tools (default — MCP_TOOL_MODE=condensed)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
erpnext_agent_authentication |
AUTHENTICATIONTOOL |
Manage ERPNext Agent authentication operations. |
erpnext_agent_resource |
RESOURCETOOL |
Manage ERPNext Agent resource operations. |
Verbose 1:1 API-mapped tools (MCP_TOOL_MODE=verbose or both)
13 per-operation tools — one per public API method (click to expand)
| MCP Tool | Toggle Env Var | Description |
|---|---|---|
erpnext_authGetLoggedUser |
APITOOL |
Alias for get_logged_user matching OpenAPI operationId. |
erpnext_auth_get_logged_user |
APITOOL |
Snake-case alias for get_logged_user. |
erpnext_call_method |
APITOOL |
Execute dotted path whitelisted RPC methods (covers 100% of custom functions). |
erpnext_create_document |
APITOOL |
Create a new document resource. |
erpnext_delete_document |
APITOOL |
Delete a specific document resource. |
erpnext_get_document |
APITOOL |
Get a document resource by name. |
erpnext_get_logged_user |
APITOOL |
Get the user that is logged in. |
erpnext_get_version |
APITOOL |
Get installed app versions. |
erpnext_list_documents |
APITOOL |
List document resources with pagination, filters, and selected fields. |
erpnext_login |
APITOOL |
Authenticate yourself. |
erpnext_logout |
APITOOL |
Logout from current session. |
erpnext_update_document |
APITOOL |
Update a specific document resource. |
erpnext_version |
APITOOL |
Alias for get_version. |
2 action-routed tool(s) (default) · 13 verbose 1:1 tool(s). Each is enabled unless its <DOMAIN>TOOL toggle is set false; MCP_TOOL_MODE selects the surface (condensed default · verbose 1:1 · both). Auto-generated — do not edit.
MCP Configuration Examples
Install the slim
[mcp]extra. All examples installerpnext-agent[mcp]— the MCP-server extra that pulls only the FastMCP / FastAPI tooling (agent-utilities[mcp]). It deliberately excludes the heavy agent runtime (pydantic-ai, the epistemic-graph engine,dspy,llama-index), souvx/ container installs are far smaller. Use the full[agent]extra only when you need the integrated Pydantic AI agent.
stdio Transport (local IDEs — Cursor, Claude Desktop, VS Code)
{
"mcpServers": {
"erpnext-mcp": {
"command": "uvx",
"args": [
"--from",
"erpnext-agent[mcp]",
"erpnext-mcp"
],
"env": {
"MCP_TOOL_MODE": "condensed",
"AUTHENTICATIONTOOL": "True",
"ERPNEXT_AGENT_BASE_URL": "http://localhost:8000",
"ERPNEXT_AGENT_PASSWORD": "your_password",
"ERPNEXT_AGENT_USERNAME": "your_username",
"ERPNEXT_TOKEN": "your_api_key:your_api_secret",
"ERPNEXT_URL": "http://localhost:8000",
"RESOURCETOOL": "True"
}
}
}
}
Streamable-HTTP Transport (networked / production)
{
"mcpServers": {
"erpnext-mcp": {
"command": "uvx",
"args": [
"--from",
"erpnext-agent[mcp]",
"erpnext-mcp",
"--transport",
"streamable-http",
"--port",
"8000"
],
"env": {
"TRANSPORT": "streamable-http",
"HOST": "0.0.0.0",
"PORT": "8000",
"MCP_TOOL_MODE": "condensed",
"AUTHENTICATIONTOOL": "True",
"ERPNEXT_AGENT_BASE_URL": "http://localhost:8000",
"ERPNEXT_AGENT_PASSWORD": "your_password",
"ERPNEXT_AGENT_USERNAME": "your_username",
"ERPNEXT_TOKEN": "your_api_key:your_api_secret",
"ERPNEXT_URL": "http://localhost:8000",
"RESOURCETOOL": "True"
}
}
}
}
Alternatively, connect to a pre-deployed Streamable-HTTP instance by url:
{
"mcpServers": {
"erpnext-mcp": {
"url": "http://localhost:8000/erpnext-mcp/mcp"
}
}
}
Deploying the Streamable-HTTP server via Docker:
docker run -d \
--name erpnext-mcp-mcp \
-p 8000:8000 \
-e TRANSPORT=streamable-http \
-e HOST=0.0.0.0 \
-e PORT=8000 \
-e MCP_TOOL_MODE=condensed \
-e AUTHENTICATIONTOOL=True \
-e ERPNEXT_AGENT_BASE_URL=http://localhost:8000 \
-e ERPNEXT_AGENT_PASSWORD=your_password \
-e ERPNEXT_AGENT_USERNAME=your_username \
-e ERPNEXT_TOKEN=your_api_key:your_api_secret \
-e ERPNEXT_URL=http://localhost:8000 \
-e RESOURCETOOL=True \
knucklessg1/erpnext-agent:mcp
Auto-generated from the code-read env surface (MCP_TOOL_MODE + package vars) — do not edit.
Additional Deployment Options
erpnext-agent can also run as a local container (Docker / Podman / uv) or be
consumed from a remote deployment. The
Deployment guide has full, copy-paste
mcp_config.json for all four transports — stdio, streamable-http,
local container / uv, and remote URL:
- Local container / uv — launch the server from
mcp_config.jsonviauvx,docker run, orpodman run, or point at a local streamable-http container byurl. - Remote URL — connect to a server deployed behind Caddy at
http://erpnext-mcp.arpa/mcpusing the"url"key.
Documentation
The complete documentation is published as the official documentation site and is the recommended reference for installation, deployment, and day-to-day operation.
| Page | Contents |
|---|---|
| Installation | pip, source, extras, prebuilt Docker image |
| Deployment | run the MCP and agent servers, Compose, Caddy + Technitium, env config |
| Usage | the MCP tools, the Api client, the CLI |
| Backing Platform | deploy ERPNext / Frappe with Docker |
| Overview | the dynamic facade and FastMCP tool layer |
| Concepts | concept registry (CONCEPT:ERPN-*) |
AGENTS.md is the canonical contributor/agent guidance.
Contributing
Please audit all code changes against ecosystem guidelines in CONTRIBUTING.md if available, and run:
pre-commit run --all-files
License
This project is licensed under the MIT License. See the LICENSE file for complete details.
Deploy with agent-os-genesis
This package can be provisioned for you — skill-guided — by the agent-os-genesis
universal skill (its single-package deploy mode): it picks your install method, seeds
secrets to OpenBao/Vault (or .env), trusts your enterprise CA, registers the MCP
server, and verifies it — the same machinery that stands up the whole Agent OS, narrowed
to just this package. Ask your agent to "deploy erpnext-agent with agent-os-genesis".
| Install mode | Command |
|---|---|
| Bare-metal, prod (PyPI) | uvx erpnext-mcp · or uv tool install erpnext-agent |
| Bare-metal, dev (editable) | uv pip install -e ".[all]" · or pip install -e ".[all]" |
| Container, prod | deploy knucklessg1/erpnext-agent:latest via docker-compose / swarm / podman / podman-compose / kubernetes |
| Container, dev (editable) | deploy docker/compose.dev.yml (source-mounted at /src; edits live on restart) |
Secrets are read-existing + seeded via vault_sync — you are only prompted for what's missing.
Environment Variables
Package environment variables
| Variable | Example | Description |
|---|---|---|
HOST |
0.0.0.0 |
|
PORT |
8000 |
|
TRANSPORT |
stdio |
options: stdio, streamable-http, sse |
ERPNEXT_URL |
http://localhost:8000 |
ERPNext / Frappe server endpoint URL (falls back to ERPNEXT_AGENT_BASE_URL) |
ERPNEXT_TOKEN |
your_api_key:your_api_secret |
API token authentication (api_key:api_secret) |
ERPNEXT_AGENT_BASE_URL |
http://localhost:8000 |
Endpoint URL fallback when ERPNEXT_URL is unset |
ERPNEXT_AGENT_USERNAME |
your_username |
Username / password login (alternative to token auth) |
ERPNEXT_AGENT_PASSWORD |
your_password |
|
ERPNEXT_AGENT_SSL_VERIFY |
True |
|
AUTHENTICATIONTOOL |
True |
|
RESOURCETOOL |
True |
Inherited agent-utilities variables (apply to every connector)
| Variable | Example | Description |
|---|---|---|
MCP_TOOL_MODE |
condensed |
Tool surface: condensed |
MCP_ENABLED_TOOLS |
— | Comma-separated tool allow-list |
MCP_DISABLED_TOOLS |
— | Comma-separated tool deny-list |
MCP_ENABLED_TAGS |
— | Comma-separated tag allow-list |
MCP_DISABLED_TAGS |
— | Comma-separated tag deny-list |
EUNOMIA_TYPE |
none |
Authorization mode: none |
EUNOMIA_POLICY_FILE |
mcp_policies.json |
Embedded Eunomia policy file |
EUNOMIA_REMOTE_URL |
— | Remote Eunomia authorization server URL |
ENABLE_OTEL |
False |
Enable OpenTelemetry export |
OTEL_EXPORTER_OTLP_ENDPOINT |
— | OTLP collector endpoint |
MCP_CLIENT_AUTH |
— | Outbound MCP auth (oidc-client-credentials for fleet calls) |
OIDC_CLIENT_ID |
— | OIDC client id (service-account auth) |
OIDC_CLIENT_SECRET |
— | OIDC client secret (service-account auth) |
DEBUG |
False |
Verbose logging |
PYTHONUNBUFFERED |
1 |
Unbuffered stdout (recommended in containers) |
MCP_URL |
http://localhost:8000/mcp |
URL of the MCP server the agent connects to |
PROVIDER |
openai |
LLM provider for the agent |
MODEL_ID |
gpt-4o |
Model id for the agent |
ENABLE_WEB_UI |
True |
Serve the AG-UI web interface |
11 package + 19 inherited variable(s). Auto-generated from .env.example + the shared agent-utilities set — do not edit.
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file erpnext_agent-1.0.1.tar.gz.
File metadata
- Download URL: erpnext_agent-1.0.1.tar.gz
- Upload date:
- Size: 26.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
248d9657693b2e929713409af3714e0c8735806b90e3849200474fd7a6a51965
|
|
| MD5 |
d3d137e3570c53d846794c56b0a65b26
|
|
| BLAKE2b-256 |
4c464fdc8b4ffa7f9a1cdbd03e26c88eb890da970346eda918ec2f5d0f9cc99e
|
File details
Details for the file erpnext_agent-1.0.1-py3-none-any.whl.
File metadata
- Download URL: erpnext_agent-1.0.1-py3-none-any.whl
- Upload date:
- Size: 25.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ac79622279dc2ae476a68c9e979ebcdbb68dde2a6d8ef4ba9f8484e98e8cebb
|
|
| MD5 |
2e48ff19b42fd7053db98facc1bbdabe
|
|
| BLAKE2b-256 |
5cf882cd961cc4d52eb0f06e9ed09a66203c8f46412f28fbce0e594ff3f62788
|