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.

Download files

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

Source Distribution

xhr_assistant_mcp-0.3.1.tar.gz (360.5 kB view details)

Uploaded Source

Built Distribution

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

xhr_assistant_mcp-0.3.1-py3-none-any.whl (617.5 kB view details)

Uploaded Python 3

File details

Details for the file xhr_assistant_mcp-0.3.1.tar.gz.

File metadata

  • Download URL: xhr_assistant_mcp-0.3.1.tar.gz
  • Upload date:
  • Size: 360.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.14

File hashes

Hashes for xhr_assistant_mcp-0.3.1.tar.gz
Algorithm Hash digest
SHA256 ac326ed680e5bb7caa0a2599b7e0959277febf4ea602cb203e431d87c5146e16
MD5 0e9f05a2149632bc31e1b3c6ec97690a
BLAKE2b-256 3294140d67b168130c27a66e81380ef3695bb180d3e99805d8f4eb196590e9c8

See more details on using hashes here.

File details

Details for the file xhr_assistant_mcp-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for xhr_assistant_mcp-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f145c7afbaddc197f0ecffbbbedc88755a4e808d36047972a7659179ee09badf
MD5 aceba4e80adbf8084b2ad46c1345bd3d
BLAKE2b-256 219137710436c02268769df2ff850fdebae1112dac108dee9f2d5c22f9208bcf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 files

0.3.0

2 files

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