AI agent integration (MCP)
The Aster CLI bridge turns published service methods into tools for an MCP host. Use it to let an assistant query a worker’s catalog without writing a separate tool adapter. The bridge discovers payload schemas and forwards calls; the producer must still authorize each method.
Start the Python first service and install a CLI exposing aster mcp as described in the CLI reference. Keep the producer online and use its real address. CLI and SDK packaging have separate compatibility requirements. This integration has not received a clean-host MCP-host walkthrough.
The bridge derives tool schemas from the published service contract.
Quick start
Section titled “Quick start”# Terminal 1: run your servicepython producer.py
# Terminal 2: expose it to AI agents via MCPaster mcp <endpoint-addr>Configure your MCP client to launch this command over stdio, as shown below.
How it works
Section titled “How it works”Diagram source
graph TD
A["Claude / AI Agent"] -->|"stdio (JSON-RPC 2.0)"| B["aster mcp (MCP server)"]
B -->|"Aster RPC (QUIC)"| C["Your Service (P2P via Iroh)"]
aster mcpconnects to the producer and runs the admission handshake- It reads contract manifests from the registry to discover method schemas
- Each method becomes an MCP tool with a JSON Schema derived from the request type fields
- Tool calls are forwarded as Aster RPC calls; results returned as JSON
The MCP server uses dynamic type synthesis to invoke supported methods. Contract manifests include Fory wire tags for every field, so the server can build correctly serialized typed requests directly from the agent’s JSON arguments. No local Python type definitions or generated stubs are needed.
The agent sees tools like:
HelloService.say_hello - name (string, required)
FileStore.get (unary)FileStore.list (server_stream schema; runtime qualification required)FileStore.upload (client_stream, accepts aster_items array)Security model
Section titled “Security model”The bridge uses Aster credentials and local exposure controls. Configure both for the methods the agent needs.
Producer authorization
Section titled “Producer authorization”The MCP server is just another consumer. Give it a restricted credential:
# Mint a credential specifically for AI agent useaster trust sign --root-key root.key --type policy \ --attributes '{"aster.role": "ai-reader"}' --out ai-agent.token
# MCP server uses the AI's credential, not yoursaster mcp <peer> --rcan ai-agent.tokenOn the producer, declare which methods the AI role can access:
from aster import service, rpc, any_of
# Definition fragment: supply these application payload classes.@service(name="DataService")class DataService: @rpc(requires=any_of("reader", "ai-reader")) # AI can read async def get_record(self, req: RecordRequest) -> RecordResponse: ...
@rpc(requires="admin") # AI cannot call this async def delete_record(self, req: RecordRequest) -> DeleteResult: ...The producer should allow the read and deny deletion for the restricted principal. Do not assume a denied method is absent from discovered manifests or the MCP tool list. Use local allow/deny patterns to control tool visibility, and test producer denial independently. The decorator block is a policy sketch; provide RecordRequest, RecordResponse, DeleteResult, and handler bodies before registering it.
Local tool visibility
Section titled “Local tool visibility”Local glob patterns as a safety net, even if the credential allows more:
# Only expose read methodsaster mcp <peer> --allow "DataService.get_*" --deny "*.delete_*"
# Only specific servicesaster mcp <peer> --allow "HelloService.*" --allow "StatusService.*"Confirmation limits
Section titled “Confirmation limits”Do not rely on the CLI’s --confirm prompt when an MCP host launches the bridge over stdio. The prompt reads the same stdin stream as the MCP JSON-RPC reader, so approval input can conflict with protocol traffic. Use credential restrictions and allow/deny filters, and configure any operator approval in the MCP host itself.
Streaming methods
Section titled “Streaming methods”| Aster Pattern | MCP Behavior |
|---|---|
unary |
Direct request/response (1:1 mapping) |
server_stream |
Schema advertises collection controls aster_max_items and aster_timeout; runtime collection needs qualification before use |
client_stream |
Pass items via aster_items array parameter |
bidi_stream |
Not exposed as tools |
Example: calling a server-streaming method:
{ "name": "Analytics.watchMetrics", "arguments": { "interval": 5, "aster_max_items": 10, "aster_timeout": 15 }}These are the advertised schema controls. Source review found a problem in the bridge’s asynchronous server-stream collection path; do not depend on this path without testing the installed CLI. Prefer a bounded unary query for assistant tools until that integration is qualified.
Configure an MCP host
Section titled “Configure an MCP host”Use your host’s documented stdio-server configuration location. The following is a common mcpServers configuration shape, not a verified settings path for every host. Use an absolute executable path if the host does not inherit your shell PATH:
{ "mcpServers": { "my-service": { "command": "aster", "args": ["mcp", "<endpoint-addr>"], "env": {} } }}With credentials:
{ "mcpServers": { "my-service": { "command": "aster", "args": ["mcp", "<endpoint-addr>", "--rcan", "ai-agent.token", "--deny", "*.delete_*"] } }}CLI reference
Section titled “CLI reference”aster mcp <address> [options]
Arguments: address Peer address (aster1... ticket)
Options: --rcan PATH Enrollment credential for the AI agent --allow PATTERN Glob for allowed tools (repeatable) --deny PATTERN Glob for denied tools (repeatable)Verify the exposed tool set
Section titled “Verify the exposed tool set”Start with an allow pattern for the greeting method alone. Ask the host to list tools, invoke the greeting with name set to World, and expect Hello, World!. Confirm methods outside the allow pattern are absent. Then test an otherwise visible but unauthorized method with a restricted credential and confirm producer rejection.
If no tools appear, check admission, manifest arrival, and local filters separately. If a tool is listed but fails, inspect payload compatibility and method authorization. Launch credentials and token paths belong to the bridge process; avoid unintentionally inheriting an operator credential from the host environment.
Next steps
Section titled “Next steps”- Trust model — identities, admission, and authorization
- Dial a service — inspect the service contract with the CLI