MCP reference — physical context and controlled expression
New to MCP with PHOS? Start with MCP — Eyes, voice and senses for AI agents for the capabilities guide.
PHOS starts its trusted-local MCP Streamable HTTP endpoint as part of normal
runtime startup. Install the mcp optional dependency, configure mcp in the
canonical PHOS configuration, then start PHOS normally:
systemctl --user restart phos.service
PHOS requires Python 3.11 or later for MCP and pins the supported SDK family as
mcp>=2.0,<3. The PHOS listener continues to own Uvicorn binding and shutdown;
the SDK supplies only the Streamable HTTP ASGI app. This keeps listener
lifecycle, Web Admin enable/disable, and port rebinding in McpServerManager.
Under SDK 2.x the ASGI app owns the protocol's per-client session handling and
its lifespan cleanup; PHOS does not retain SDK session objects. Uvicorn closes
that app as part of the existing listener shutdown path.
Protocol and SDK references
The supported dependency range allows SDK 2.x rather than locking an exact
version. This subscription contract uses MCP revision 2026-07-28, as
implemented by SDK 2.3.0 and checked by PHOS's transport regression. PHOS uses
MCPServer, InMemorySubscriptionBus, and ResourceUpdated from the official SDK.
Use the 2026-07-28 specification,
its resources
and subscriptions
contracts, and the official
Python SDK v2 subscription guide.
PHOS publishes its change cues through subscriptions/listen; do not substitute
the older resources/subscribe mechanism. For client feature requirements and
an end-to-end interaction diagram, see the
MCP integration guide.
The committed default endpoint is http://127.0.0.1:8001/mcp. MCP is enabled
by default, binds only to loopback, and uses one listener in the same process,
runtime loop, PhosApplicationService, and AgentApplicationService as PHOS.
Each HTTP client has its own MCP session but never creates a runtime or service
graph. Stopping PHOS gracefully stops the listener and its sessions. If an
enabled endpoint cannot bind, PHOS performs normal shutdown and exits with an
error so the service manager applies its configured failure policy.
When Web Administration is enabled, Settings → Network → MCP can enable or disable
only this listener and change its port without restarting PHOS. The page and
/api/v1/settings/mcp report the actual listener state and endpoint. A failed
rebind restores the prior listener and does not persist the requested port;
existing client sessions disconnect when a listener is intentionally stopped or
rebound. The loopback host and /mcp path remain deliberately non-editable.
mcp:
enabled: true
host: 127.0.0.1
port: 8001
path: /mcp
Older configuration files without this section retain these defaults. A non-loopback host is allowed only by explicit configuration and emits a warning. Bearer authentication is available when configured, but deployment/TLS policy remains the operator's responsibility; do not expose this endpoint publicly.
Agent identity and local compatibility
Every inbound MCP request passes through one authentication middleware boundary
before any tool or Resource reaches AgentApplicationService. The middleware
resolves an immutable AgentIdentity (id, optional display name, and an
existing permission-profile reference); the application facade then applies the
existing profile permissions before capability and runtime checks. Identity,
permission, capability, and current activity remain separate concerns.
Bearer mode never resolves the configured default agent without a credential.
The committed configuration is loopback-only, but a local bridge or reverse
proxy can make a loopback listener reachable by another client; bind address is
not an authentication boundary. Configure an agent credential reference and
issue its credential before using Bearer Token Only. To deliberately permit
unauthenticated access, select none or mixed, choose the least-privileged
anonymous profile, and confirm the change in Web Admin.
The canonical agents configuration persists identities and the default agent.
Older configurations without agents retain local-agent/standard. Invalid
records, duplicate IDs, unknown profiles, or an unknown default fail loading;
no fallback grants broader access. Web Admin updates replace the complete
validated registry, so agent create/edit/delete changes apply to subsequent
MCP requests without restart.
Bearer authentication
An agent entry may contain only a non-secret bearer secret_ref. The actual
token is read by trusted runtime code from SecretsService, never from runtime
configuration or AgentIdentity. In bearer mode, every MCP request must
provide Authorization: Bearer TOKEN; missing, invalid, revoked, or
unconfigured credentials fail before application execution and never fall back
to default_agent. Comparison uses a constant-time secret comparison. Tokens
are not logged or returned in MCP errors. Expiry and external identity providers
remain deferred.
Configurable authentication modes
The canonical mcp.authentication configuration defaults to bearer, which
preserves bearer-only operation. none resolves every request as the internal,
non-persistent anonymous-mcp principal using the configured anonymous profile;
a well-formed Bearer header is ignored for identity selection, while malformed
or unsupported Authorization headers are rejected. mixed resolves a missing
Authorization header as that anonymous principal and a valid Bearer header as
its configured agent. An explicitly invalid or revoked Bearer is always
rejected—PHOS never falls back to anonymous access after an invalid credential.
Anonymous access is enabled only when none or mixed is selected. It uses
the existing standard or observer permission profile and does not create an
agent record or credential. In mixed mode, revoking a bearer prevents use of
that authenticated identity, but does not prevent a client from reconnecting
without a token when anonymous access is enabled.
| Mode | Without token | With valid Bearer token |
|---|---|---|
| Bearer | Rejected, including when no credential is configured | Registered authenticated agent |
| None | anonymous-mcp |
anonymous-mcp |
| Mixed | anonymous-mcp |
Registered authenticated agent |
Bearer Token Only is the default. It resolves the registered agent identity and
its configured permission profile; credentials can be rotated or revoked. No
Authentication uses the shared anonymous-mcp principal, so callers are not
individually identifiable through MCP authentication. Mixed permits both: a
missing token selects the anonymous principal, while a valid token selects its
registered agent. Explicitly invalid or revoked Bearer tokens are rejected and
never fall back to anonymous access.
Anonymous permissions
Both anonymous profiles use the same PHOS authorization boundary as registered
agents. observer is read-only. standard can use the semantic reads and
currently exposed actions permitted to a standard agent, including supported
expression, speech, sleep/wake, and user-signal requests, subject to runtime,
capability, privacy, and safety checks. It may also access Resources available
to the standard profile. Anonymous access never bypasses semantic arbitration
or PHOS safety protections.
MCP Authentication & Security
Configure authentication in Settings → Network → MCP. Select Bearer Token Only, No Authentication, or Mixed Authentication. Bearer Token Only requires an issued credential for a configured agent; with none, all requests fail closed. For No Authentication and Mixed, choose the anonymous Standard or Observer profile. Web Administration shows a security warning and requires explicit confirmation before enabling unauthenticated access.
The validated authentication policy is applied to new MCP HTTP requests without rebinding the listener or restarting PHOS. Clients affected by a mode change should reconnect. Requests already being processed retain the policy snapshot with which they started; PHOS does not claim targeted termination of SDK-owned transport sessions or subscriptions.
Security considerations for unauthenticated MCP access
An endpoint without token enforcement can be used by any client that can reach it. With the Standard profile, an unintended caller may make PHOS speak, change expressions, request sleep or wake, trigger semantic signals, and read allowed environmental or presence-related context. This matters because PHOS is a physical robot.
HTTPS encrypts traffic; it does not authenticate callers. A public HTTPS tunnel can make a local MCP endpoint reachable from the Internet, and a URL is not an adequate access control. A tunnel or reverse proxy with its own enforced access restrictions is different from a publicly reachable tunnel, but PHOS still applies its configured MCP authentication and authorization.
Anonymous callers share one internal identity. PHOS cannot reliably distinguish anonymous applications, individual bearer revocation does not block anonymous access, and audit attribution is limited. Existing safety arbitration is not a substitute for authentication.
Recommended safeguards:
- Keep Bearer Token Only as the default.
- Enable anonymous access only when it is required.
- Restrict access at the tunnel, reverse proxy, or network boundary.
- Use Observer when actions are unnecessary; use Standard only when needed.
- Monitor unexpected MCP access and disable anonymous access when finished.
- Do not expose Web Administration or unrelated PHOS services through an MCP tunnel.
Connecting Remote MCP Clients
PHOS exposes Streamable HTTP at its configured endpoint. The supplied configuration binds to loopback, so a client on another computer cannot reach it directly. A separately managed route can change reachability, but PHOS does not provide a remote relay or establish the safety of a tunnel or reverse proxy. Do not expose the endpoint publicly without a separately reviewed network and authentication design. The examples below are architectural illustrations, not a deployment recommendation or verified connection.
External MCP Client → HTTPS tunnel / reverse proxy → PHOS MCP Server
→ authentication + permissions
→ AgentApplicationService
→ PHOS semantic services
For a remote client, verify transport reachability, MCP initialization, tool discovery, Resource access, tool execution, and subscriptions separately. A successful connection alone does not prove every capability is available.
Third-party client compatibility
The PHOS repository verifies its own Streamable HTTP server with MCP SDK integration tests. It does not certify ChatGPT or any other named external product. Each product must independently support the required Streamable HTTP transport and the selected authentication method; tool, Resource, image and subscription support may differ. No named client should be treated as compatible solely because it implements some MCP features. Use its official client documentation and verify the actual connection and capabilities in a controlled environment before relying on it.
No client-specific UI steps are provided here because product versions and supported authentication settings have not been independently validated by PHOS. In Bearer mode, use a client's secure credential mechanism; never put the bearer in a URL or command line.
Troubleshooting remote access
- Confirm the URL ends in
/mcp, the tunnel forwards to the correct PHOS host and port, and the MCP listener is running. - A Bearer-only endpoint rejects missing credentials. In Mixed mode, an invalid or revoked supplied Bearer is rejected; omit it only when anonymous access is intentionally enabled.
- Check tunnel, reverse-proxy, and client protocol-header errors separately from
PHOS MCP errors. A tunnel
502, timeout, or connection failure usually does not identify an MCP application problem. - Reconnect clients after authentication configuration changes.
Credential lifecycle
AgentCredentialService is the application/service boundary for credential
management surfaces:
create / rotate / revoke
→ AgentCredentialService
→ SecretsService
→ stable credential.secret_ref
→ BearerAgentAuthenticator
The service generates a URL/header-safe 256-bit bearer with the operating
system CSPRNG. It returns a bearer only from creation or rotation, never via
status or a read-back operation. Rotation replaces the value at the same
secret_ref, immediately invalidating the old bearer; revocation removes the
stored secret and leaves its configured AgentIdentity and permission profile
intact. Authentication looks up the secret for each request, so no PHOS restart
is needed. Expiry policies and external identity providers remain future work.
Authenticated Web Admin exposes agent create/edit/delete and this lifecycle at Settings → Agents. IDs are immutable; profile edits affect subsequent requests using the same bearer. It generates a valid non-secret reference only when a credential is created. The default agent cannot be deleted; deleting another agent confirms revocation first. Newly created or rotated bearers appear once in the immediate response and cannot be retrieved after navigation or reload. Rotation, revocation, and deletion require confirmation.
Agent creation, deletion, and permission-profile edits do not require a PHOS restart: new MCP authentication resolves the current registry. Already-open MCP sessions are not forcibly terminated and may retain their current request or session context; clients should establish a new request/session after a change. Selecting a different default agent also persists and publishes immediately; it changes only trusted-local/default compatibility resolution, never an explicitly authenticated agent identity. The selected default is protected from deletion until another configured agent becomes default.
Permission profiles
standard agents can use the complete currently exposed semantic tool set and
the protected camera snapshot Resource/tool. observer agents retain read-only
semantic context but cannot request control actions such as sleep, wake,
speech, expression changes, or user signals; they also cannot read the camera
snapshot. Permissions are enforced by PHOS on every authenticated request.
Connecting a client
Use Streamable HTTP directly when the client supports it. For a local stdio
connection, the separately maintained
phos-mcp-bridge
(Node.js 20+) is documented as an adapter for compatible clients. Its
source and named-client compatibility are outside this repository.
For a generic compatible client,
connect to the configured endpoint (default http://127.0.0.1:8001/mcp) and
send an already-issued bearer through an HTTP Authorization header when
credential mode is enabled. See Bridge authentication
for the verified boundary and keep bearer values out of command lines.
For a network-accessible PHOS host, the bridge must be able to reach the configured endpoint. The committed listener binds only to loopback; any separate network route must terminate TLS and enforce network access controls. PHOS still requires its own bearer credential in bearer mode: do not trust forwarded headers, a local source address, or reverse-proxy placement as proof that a caller is local. This guide does not certify a remote-access service or client product.
Physical tool calls and retries
The bridge never automatically retries tools/call, including when an
upstream transport fails. PHOS may have completed the physical action before
the connection dropped. Future requests can establish a fresh session, but
reconnection must not replay the uncertain action. Inspect current PHOS state
before choosing whether to issue a new call.
Bridge authentication
MCP Stage 3.6 completes authentication support in phos-mcp-bridge. It is a transport-only stdio bridge; it does not validate a credential or contain identity, permission, camera-permission, or resource-permission logic:
flowchart TD
client[Compatible stdio client] <-->|MCP stdio| bridge[phos-mcp-bridge]
token[PHOS_MCP_TOKEN environment] --> bridge
bridge <-->|Streamable HTTP / Authorization bearer| phos[PHOS MCP server]
phos --> auth[BearerAgentAuthenticator] --> identity[AgentIdentity]
identity --> profile[PermissionProfile] --> service[AgentApplicationService]
classDef phos fill:#0F4C5C,stroke:#49E7FF,color:#fff
classDef protocol fill:#312E81,stroke:#818CF8,color:#fff
classDef externalService fill:#78350F,stroke:#FBBF24,color:#fff
class client protocol
class bridge externalService
class phos,auth,identity,profile,service phos
style bridge stroke-dasharray: 5 4
The bridge reads its already-issued bearer from PHOS_MCP_TOKEN and injects it
only through its upstream Streamable HTTP transport. The bearer applies to
initialization, tools, Resources, subscriptions, and reconnects. An absent or
empty PHOS_MCP_TOKEN sends no Authorization header. A visible --token or
visible --header Authorization argument is rejected: do not put a bearer in
CLI arguments. Bearer values and Authorization headers are redacted from bridge
logging and error paths.
PHOS remains authoritative for authentication, AgentIdentity resolution,
PermissionProfile, authorization, camera permissions, and Resource
permissions. Invalid or missing credentials fail at PHOS; the bridge does not
retry as an unauthenticated or default identity. PHOS errors, including
permission_denied, are preserved.
Obtain the bearer through the PHOS credential lifecycle/Web Admin, then launch the bridge without placing it on the command line:
export PHOS_MCP_TOKEN='...'
node /path/to/phos-mcp-bridge/dist/index.js \
--url http://<phos-host>:8001/mcp
For Inspector TUI, the current working syntax is:
Replace /path/to/phos-mcp-bridge with the checkout containing the built
external bridge. The address 192.0.2.10 below is reserved for documentation;
replace it with the PHOS host address reachable from the client.
PHOS_MCP_TOKEN='...' \
npx --yes @modelcontextprotocol/inspector@latest --tui \
--protocol-era modern \
node /path/to/phos-mcp-bridge/dist/index.js \
-- \
--url http://192.0.2.10:8001/mcp
The bridge does not manage the credential. If PHOS rotates or revokes it, the
old bearer no longer authenticates. Update PHOS_MCP_TOKEN and restart or
relaunch the bridge if required by its current implementation to establish a
new authenticated upstream MCP connection. Hot credential reload is not
claimed.
MCP exposes the existing AgentApplicationService, never hardware, renderers,
camera/provider objects, controllers, or raw runtime state. Available tools are
phos_get_status, phos_get_physical_context, phos_get_presence,
phos_get_attention, phos_get_observed_expression, phos_get_camera_snapshot,
phos_capture_camera_snapshot, phos_get_visible_objects,
phos_set_expression(expression), phos_speak(text), phos_sleep,
phos_wake, phos_signal_user(signal),
phos_query_measurements(metric, start?, end?, limit?), and
phos_list_physical_transitions(event_type?, limit?),
phos_get_physical_assessment(), and
phos_set_state(state, duration_ms?). Input bounds, permission
checks, semantic result documents, and sanitized error mapping are
transport-independent.
Registered tool inventory
Tool discovery is a static catalog. It does not mean the caller's profile is
authorized for every tool, that optional hardware is available, or that a call
will succeed. PHOS checks each operation through AgentApplicationService.
See permission profiles for the permission boundary.
| Tool | Input | Permission | Result / dependency |
|---|---|---|---|
phos_get_status |
None | read_status |
Compact semantic runtime status; optional subsystem availability is reported. |
phos_get_physical_context |
None | read_physical_context |
Current qualified physical context; depends on configured sources. |
phos_get_physical_assessment |
None | read_physical_history |
Bounded evidence-quality assessment, not trend classification. |
phos_query_measurements |
metric required; optional UTC start, end; limit 1–360, default 360 |
read_physical_history |
Bounded in-memory native history; window ≤ six hours; external MQTT/ESPHome readings are not retained here. |
phos_list_physical_transitions |
Optional event_type; limit 1–360, default 100 |
read_physical_history |
Bounded in-memory semantic transition history. |
phos_get_presence |
None | read_perception |
Anonymous presence state/count/confidence; camera-dependent when configured. |
phos_get_attention |
None | read_perception |
Semantic attention state and non-identifying target fields. |
phos_get_observed_expression |
None | read_perception |
Uncertain selected-face observation or unavailable status. |
phos_get_visible_objects |
None | read_perception |
Bounded on-demand labels from configured Vision/NanoDet; no image or boxes. |
phos_get_camera_snapshot |
None | read_camera_snapshot |
Cached JPEG image plus capture metadata; active Vision frame required; one request/second/identity. |
phos_capture_camera_snapshot |
None | read_camera_snapshot |
Waits up to three seconds for a later pipeline frame; four pending waits maximum; same rate limit. |
phos_set_expression |
expression: supported writable expression |
control_expression |
Semantic expression request; local behavior/rendering may supersede its visible effect. |
phos_set_state |
state: thinking or idle; optional integer duration_ms |
control_visual_state |
Agent-owned temporary visual lease; thinking requires 250–60000 ms; idle releases the caller's lease. Unknown fields are rejected. |
phos_speak |
text: non-empty string, maximum 500 characters |
control_voice |
Accepted/scheduled semantic speech request; not proof of synthesis or audible playback. |
phos_sleep / phos_wake |
None | control_sleep |
Request normal semantic transition to sleeping/idle. |
phos_signal_user |
signal: success, warning, error, or attention |
signal_user |
Requests transient semantic signal; requires a running, available signal path. |
All structured tools return the application service's documented JSON result;
camera tools return MCP image content and a text metadata block. MCP input
validation and application errors become tool errors with sanitized category
text, not HTTP status codes. The mcp/server.py tool definitions and
AgentApplicationService are authoritative for exact schemas and behavior.
phos_set_state owns only a temporary, identity-scoped visual lease. It accepts
thinking with a required integer duration_ms from 250 through 60000, or
idle to release the caller's lease. duration_ms is optional for idle and
is ignored when supplied. It requires control_visual_state; a
lease expires automatically and never changes RobotCore.state. Core error,
sleeping, speaking, and listening visuals retain priority. Its response uses
the application result fields accepted, requested_state, effective_state,
lease_active, remaining_expiry_ms, and suppressed_by; it exposes no other
agent identity or lease data. This is distinct from the persistent REST state
command. As an accepted MCP request, it participates in existing follow_agent
arbitration: authenticated Agents may activate their assigned skin, while an
anonymous request can use only the configured low-priority default-agent
fallback.
MCP Resources
PHOS exposes read-only MCP Resources through the same permission-checked application-service boundary as its tools:
Object awareness
phos_get_visible_objects takes no arguments and requires read_perception (not
read_camera_snapshot). It performs one on-demand NanoDet observation from the
already-running VisionPipeline's latest in-memory frame. It returns no image,
box, identity, or tracking data:
{"captured_at":"2026-01-02T03:04:05Z","age_ms":25,"freshness":"fresh","objects":[{"label":"car","confidence":0.9}],"truncated":false}
Object awareness is disabled by default. Enabling it requires a locally installed
NanoDet-m-plus-1.5x_416 FP32 ONNX model path; verify SHA-256
4b82da9944b88577175ee23a459dce2e26e6e4be573def65b1055dc2d9720186.
The OpenCV Zoo asset is Apache-2.0. Requests may report unavailable for no/stale
frame or disabled Vision, busy for an active inference, and timeout when the
bounded on-demand request expires. No frames or detections are persisted.
| Resource URI | MIME type and data | Read permission | Subscription / availability |
|---|---|---|---|
phos://status |
application/json; compact semantic status such as runtime state and subsystem availability |
read_status |
Change cues on mapped status transitions; status remains readable when optional features are unavailable. |
phos://physical-context |
application/json; current qualified environment, air quality, motion, presence, attention, expression and authorized external observations when available |
read_physical_context |
Change cues on mapped semantic transitions; missing sources are unavailable/null, not zero. |
phos://physical-context/assessment |
application/json; bounded evidence and availability/age fields for retained metrics |
read_physical_history |
Change cues on mapped environmental/air-quality evidence transitions; historical evidence is bounded and in memory. |
phos://environment |
application/json; environmental section of the physical context |
read_physical_context |
Change cues on environment/availability transitions; numeric samples alone do not trigger cues. |
phos://vision/snapshot |
image/jpeg; current pipeline frame |
read_camera_snapshot |
No change cue; camera/Vision must be available. |
Resource discovery is also static and does not apply per-resource permission filtering. Each content read does apply its mapped permission. See the subscription security note below for the separate URI-change metadata behavior.
phos://status— compact agent-facing semantic status.phos://physical-context— provider-independent semantic physical context.phos://physical-context/assessment— bounded retained-measurement evidence for supported environmental and air-quality metrics.phos://environment— the environmental section of that physical context.phos://vision/snapshot— one currentimage/jpegcamera snapshot.
phos_get_camera_snapshot returns a JPEG encoded from the same latest cached
Vision frame as an MCP image content block, plus a small text block with
captured_at (UTC), age_ms (monotonic-clock elapsed time), and freshness
(fresh through 2 seconds, otherwise stale). captured_at is recorded when
PHOS receives the frame from its camera provider; it is not the request or JPEG
encoding time, and it is not a hardware exposure timestamp. Stale frames remain
available but are never labelled current. The tool never initiates a capture,
infers scene content, or changes presence/attention state. Tool calls are
bounded to one snapshot per second per authenticated identity; the existing
Resource remains available for its current read-only JPEG contract.
phos_capture_camera_snapshot has the same image, permission, JPEG-bound, and
metadata format, but its metadata starts source=on_demand. PHOS records the
current Vision frame sequence when the request is accepted and waits for a later
frame from the already-running pipeline, for up to three seconds. It is not a
separate sensor capture. The cached and on-demand tools share the same
per-identity transfer limit, so alternating calls cannot bypass it; at most four
on-demand waits may be pending. A timeout, stopped/restarted pipeline, or camera
failure returns a sanitized error and never falls back to the preceding frame.
Both camera paths reject JPEGs larger than 512 KiB.
Resources are live snapshots: each read calls the same permission-checked
application-service boundary as the corresponding semantic tool. They do not
poll providers, mutate PHOS, replay history, or expose controller/camera/
renderer internals. The camera snapshot is synchronous, read-only and encodes
the existing Vision pipeline's latest cached frame; it never opens another
camera, starts a capture, or streams video. It is protected by the dedicated
read_camera_snapshot permission;
the standard profile has it while the observer profile deliberately does not.
This is separate from generic physical-context access because a snapshot may
contain people physically visible to the camera. It contains no camera device,
provider/backend, filesystem, identity, candidate-ID, debug, or EXIF/location
metadata.
Physical assessment evidence
phos://physical-context/assessment requires read_physical_history. It is a
read-only assessment of the existing six-hour RAM-only measurement history and
the current sensor snapshot; it neither polls a provider nor changes retained
history. Each supported metric includes its retained sample count, first/last
PHOS receipt timestamps, actual coverage, largest observed retained-sample gap,
source provenance, and current source availability/age.
The assessment outcome is one of valid, stale, unavailable,
insufficient_data, or unknown, with a stable machine-readable reason.
insufficient_data is an expected evidence result, not a transport error: it
means PHOS cannot safely establish enough retained coverage or continuity.
Historical valid samples do not prove that a source is currently fresh.
PCI-01a intentionally provides no rising/falling/stable classification. The retained timestamp is PHOS receipt/recording time, not an asserted hardware acquisition time; metric-specific noise/deadband policy is required before numerical trend classification can be added. eCO2 remains an estimated air-quality measure, not direct CO2 concentration.
The metric-level evidence section always describes the full requested
historical window. Its observed_discontinuity result is never silently
removed after a sensor recovers. When a recorded unavailable-to-available
transition has a reliably ordered timestamp, the additive
recent_continuous_segment section separately describes only retained samples
strictly after that recovery boundary. It may become valid after at least
three samples, two minutes of coverage, no excessive retained gap, and no
later recorded availability break, while the full historical outcome remains
insufficient_data / availability_discontinuity.
Successful reconnect does not prove uninterrupted hardware acquisition. Equal
or unordered PHOS receipt timestamps, missing recovery transitions, source
changes, stale current data, or insufficient post-recovery samples keep the
recent segment unknown or insufficient_data. The recovery boundary is a
PHOS semantic-event receipt time, not an ESP32 acquisition timestamp or a
hardware generation identifier.
Discovery and snapshot read
The phos-mcp-bridge dynamically forwards MCP Resources, so no bridge-specific
snapshot implementation is required. Set PHOS_MCP_TOKEN as described in
Bridge authentication when PHOS uses bearer
credentials. Replace /path/to/phos-mcp-bridge with the built external bridge
checkout and 192.0.2.10 with the PHOS address reachable from this client.
For a trusted-LAN PHOS endpoint:
npx --yes @modelcontextprotocol/inspector@latest --cli \
node /path/to/phos-mcp-bridge/dist/index.js \
--url http://192.0.2.10:8001/mcp \
--method resources/list
The result includes the four URIs in the table above. Read the current snapshot with the Inspector CLI syntax supported by the installed version, for example:
npx --yes @modelcontextprotocol/inspector@latest --cli \
node /path/to/phos-mcp-bridge/dist/index.js \
--url http://192.0.2.10:8001/mcp \
--method resources/read --uri phos://vision/snapshot
The response has MIME type image/jpeg and binary MCP Resource content. The
Inspector may serialize that content as a textual blob representation for CLI
output; PHOS itself does not use a JSON/base64 snapshot contract.
Async resource-change subscriptions
Modern MCP clients negotiating protocol revision 2026-07-28 can use
subscriptions/listen for phos://status, phos://physical-context,
phos://physical-context/assessment, and phos://environment:
listen -> notifications/resources/updated -> resources/read
Notifications are URI-only change cues, not PHOS event payloads. Robot state
maps to status and physical context; environmental condition maps to environment
and physical context; air quality, motion, presence, attention, and observed
expression map to physical context; capability and system-health changes map to
status. phos://vision/snapshot is never announced because it is on-demand,
not a video stream.
Numeric sensor samples remain read-only Resource data and do not cause push
notifications. Confirmed environmental/motion conditions and meaningful sensor
availability or freshness status transitions do cause Resource update cues.
environment_availability_changed updates phos://environment,
phos://physical-context, and the assessment Resource;
air_quality_availability_changed also updates the assessment Resource.
Environmental and air-quality condition transitions do the same. Numeric sensor
samples still do not create push notifications, so clients use notifications as
cues and reread the current Resource when appropriate. Camera snapshots remain
excluded from continuous notifications.
The SDK owns listen-stream filtering, disconnect cleanup, and bounded
per-client delivery. PHOS owns one bounded bridge subscription for its MCP
listener and coalesces duplicate pending resource URIs. MCP subscriptions are
not an event log: there is no replay, no history, and no raw sensor-telemetry
push. Updates while disconnected are not replayed; reconnect, open a new
listen stream, and read current Resources. In credential mode each subscription
request is authenticated, but the current PHOS implementation does not apply
the requested URI's read permission when registering the subscription or
broadcasting ResourceUpdated. The notification contains only a URI, but its
timing can reveal that a protected resource changed to a client that cannot read
that resource. Every subsequent resources/read authenticates and applies the
resource permission again; this prevents content disclosure, but not
change-metadata disclosure. Do not treat URI subscriptions as per-resource
confidentiality boundaries. This limitation is recorded as provisional finding
STEP08-IMPL-01; no fix is claimed here.
Presence changes (no_one / person_present) and semantic attention changes
both update phos://physical-context. The re-read projection contains only
anonymous presence state, count, and reliable confidence plus semantic attention
state and non-identifying target coordinates/confidence; it never contains a
candidate ID, target ID, face embedding, or camera frame. Delivery is
best-effort: a notification says only that the Resource may have changed, not
that a client acted on it or that every intermediate state was observed.
This is standard MCP Resource subscription support, not MCP Events and not a
mechanism that independently activates any AI agent's reasoning. Compatible
agents choose whether to subscribe and what to do after re-reading a Resource.
The currently pinned Python MCP SDK provides subscriptions/listen but does
not provide native typed MCP Events discovery or the events/list,
events/subscribe, and events/unsubscribe methods. A future, optional,
provider-neutral MCP Events adapter remains deferred until those native SDK
extension points are available. It must be independently enabled and must not
change the endpoint behavior seen by ordinary MCP clients.
The separately owned phos-mcp-bridge has been
externally validated for a long-lived stdio subscriptions/listen connection:
two consecutive phos://status ResourceUpdated notifications were forwarded
from PHOS Streamable HTTP to the Inspector. Bridge code is not owned or
modified by this repository.
The bridge's Node 22 build and automated suite validate its standard MCP subscription forwarding path. Live physical interoperability remains a manual Raspberry Pi integration test.
Raspberry Pi validation
systemctl --user restart phos.service
systemctl --user status phos.service --no-pager
ss -ltnp | grep 8001
journalctl --user -u phos.service -n 100 --no-pager
On the Pi, start the MCP Inspector with npx @modelcontextprotocol/inspector.
In its connection form select Streamable HTTP and enter
http://127.0.0.1:8001/mcp; connect, then call each available tool. From a
workstation, first use an SSH tunnel and use the same Inspector URL locally:
ssh -N -L 8001:127.0.0.1:8001 pi@PHOS_HOST
npx @modelcontextprotocol/inspector
For an explicitly configured LAN host, connect only from that trusted LAN to
http://LAN_ADDRESS:PORT/PATH; do not forward it to the Internet.
Recorded physical validation
Direct Streamable HTTP validation confirmed phos://status sleep/wake
notifications, phos://physical-context semantic updates, and
phos://environment availability updates. Sensor freshness validation
confirmed environment loss/recovery and motion/IMU availability transitions.
The bridge validation above confirmed a stdio subscription to phos://status
and two consecutive ResourceUpdated notifications. These checks did not
include physical air-quality validation. With Camera Preview disabled,
phos://vision/snapshot remained available and resources/read returned an
image/jpeg Resource with a non-empty blob. This validates resource
availability and JPEG output only; it does not validate image content quality.
Temporal History v0.1
phos_query_measurements(metric, start?, end?, limit?) returns accepted
RAM-only numeric observations and a min/max/average summary. start and end
are timezone-aware RFC 3339 timestamps, the requested interval may not exceed
six hours, and limit is 1–360. phos_list_physical_transitions(event_type?,
limit?) returns confirmed semantic transitions with a 1–360 limit. Both require
read_physical_history. History holds at most six hours, one sample per metric
per minute, 360 samples per metric, and 500 transitions; it is lost on restart.
Missing, stale, and unavailable inputs are not fabricated or interpolated.
History excludes camera/audio data, transcripts, and identity.
Physical Context Intelligence v0.1 — agent composition contract
PHOS supplies factual physical observations and bounded summaries. An external Agent combines those facts with its own task context and is solely responsible for interpretation and decisions. This is an on-demand composition pattern, not a PHOS runtime subsystem: it starts no worker, polls no sensor, or persists additional data. It exposes one read-only assessment tool and Resource over the existing bounded history.
Use phos_get_physical_context first to obtain the current semantic context.
Its environment section reports status, available, temperature_c,
pressure_hpa, humidity_percent, last_update, and age_seconds. Its
air_quality section similarly reports status, available, eco2_ppm,
tvoc_ppb, aqi_uba, last_update, and age_seconds. The same document
includes current robot, presence, and attention sections. The current
context establishes whether a reading is currently available or stale; history
does not turn an unavailable sensor into a current one.
external_observations is a backward-compatible list of current measurements
from authorized external physical sources. Each item has source_id,
provider (id and protocol-neutral type), optional device_id, entity_id,
display_name, and zone, plus quantity, value, unit, status,
available, fresh, age_seconds, received_at, optional observed_at,
source_time_reliable, provenance, and authorization. ESPHome records also
include device_name. MQTT topics, credentials, and raw packets are never
returned. A stale or unavailable item has value: null; an unapproved,
revoked, removed, or retired source is omitted. These are distinct external
sources, not automatically equivalent devices or independent physical evidence;
PHOS performs no fusion, averaging, room assignment, or distributed history.
For ESPHome, device_name is taken from the configured device's display name;
display_name is the configured measurement mapping name. zone is the
optional configured device zone, or null if absent. The
authorized configuration is snapshotted once per physical-context read. Zone is
descriptive metadata only and does not participate in source or authorization
identity. See the ESPHome Native API guide for setup,
mapping, and credential handling.
Illustrative MQTT-backed temperature item (the source ID and timestamps are deployment-specific):
{
"source_id": "mqtt-example/office-temperature",
"provider": {"id": "mqtt-example", "type": "mqtt"},
"device_id": "example-device",
"entity_id": "temperature",
"display_name": "Office Temperature",
"zone": null,
"quantity": "temperature_c",
"value": 22.0,
"unit": "c",
"status": "available",
"available": true,
"fresh": true,
"age_seconds": 12.5,
"received_at": "2026-11-28T12:00:00+00:00",
"observed_at": null,
"source_time_reliable": false,
"provenance": ["mqtt"],
"authorization": "authorized"
}
An ESPHome-backed item additionally contains device_name; its mapped
measurement name remains display_name. This example uses fictitious identity
strings and an illustrative timestamp:
{
"source_id": "esphome-example/room-temperature/1-1",
"provider": {"id": "esphome-example", "type": "esphome"},
"device_id": "example-device",
"entity_id": "605",
"display_name": "Room temperature",
"device_name": "Example room sensor",
"zone": "salotto",
"quantity": "temperature_c",
"value": 21.0,
"unit": "c",
"status": "available",
"available": true,
"fresh": true,
"age_seconds": 4.2,
"received_at": "2026-12-03T10:00:00+00:00",
"observed_at": null,
"source_time_reliable": false,
"provenance": ["esphome-native-api"],
"authorization": "authorized"
}
Ask for “the temperature reported by the external office sensor”, “which
physical observations are currently available”, or “show the source and
freshness of temperature readings”. phos_query_measurements is not the tool
for current external MQTT readings: it queries bounded native numeric history.
An agent may compare native and external values, but PHOS does not establish
that they describe the same physical place or fuse them. Any speech request
remains a separate, permission-checked physical action.
Use phos_get_physical_assessment before treating retained measurements as
continuous evidence, especially after an interruption. It reports current
source availability/freshness, historical-window evidence validity, and—when a
recovery boundary is safely ordered—the validity of the recent post-recovery
segment. It does not make current environmental conditions its primary answer,
guarantee physical measurement accuracy, or detect rising/falling/stable
trends. Use phos_get_physical_context for current perceived conditions, and
combine phos_get_physical_assessment with phos_query_measurements for a
time-window question.
Tool descriptions and read-only annotations guide MCP clients and Agents, but cannot guarantee that every Agent selects the appropriate tool.
For a selected time window, call the history tools with their actual signatures:
phos_get_physical_context()
phos_get_physical_assessment()
phos_query_measurements(metric, start?, end?, limit?)
phos_list_physical_transitions(event_type?, limit?)
For example, an Agent determines its own RFC 3339 UTC start timestamp for one hour ago, then requests:
phos_query_measurements("temperature_c", start="2026-11-19T09:00:00Z",
end="2026-11-19T10:00:00Z", limit=360)
The measurement result contains metric, samples, count, and summary.
Each sample contains metric, value, unit, observed_at, source, and
quality. When samples exist, summary contains minimum, maximum,
average, delta, coverage, start, and end; start and end are the
first and last returned samples. The delta is PHOS's arithmetic last-value
minus first-value summary, not an interpretation of comfort, safety, or cause.
Use the same query for humidity_percent, pressure_hpa, eco2_ppm,
tvoc_ppb, or aqi_uba. Query only the metrics relevant to the Agent's task;
there is no combined trend endpoint. For the latest confirmed presence change,
request:
phos_list_physical_transitions(event_type="presence_changed", limit=1)
For recent attention or robot-state changes, use event_type="attention_changed"
or event_type="robot_state_changed", with a suitable limit. A transition
result contains transitions and count; each transition contains type,
current, previous, observed_at, and source.
Observation and interpretation boundary
The following examples show the boundary deliberately:
| Situation | PHOS measurement or semantic observation | PHOS mathematical summary | External Agent interpretation |
|---|---|---|---|
| Temperature rose in one requested hour | Returned temperature_c samples have value 20.0 then 21.0. |
summary.delta is 1.0 with coverage: "sufficient". |
“Temperature increased by approximately 1 °C within the requested window.” |
| Air-quality values changed | Returned eco2_ppm, tvoc_ppb, or aqi_uba samples differ across the requested window. |
Each metric query returns its own min/max/average/delta. | Describe the reported direction and magnitude; do not infer pollutant source or issue an autonomous response. |
| Presence became present | A presence_changed transition reports previous: "no_one" and current: "person_present". |
None. Transitions are semantic facts, not numerical trends. | “PHOS last confirmed a presence-state change to person present at observed_at.” |
| Trend cannot be established | The metric has no samples, or one sample with summary.coverage: "insufficient" and summary.delta: null. |
No delta is supplied for one sample; no summary exists for zero samples. | “There is insufficient retained measurement history to describe a trend.” |
Missing-data and retention contract
- No samples means PHOS has no retained observations for that metric and query; it does not mean the physical quantity was absent or unchanged.
- One sample cannot establish a delta. Its summary has
coverage: "insufficient"anddelta: null; it must not be presented as a complete trend. - Two or more samples provide PHOS's
coverage: "sufficient"summary, but do not guarantee continuous coverage of the requested interval. PHOS does not interpolate gaps. phos_get_physical_contextis authoritative for current sensor status, availability, and age. Stale or unavailable sensors must not be represented as fresh merely because retained samples exist.- No matching retained transition does not prove that no transition occurred. The requested event may predate retention, follow a restart, or not have been recorded by the active semantic source.
- A presence transition is a confirmed semantic observation after PHOS's presence confirmation logic; it is not proof of a person's exact arrival or departure time.
- All history is RAM-only, limited to the last six hours, and discarded on runtime restart.
This composition requires read_physical_history for both history tools and
the physical-assessment Resource.
phos_get_physical_context remains governed by read_physical_context; an
Agent without history permission must not derive history from the current
context.