Skip to main content

xHR Assistant MCP

xhr-assistant-mcp connects AI agents to xHR through the Model Context Protocol (MCP). It runs locally over stdio and includes the xHR skill catalog required by the agent, so users do not need to clone another repository.

Requirements

  • Python 3.11 or newer
  • An xHR access token for the environment you want to use
  • An MCP client that supports stdio servers

Install

Installing with pipx keeps the MCP server isolated and makes the xhr-assistant command available globally:

python -m pip install --user pipx
python -m pipx ensurepath
pipx install xhr-assistant-mcp

Alternatively, install it in a virtual environment:

python -m venv .venv

Activate the environment:

# macOS or Linux
source .venv/bin/activate

# Windows PowerShell
.venv\Scripts\Activate.ps1

Then install the package:

python -m pip install xhr-assistant-mcp

Configure an MCP client

When installed with pipx, use this stdio configuration:

{
  "command": "xhr-assistant",
  "args": ["mcp"],
  "env": {
    "XHR_AUTHORIZATION": "Bearer <XHR_ACCESS_TOKEN>"
  }
}

If the MCP client cannot find commands from your PATH, use the absolute path returned by:

python -c "import shutil; print(shutil.which('xhr-assistant'))"

For a virtual-environment installation, point command at that environment's Python executable:

{
  "command": "/absolute/path/to/.venv/bin/python",
  "args": ["-m", "xhr_assistant_mcp", "mcp"],
  "env": {
    "XHR_AUTHORIZATION": "Bearer <XHR_ACCESS_TOKEN>"
  }
}

On Windows, the executable path is typically C:\\absolute\\path\\to\\.venv\\Scripts\\python.exe.

Restart or reconnect the MCP client after changing its configuration.

Environments

Production is the default environment:

Environment API Application
prod https://api.x-hr.co https://app.x-hr.co
sandbox https://api.sandbox.x-hr.co https://sandbox.x-hr.co

Select an environment before starting the MCP server:

xhr-assistant config set-env sandbox
xhr-assistant config show

Use an access token issued by the selected environment. Changing environments clears the cached account context, so reconnect the MCP client afterward.

To keep separate configurations for different MCP clients, set XHR_ASSISTANT_CONFIG_FILE in each server configuration:

{
  "command": "xhr-assistant",
  "args": ["mcp"],
  "env": {
    "XHR_ASSISTANT_CONFIG_FILE": "/absolute/path/to/xhr-sandbox.json",
    "XHR_AUTHORIZATION": "Bearer <SANDBOX_XHR_ACCESS_TOKEN>"
  }
}

Initialize that specific configuration once:

# macOS or Linux
XHR_ASSISTANT_CONFIG_FILE=/absolute/path/to/xhr-sandbox.json \
  xhr-assistant config set-env sandbox
# Windows PowerShell
$env:XHR_ASSISTANT_CONFIG_FILE = "C:\path\to\xhr-sandbox.json"
xhr-assistant config set-env sandbox

Environment variables

Variable Purpose
XHR_AUTHORIZATION Bearer access token used for xHR API requests. Recommended for backend and non-interactive agents.
XHR_ASSISTANT_CONFIG_FILE Optional path to an isolated configuration file.
XHR_API_BASE_URL Optional API URL used when creating a new configuration file.
XHR_APP_URL Optional application URL used when creating a new configuration file.

Do not commit access tokens or place them in agent prompts. Supply secrets with your process environment or secret manager.

MCP tools

The agent workflow uses two restricted tools:

  • read reads an approved xHR skill entrypoint. Agents start at skills/SKILL.md, select a domain, and read the matching leaf skill.
  • exec runs only a script declared by the selected leaf skill. It is not a general-purpose shell.

The MCP server attaches the configured xHR context to API operations. The xHR API remains responsible for authentication and authorization.

MCP prompt

The server publishes the xhr_assistant_system_prompt prompt. MCP clients can load it as the system instructions for an xHR-capable agent.

Required integration step: inject this prompt into the agent's system instructions. Connecting the MCP server alone exposes the tools, but does not teach the agent the required skill-navigation and safe-execution workflow.

The prompt accepts a mode argument:

  • full (default) includes the domain catalog.
  • compact includes only the navigation, execution, authentication, and data safety contract.

Python agent hosts can retrieve the same instructions directly:

import os

from xhr_assistant_mcp import get_agent_instructions

system_prompt = get_agent_instructions(mode="full")

# Pass both values to your agent framework:
agent_config = {
    "instructions": system_prompt,
    "mcp_servers": {
        "xhr-assistant": {
            "command": "xhr-assistant",
            "args": ["mcp"],
            "env": {
                "XHR_AUTHORIZATION": os.environ["XHR_AUTHORIZATION"],
            },
        }
    },
}

agent_config is framework-neutral pseudoconfiguration: map instructions to your framework's system/developer prompt field and map the stdio server object to its MCP configuration. Keep the token in the backend process environment; do not copy it into system_prompt.

If the host supports MCP prompts natively, it may fetch xhr_assistant_system_prompt from the connected server instead. Inject the returned text before the agent handles xHR requests.

Verify the installation

xhr-assistant --help
xhr-assistant config show
xhr-assistant prompt --mode compact

The MCP server communicates over stdin/stdout, so start it through an MCP client rather than expecting an HTTP port or browser page.

Metadata

Release files for xhr-assistant-mcp 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xhr-assistant-mcp 0.3.1
File Size Uploaded Provenance
xhr_assistant_mcp-0.3.1.tar.gz 360.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for xhr-assistant-mcp 0.3.1
File Interpreter ABI Platform
xhr_assistant_mcp-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 978.0 kB

Release files / xhr_assistant_mcp-0.3.1.tar.gz

Download URL xhr_assistant_mcp-0.3.1.tar.gz
Size 360.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ac326ed680e5bb7caa0a2599b7e0959277febf4ea602cb203e431d87c5146e16
BLAKE2b-256 checksum
How to use checksums
3294140d67b168130c27a66e81380ef3695bb180d3e99805d8f4eb196590e9c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.14

Release files / xhr_assistant_mcp-0.3.1-py3-none-any.whl

Download URL xhr_assistant_mcp-0.3.1-py3-none-any.whl
Size 617.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f145c7afbaddc197f0ecffbbbedc88755a4e808d36047972a7659179ee09badf
BLAKE2b-256 checksum
How to use checksums
219137710436c02268769df2ff850fdebae1112dac108dee9f2d5c22f9208bcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.14

Security for xhr-assistant-mcp 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page