Skip to main content

mcph

Coverage

MCP Harness: diagnostics, real-client proxy and LLM-as-a-judge evals for MCP servers.

Early development: mcph doctor and mcph proxy do the real work so far; mcph eval is not implemented yet.

Install

pip install mcph                # Python 3.12+
uvx mcph --help                 # or run it without installing
pip install 'mcph[gateway]'     # with the gateway, mcph proxy --gateway (see The gateway)

Quick start

mcph init writes a starter mcph.yaml for you:

$ mcph init --server-cmd "uv run python src/server.py"
Created /path/to/mcph.yaml
Edit the server entries, then run `mcph doctor run`.

Or write it yourself. It describes your MCP servers: stdio servers that mcph starts for you, and http servers that are already running.

extends:
  - builtin:core               # the rules that ship with mcph (without a pack there is no rule)

servers:
  - name: orders
    transport: stdio
    command: uv
    args: ["run", "python", "src/server.py"]
    env_file: .env             # more variables for the server, kept out of this file
    env:
      LOG_LEVEL: WARNING
      API_KEY: ${API_KEY}      # taken from the environment mcph runs in
  - name: docs
    transport: http
    url: http://localhost:8080/mcp
    env_file: .env             # where ${DOCS_TOKEN} is looked for if the environment does not have it
    auth:                      # optional: send a bearer token
      type: bearer
      token: ${DOCS_TOKEN}     # the token comes from this environment variable

A stdio server only gets the environment you give it: ${API_KEY} takes a variable from the environment mcph runs in, and env_file points at a dotenv file (keep it out of Git) for the variables you do not want in mcph.yaml (see Environment variables of a server). The bearer token of an http server is written the same way: token: ${DOCS_TOKEN}, and its own env_file is where mcph looks for the variable when the environment it runs in does not have it, which is the case for a client that starts mcph without your shell's variables.

Then check them:

$ mcph doctor run
Checking 2 servers from /path/to/mcph.yaml

orders
  OK     started in 423 ms (orders-server 1.0.0, MCP 2026-07-28), 3 tools
  WARN   core.tool_name_snake_case: tool 'getOrder' is not snake_case (try 'get_order')
docs
  OK     connected in 87 ms (docs-server 2.1.0, MCP 2026-07-28), 5 tools
  OK     core.tool_name_snake_case
  SKIP   oauth.metadata, oauth.issuer, oauth.pkce, oauth.registration: not needed, the server accepted the connection

All servers OK, 1 warning.

extends lists the packs whose rules doctor uses; builtin:core is the pack that ships with mcph (see Rules and packs). Under each server doctor lists every rule: OK ran and found nothing, WARN or ERROR found a problem, OFF is turned off in mcph.yaml, and SKIP could not run or was not needed (skipped rules with the same reason share one line). To make a rule fail the run instead, or to switch it off, add a doctor section to the same file:

doctor:
  rules:
    core.tool_name_snake_case: error   # or warn, or off

See Configuring rules for the details.

Commands

Command What it does
mcph init [DIRECTORY] Writes a starter mcph.yaml that extends builtin:core (default: the current directory, created if needed). It never overwrites an existing file.
mcph doctor run Starts each stdio server (or connects to an http one), completes the MCP handshake, lists its tools, checks them against the rules of the packs under extends and reports what each rule found.
mcph doctor rules Lists the rules of the packs under extends with their severity: the default, or the setting from doctor.rules in mcph.yaml. It starts no server.
mcph pack list Lists the packs under extends with the rules each one defines.
mcph pack verify [PATH] Checks a pack directory (default .): its manifest, its rule files and the rules they define. It lists every problem and exits with 1 if there are any.
mcph auth login, status, logout Signs in to an http server that uses OAuth through the browser, shows who is logged in, and signs out again.
mcph version Prints the installed version.
mcph proxy [--trace-out FILE] [--no-redact] (-- COMMAND... | --server NAME | --gateway [--no-namespace-tools]) [--transport http [--host HOST] [--port N] [--path PATH] [--ready-file FILE] [--allow-remote]] Records the traffic between a client and a server, to a trace: a stdio server given as a command, or a stdio or http server of mcph.yaml with its environment and auth, for a client that starts the proxy. With --transport http, an http server of mcph.yaml on a local URL, for a client that connects by URL. With --gateway, every server of mcph.yaml behind one endpoint, on stdio or a URL (needs mcph[gateway]). See Recording traffic.
mcph eval Placeholder, not implemented yet: planned for 0.4.0.

mcph doctor is a group of commands: on its own it is an error, so a script that still calls it fails instead of passing without checking anything. mcph doctor --help lists its commands.

  • mcph init --template minimal|multi-server|oauth picks the starter: one stdio server (the default), a stdio server plus an http server with a bearer token from an environment variable, or an http server that signs in with OAuth. --server-cmd "uv run python src/server.py" sets how the stdio server starts (split like a shell would). --extend SOURCE (repeatable) replaces the default builtin:core, so add --extend builtin:core to keep the core rules next to a pack of your own. --force overwrites an existing mcph.yaml. init writes DIRECTORY/mcph.yaml, so the global -c does not apply to it.
  • -c, --config PATH selects the config file (default ./mcph.yaml). It goes before the command: mcph -c other.yaml doctor run.
  • mcph doctor run --timeout SECONDS limits how long each server may take to start and answer (default 30).
  • mcph doctor run --strict also fails on warnings, which is handy in CI.
  • mcph doctor run exits with 0 if all servers are OK, 1 if a server failed (or, with --strict, if there are warnings), 2 if the config is invalid.

If an http server refuses mcph, doctor says why instead of a generic error: no token was sent (401), the token was rejected (with the server's error, its explanation and the scope it asks for), or the token lacks a scope (403). It also shows what the server announces about its OAuth setup when it publishes protected resource metadata (RFC 9728): its authorization server and scopes.

docs
  ERROR  authentication required: the server answered 401 (add `auth` to this server in mcph.yaml)
         challenge: Bearer resource_metadata="http://localhost:8080/.well-known/oauth-protected-resource/mcp"
         authorization server: https://auth.example.com/
         scopes: api.read, api.write
  SKIP   core.tool_name_snake_case: mcph could not connect to the server
  OK     oauth.metadata
  OK     oauth.issuer
  OK     oauth.pkce
  OK     oauth.registration

Doctor also checks the OAuth setup the server announces (for an auth: {type: oauth} server that is not logged in yet too), so a problem that would stop a client from signing in shows up before anyone tries. It only sends unauthenticated requests, and only for a server that needs authentication. For a server that connected, these checks are listed as SKIP:

Check Severity Looks for
oauth.metadata error The authorization server's metadata can be found and has an authorization and a token endpoint.
oauth.issuer error (warning if only a trailing slash differs) The metadata's issuer is the authorization server the resource announced.
oauth.pkce error PKCE with S256 is advertised.
oauth.registration warning Dynamic client registration is offered.

These rules are in the core pack, and you can configure each of them (see Rules and packs and Configuring rules).

OAuth login

For a server that uses OAuth, set auth: {type: oauth} (optionally with scopes) and sign in once:

$ mcph auth login docs
Signing in to docs (http://localhost:8080/mcp)
Opening your browser. If it does not open, visit:
  https://auth.example.com/authorize?response_type=code&client_id=...
Logged in to docs; the token expires in 15 min.
mcph renews it with the refresh token that the server issued.

mcph doctor run then uses the stored token. An access token usually expires after a few minutes. When the server issued a refresh token, mcph uses it to get a new access token once the old one has expired (or is about to), so doctor keeps working without another sign-in for as long as the authorization server accepts the refresh token. If it does not (the refresh token expired or was revoked), or if the server issued none, doctor says so and asks you to log in again. mcph auth status shows who is logged in, when each token expires and whether a refresh token is stored (mcph auth login tells you right after signing in), and mcph auth logout docs deletes the tokens. For CI use a bearer token from an environment variable instead.

Some authorization servers only issue a refresh token to a client that asks for the offline_access scope; the sign-in asks for it when the server's metadata lists it. A login made with an older mcph kept no refresh token: log in once more to get one.

Tokens are kept in files only you can read, under mcph's state directory (set MCPH_STATE_DIR to put it elsewhere). A refresh token stays valid much longer than an access token, so that directory deserves the care you give your other credentials.

If login stops with Authorization server metadata issuer mismatch, the server announces its authorization server differently from the way that server describes itself. The standard wants the two to be identical, so the right fix is on the server. When the only difference is a trailing slash (https://auth.example.com/ against https://auth.example.com), you can have mcph accept it with ignore_issuer_trailing_slash: true under auth. It tolerates that one difference and nothing else.

Recording traffic

mcph proxy sits between an MCP client and a server and records everything the two say to each other. You name the server as a command, or as a server of mcph.yaml, or take every server of mcph.yaml at once (see The gateway). A client that starts its servers as processes starts the proxy instead of the server; a client that connects by URL is given the URL of a proxy that you start (see A URL).

A command

For a stdio server, put mcph proxy -- in front of its command in the client's configuration (the mcpServers format of .mcp.json, Cursor and Claude Desktop):

{
  "mcpServers": {
    "orders": {
      "command": "uvx",
      "args": ["mcph", "proxy", "--", "uv", "run", "python", "src/server.py"]
    }
  }
}

Use the client as usual. The proxy writes the trace while you do and tells you where it is on stderr, which clients show in their server logs:

mcph proxy: recording to /path/to/project/.mcph/traces/20261130T101503Z-3f9a1c.jsonl

The traffic is passed on byte for byte, in both directions: the proxy changes nothing that the client or the server says. The server's stderr is the proxy's stderr. Signals (Ctrl-C, terminate, hangup) are passed on to the server, and when the client closes its input the server's input is closed too. The proxy exits with the server's exit code: 128 + N if signal N ended it, 127 if the command was not found and 126 if it cannot be run.

A server of mcph.yaml

mcph proxy --server NAME proxies a server that mcph.yaml already describes, with everything the entry says about it. The global -c goes before the command:

{
  "mcpServers": {
    "docs": {
      "command": "uvx",
      "args": ["mcph", "-c", "/path/to/mcph.yaml", "proxy", "--server", "docs"]
    }
  }
}
  • A stdio server is run as above, byte for byte, with the command and args of the entry, in the directory of mcph.yaml, and with its environment: the minimal one plus env_file and env, as mcph doctor run starts it. A client that has none of your shell's variables still gets them from mcph.yaml and your .env.
  • An http server is reached over Streamable HTTP with the auth of the entry. With none, nothing is sent. With type: bearer, the token is token: ${NAME} from the environment of the proxy or, if that does not have it, from the env_file of the entry: a client that does not have your shell's variables needs nothing in its own env setting when the entry has an env_file with the variable, and if it is set nowhere the proxy stops with a message before anything starts. With type: oauth, run mcph auth login NAME first: the proxy sends the stored token and renews it with its refresh token whenever it has expired, also in the middle of a session. A login made or renewed in another terminal is used at once.
  • The relay is transparent. There is one session at the server for the whole session of the client, and the messages go through as they are, including the server's own requests to the client (sampling, roots, elicitation). The trace says reserialized: the messages are parsed and sent on again, so the HTTP details are the proxy's.
  • A server that is down, or refuses a request, is answered, never waited on. The client gets an error that says why and what to do, and the same text goes to stderr: mcph proxy: cannot reach http://localhost:8080: ConnectError: All connection attempts failed, mcph proxy: not logged in (run mcph auth login docs), mcph proxy: the server rejected the token in $DOCS_TOKEN (HTTP 401).
  • It ends when the client closes its input, after the server has answered what is still open (at most five seconds, so that echo request | mcph proxy --server docs gets its answer), and the session at the server is ended properly. A SIGINT, SIGTERM or SIGHUP ends it at once. The exit code is 0, or 128 + N for a signal, or the server's own for a stdio server.
  • Not supported: the older HTTP+SSE transport (a server with a separate /sse endpoint), which MCP has deprecated in favour of Streamable HTTP, and tool parameters that the newer protocol revision copies into HTTP headers. A client that connects by URL can use the listener.

A URL

A client that connects by URL, instead of starting a process, needs --transport http. It serves a server of mcph.yaml that is itself an http server (Streamable HTTP) on a local address, and you start the proxy yourself:

$ mcph proxy --server docs --transport http --port 8081
mcph proxy: recording to /path/to/project/.mcph/traces/20261130T101503Z-3f9a1c.jsonl
mcph proxy: proxying the server docs (http)
mcph proxy: listening on http://127.0.0.1:8081/mcp

Then give the client that URL, for example in VS Code's .vscode/mcp.json:

{ "servers": { "docs": { "type": "http", "url": "http://127.0.0.1:8081/mcp" } } }
  • It is the server, as far as the client can tell. A request goes to the URL of the entry as it is, and the answer (one JSON body, or an event stream) comes back as it is. mcph does not interpret the protocol, so both generations of Streamable HTTP (with or without the initialize handshake and a session id), streamed progress, the server's own requests to the client and resuming a stream with Last-Event-ID work as they do without the proxy.
  • mcph signs in for the client. The auth of the entry (the stored OAuth token, renewed as it expires, or token: ${NAME}) replaces any Authorization header of the client, which therefore needs no login of its own. An entry without auth leaves the client's own header alone. A server that is down, or refuses a request, is answered with its HTTP status and an error that says why and what to do, with the id of the request (mcph proxy: not logged in (run mcph auth login docs)). Cookies and Origin of the client are not sent on, and Set-Cookie and WWW-Authenticate of the server are not sent back, so that a client does not start a sign-in of its own at the real server.
  • --port 0 picks a free port, which is what a program that starts the proxy wants. The URL is printed once the proxy accepts connections, and written to --ready-file FILE if you give one, so that the program can wait for the file (it is written whole, an old one is removed at the start, and it is removed again at the end). --host (default 127.0.0.1), --port (default 8080) and --path (default /mcp) say where. A port that is taken stops the proxy at once, before a trace exists.
  • Only you can reach it, unless you say otherwise. The proxy uses your login of the server, so anyone who can reach it can use it. It listens on a loopback address, and refuses any other --host unless you give --allow-remote. On loopback a request whose Host or Origin is not a loopback name (a web page that has pointed its own name at 127.0.0.1) is refused with 421 or 403.
  • It ends on SIGINT, SIGTERM or SIGHUP, with exit code 0. It stops accepting connections, ends the event streams that clients keep open, lets requests in progress finish for up to five seconds (one that is still running then is answered with an error that says the proxy is shutting down), ends the sessions that the server opened, as their clients would have, and ends the trace. A second signal does not wait.
  • The trace is one for the whole run, whichever clients come and go, and says passthrough: the frames are the bytes that went through. The format has no field for which client a frame belongs to, so when several clients use the proxy at the same time their frames are interleaved, and latency_ms can pair wrongly if two of them use the same id at the same moment.
  • Not supported: a stdio server on a URL (use it through the standard input and output), TLS, and CORS for web pages that call the proxy.

The gateway

mcph proxy --gateway serves every server of mcph.yaml as one MCP server: a client has a single entry in its configuration for all of them, and the trace shows what went to each. The global -c goes before the command, and the gateway needs the gateway extra of mcph (see below), which uvx --from 'mcph[gateway]' brings:

{
  "mcpServers": {
    "mcph": {
      "command": "uvx",
      "args": ["--from", "mcph[gateway]", "mcph", "-c", "/path/to/mcph.yaml", "proxy", "--gateway"]
    }
  }
}

A client that connects by URL needs --transport http, with --host, --port, --path and --ready-file as for a URL (the gateway listens on a loopback address and is not reachable by anyone else, unless you give --allow-remote):

$ mcph proxy --gateway --transport http --port 8081
mcph proxy: recording to /path/to/project/.mcph/traces/20261130T101503Z-3f9a1c.jsonl
mcph proxy: starting the gateway for orders (stdio), billing (http)
mcph proxy: the gateway serves orders (2 tools), billing (2 tools)
mcph proxy: listening on http://127.0.0.1:8081/mcp
  • It needs the gateway extra, which installs FastMCP's server part (15 packages, about 7 MB, that nothing else in mcph uses): pip install 'mcph[gateway]', or uvx --from 'mcph[gateway]' mcph ... to run it without installing. Without it mcph proxy --gateway says so and stops before it starts anything (exit code 2, no trace); every other command works without it.
  • Names get the name of their server in front, so that two servers can both have a get_order: with the servers orders and billing the client sees orders_get_order and billing_get_order. The same goes for prompts (orders_greet); a resource gets it as the first part of its path (data://orders/items). A call goes to the server it belongs to, under the name that server knows. --no-namespace-tools leaves the names as the servers have them, to see what a client does when names collide: the first server of mcph.yaml wins, and mcph says which tools are hidden when it starts.
  • One session per server for the whole run. All the servers are started and connected when the gateway starts, in parallel, and kept: a stdio server is one process for as long as the gateway runs, not one for every request. If one cannot be reached the gateway stops at once, with an error that names it, instead of serving fewer tools than the client expects (exit code 1): Error: the server 'billing': cannot reach http://localhost:8080: ConnectError: All connection attempts failed. Every entry is checked first, the same way as for --server, and an entry that cannot be used (a variable that is not set) is named before anything starts.
  • The gateway is a server of its own towards the client, not a pass-through: the client sees one merged list, whichever generation of the protocol it speaks, and the gateway speaks to each server as a client of the older generation (with the initialize handshake). Progress that a server reports is passed on to clients of both generations. The questions it asks the client in the middle of a call (elicitation, sampling, roots) are passed on to clients of the older generation only (the one with the initialize handshake): for a client of the newer one the call ends with an error that says so.
  • The trace holds both conversations, in one file for the whole run, reserialized. The frames without a server are what the client and the gateway say to each other (the client's initialize, the merged list of tools with their prefixed names, its calls and the answers), recorded the way --server records its client. The frames with a server are the traffic between the gateway and that server, under the names that server knows. The two are interleaved in the order they happened, each with its own request ids and its own latency_ms, so a call of the client is followed by the calls that the gateway makes to the servers for it. The tokens that go to the servers are hidden, as for --server. With several clients at once on a URL their frames are interleaved, as for a URL.
  • It ends when the client closes its input (on stdio), or on SIGINT, SIGTERM or SIGHUP, also while the servers are still starting. The sessions at the servers are ended, so no server process is left, and the trace is ended. The exit code is 0, or 128 + N for a signal on stdio.
  • Limits: a server that exits while the gateway runs is not started again (its tools disappear from the list, and mcph says so on stderr: restart the gateway); there is no way yet to serve only some of the servers; the output of a stdio server on stderr is the gateway's stderr.

The trace

  • It goes to .mcph/traces/<session>.jsonl in the directory where the client starts the proxy, or next to the mcph.yaml selected with -c (for --server, always next to it). --trace-out FILE picks the file instead. An existing file is never overwritten.
  • Secrets such as tokens, passwords and Authorization values are hidden unless you pass --no-redact, and so is every token that mcph itself sends to an http server. A trace still holds the arguments and results of tool calls, which can be sensitive: treat it like a log. .mcph/ gets a .gitignore so that it is not committed by accident.
  • The trace format describes the events: every frame with its time, and for a response how long the server took. A trace of the gateway names its servers (upstreams) and says which server a frame was with (server), or, without one, that it was the client's.

Rules and packs

Rules come from packs. A pack is a directory with a mcph-pack.yaml that lists the Python files defining its rules. Name the packs doctor should use under extends in mcph.yaml:

extends:
  - builtin:core      # the rules that ship with mcph
  - ./packs/acme      # a pack of your own, relative to the directory of mcph.yaml

A source is a directory (relative to the directory of mcph.yaml, absolute, or starting with ~) or builtin:<name> for a pack bundled with mcph. Without any pack there is no rule: mcph doctor run then only reaches the servers and warns about it, and the warning fails a --strict run.

mcph pack list shows the packs that are loaded and the rules each one defines:

$ mcph pack list
Packs (from /path/to/mcph.yaml)

core 1.0.0 (builtin:core)
  The rules that ship with mcph.
  core.tool_name_snake_case
  oauth.metadata
  oauth.issuer
  oauth.pkce
  oauth.registration

acme 1.0.0 (./packs/acme)
  Our checks.
  acme.no_delete

The core pack

builtin:core has the oauth.* checks described above and this rule:

Rule Severity Checks
core.tool_name_snake_case warning Tool names are snake_case, like get_order rather than getOrder.

Warnings do not fail the run unless you pass --strict.

Writing a pack

packs/acme/
  mcph-pack.yaml
  rules/no_delete.py
# mcph-pack.yaml
name: acme
version: "1.0.0"
description: Our checks.        # optional
rules:
  - rules/no_delete.py          # the files that define rules
# rules/no_delete.py
from mcph.extensions import doctor_rule

@doctor_rule(id="acme.no_delete", description="No tool deletes data.", severity="error")
def no_delete(context):
    return [
        f"{tool.name} deletes data"
        for tool in context.snapshot.tools
        if tool.name.startswith("delete")
    ]

Rules can look at the arguments and the annotations of a tool too:

@doctor_rule(id="acme.say_read_only", description="Every tool says whether it is read-only.")
def say_read_only(context):
    for tool in context.snapshot.tools:
        if tool.annotations.read_only_hint is None:
            yield f"{tool.name} does not say whether it is read-only"


@doctor_rule(id="acme.describe_parameters", description="Every parameter has a description.")
def describe_parameters(context):
    for tool in context.snapshot.tools:
        for name, schema in tool.input_schema.get("properties", {}).items():
            if not schema.get("description"):
                yield f"{tool.name}: parameter {name!r} has no description"
  • A rule id looks like namespace.name (lowercase letters, digits and _, and - in the namespace) and is unique across all packs. Two packs with the same name are an error too.
  • The function gets a context: server (the entry of mcph.yaml), snapshot (what the server exposes: server_name, server_version, protocol_version, startup_seconds and tools; None if mcph could not connect), error (why it could not), timeout, and a cache shared by the rules that check one server.
  • Each tool in snapshot.tools is described as the server sent it: name, title and description (each may be None), input_schema (the JSON Schema of the arguments, a dict), output_schema (a dict, or None) and annotations with title, read_only_hint, destructive_hint, idempotent_hint and open_world_hint, each None when the server did not say. Do not change what you receive: every rule of a server sees the same objects. (ServerSnapshot and ToolInfo are in mcph.mcp_client, if you want to build them in tests of your rules.)
  • It returns a message for each problem, at the rule's severity, or Issue(message, severity) objects (from mcph.rules) to choose the severity per problem. It may be async, and it may raise SkipRule("why") (from mcph.rules) when there is nothing to check.
  • @doctor_rule also takes transports=["http"] for a rule that only applies to HTTP servers (the default is both kinds), and needs_connection=False for a rule that is still useful when the server could not be reached (without it, such a rule is skipped, because there is no snapshot).
  • A rule that raises is reported as an error finding, and the other rules still run.
  • A pack file is imported on its own, so it can import mcph and installed packages but not the other files of the pack.
  • The Python of a pack runs with your privileges, like the command of a stdio server in the same file, so list only packs you trust.

While you write a pack, mcph pack verify packs/acme checks it without a config or a server: the manifest, that every listed file exists, imports and defines rules, and that rule ids are not used twice. It lists every problem (and exits with 1), or the rules it found:

$ mcph pack verify packs/acme
acme 1.0.0: valid, 1 rule
  acme.no_delete  error  No tool deletes data.

$ mcph pack verify packs/other
packs/other: 2 problems
  pack 'other': rules/missing.py, listed under rules in mcph-pack.yaml, does not exist
  pack 'other': cannot import broken.py: SyntaxError: invalid syntax (broken.py, line 1)

Configuring rules

Under doctor.rules in mcph.yaml, set how serious a rule is, or turn it off. This applies to the rules of every loaded pack, by rule id:

doctor:
  rules:
    core.tool_name_snake_case: error   # a camelCase tool name now fails the run
    oauth.registration: off            # do not check for dynamic client registration
  • error: findings of the rule are errors, so the run fails (exit code 1).
  • warn: findings are warnings, which fail the run only with --strict.
  • off: the rule does not run, and the report lists it as OFF. Write it without quotes if you like: YAML reads off as false, and mcph accepts that.

Rules you do not list keep their default severity. A configured severity replaces the default for all findings of that rule, so oauth.issuer: error also makes a trailing-slash difference an error. With all four oauth.* checks off, doctor does not contact an authorization server at all.

A rule id that no loaded pack defines is a config error (exit code 2) that lists the known ids and suggests the closest one. (Without extends no rule is known, and the message says how to add the core pack.)

mcph doctor rules lists the rules of the loaded packs, under the pack each comes from, with the setting that applies and the default next to one you changed. It starts no server:

$ mcph doctor rules
Rules (settings from /path/to/mcph.yaml)

core (builtin:core)
  core.tool_name_snake_case  error (default: warn)  Tool names are snake_case.
  oauth.metadata             error                  The authorization server's metadata can be found and has an authorization and a token endpoint.
  oauth.issuer               error                  The metadata's issuer is the authorization server the resource announced (a difference of only a trailing slash is a warning).
  oauth.pkce                 error                  PKCE with S256 is advertised.
  oauth.registration         off (default: warn)    Dynamic client registration is offered.

acme (./packs/acme)
  acme.no_delete             error                  No tool deletes data.

Without a mcph.yaml in the current directory, or without extends, no pack is loaded and the listing says so. A -c path that does not exist, a pack that cannot be loaded, or an invalid config is an error (exit code 2).

mcph.yaml

  • version: optional, "1".
  • servers: a list of servers, each with:
    • name: unique; letters, digits, _ and -.
    • transport: stdio or http.
    • command, args (stdio): how to start the server.
    • env (stdio, optional): the server's environment variables, in which ${NAME} takes a variable.
    • env_file (optional): dotenv files that hold variables, for a stdio server to get and for an http server (with a bearer token) to take the variables of its ${...} from (see Environment variables of a server).
    • url (http): the Streamable HTTP endpoint of a server you have already started, such as http://localhost:8080/mcp. mcph does not start it.
    • auth (http, optional), one of:
      • type: bearer and token, a reference such as ${DOCS_TOKEN} to the environment variable that holds the bearer token (the same references as in env values, so it can also sit in other text). mcph takes the token from its own environment or, if that does not have the variable, from the env_file of the server, never from the YAML: a token written there is refused. It is sent as Authorization: Bearer ... to the server's URL only, and never printed. In YAML's {...} style put it in quotes: auth: {type: bearer, token: "${DOCS_TOKEN}"}. Earlier versions wrote this as token_env: DOCS_TOKEN, which is now an error that says what to write instead.
      • type: oauth, optional scopes and optional ignore_issuer_trailing_slash: sign in through the browser with mcph auth login <server> (see OAuth login).
    • primary: optional true for the server you are developing (at most one).
  • extends: optional list of the packs whose rules doctor uses: a directory or builtin:<name> (see Rules and packs). Without any pack there is no rule; builtin:core has the rules that ship with mcph.
  • doctor: optional settings for mcph doctor.
    • rules: how serious each rule is, as rule id: error | warn | off (see Configuring rules).

stdio servers run from the directory containing mcph.yaml, with a minimal environment (HOME, PATH, ...) plus what env_file and env give them; the rest of your environment is not passed on. Unknown keys are rejected, so typos are reported.

Environment variables of a server

A stdio server starts with a minimal environment (HOME, PATH, ...), so your shell's variables, API keys included, do not reach it by themselves. The bearer token of an http server is a variable too. There are two ways to give a server what it needs, and you can use both.

From the environment mcph runs in, with ${NAME} in an env value (or in a token):

servers:
  - name: orders
    transport: stdio
    command: uv
    args: ["run", "python", "src/server.py"]
    env:
      LOG_LEVEL: WARNING       # a plain value
      API_KEY: ${API_KEY}      # the variable API_KEY of the environment mcph runs in
      DATA_DIR: ${HOME}/data   # a variable can sit in other text
$ API_KEY=abc123 mcph doctor run

From a dotenv file, with env_file, so the secrets never touch mcph.yaml. Every server has files of its own, and an http server with a bearer token can have one too:

  - name: orders
    # ...
    env_file: .env             # or a list of files: [base.env, local.env]
  - name: docs
    transport: http
    url: https://docs.example.com/mcp
    env_file: docs.env         # the variables that ${...} in the token may use
    auth: {type: bearer, token: "${DOCS_TOKEN}"}
# .env (keep it out of Git)
API_KEY=abc123
LOG_LEVEL=DEBUG
  • ${NAME} is replaced by the variable NAME of the environment mcph runs in and, if that does not have it, by the variable NAME of the env_file files of the entry. It can sit in other text (Bearer ${TOKEN}), $$ is a literal $, and a variable that is set nowhere is an error that names it and the files that were looked in. Values are never printed. In YAML's {...} style, put the value in quotes: env: {API_KEY: "${API_KEY}"}.
  • env_file is a path, or a list of paths, relative to the directory of mcph.yaml (~ and absolute paths work). It uses dotenv syntax (KEY=value, # comments, quotes, export KEY=value) and nothing in it is expanded. It usually holds secrets, so keep it out of Git with .gitignore. It is read when the server starts (for an http server, when mcph reads its token); a file that is missing is an error for that server.
  • The precedence is the one of Docker Compose. For ${...} the environment wins over the files: a key or a token that you export beats the one in .env, which is only used when the environment does not have the variable, so a stale .env cannot hide a new value. For a stdio server the env entries win over the variables of the files (as environment: wins over env_file: in Compose), and a later file wins over an earlier one. A variable of a file that env does not name is passed on as it is.
  • An http server has no process to give variables to: its env_file only holds what the ${...} of its bearer token may use, so it is an error without auth: {type: bearer}.
  • This is for the servers in mcph.yaml. mcph proxy -- <command> passes its own environment on to the server unchanged: give that server its variables in the client's own env setting.

Metadata

Release files for mcph 0.3.0

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

Source distribution (sdist)

Source distribution for mcph 0.3.0
File Size Uploaded Provenance Actions
mcph-0.3.0.tar.gz 114.6 kB With provenance Details for mcph-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcph 0.3.0
File Interpreter ABI Platform Actions
mcph-0.3.0-py3-none-any.whl Python 3 none any Details for mcph-0.3.0-py3-none-any.whl

Total release size: 239.3 kB

Release files / mcph-0.3.0.tar.gz

Download URL mcph-0.3.0.tar.gz
Size 114.6 kB
Tags Source
SHA-256 checksum
How to use checksums
3341573c09dccf31aa79be3ef3ea806db10a994c182428f1032385e872fde05a
BLAKE2b-256 checksum
How to use checksums
d55d23d7996ae95f6aaaecb4e1647fd361ce8412ea98805f4564fd31fcb59089
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / mcph-0.3.0-py3-none-any.whl

Download URL mcph-0.3.0-py3-none-any.whl
Size 124.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a489fd193dacc71dd7f0a0cc6357161ef50701abb9bd00f839894abe21a5dfea
BLAKE2b-256 checksum
How to use checksums
25acdaf90d7705454140668b13ddfa7e01b088159ee75f0809faa82a2428a179
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for mcph 0.3.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mcph-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

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.

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