This example runs a dependency-free stdio bridge for PubFi's hosted MCP endpoint.
PubFi's MCP server remains hosted at https://mcp.pubfi.ai. This local file exists only because
some MCP clients launch integrations as local stdio commands. It does not run a local provider
adapter, it does not implement PubFi routing locally, and it does not accept upstream provider keys.
It handles initialize and ping locally, forwards tools/list and authenticated tools/call
requests to the hosted Rust MCP endpoint, and reads the PubFi caller key from an environment
variable. Other hosted public introspection methods remain available directly on
https://mcp.pubfi.ai; the stdio bridge keeps only the tool surface needed by local MCP clients.
Requirements
- Node.js 18 or newer.
- A PubFi API key only for authenticated tool calls or optional live execution.
- No upstream Subscan, DeGov, supplier, wallet, or payment credentials.
No-Secret Smoke
The smoke passes without secrets by checking initialization, public tool listing, and the
missing-key gate for tool calls:
node examples/agents/pubfi-route-tools-mcp/smoke_pubfi_route_tools_mcp.mjs
Expected report mode:
{
"schema_version": "pubfi_mcp_agent_smoke_report.v1",
"verdict": "pass",
"mode": "auth_required"
}
Authenticated Dry Run
export PROD_PUBFI_API_KEY='<PubFi API key>'
export PUBFI_MCP_ENDPOINT='https://mcp.pubfi.ai'
node examples/agents/pubfi-route-tools-mcp/smoke_pubfi_route_tools_mcp.mjs
For staging MCP endpoints, set STG_PUBFI_API_KEY instead. The bridge selects the caller-key
environment variable from PUBFI_MCP_ENDPOINT or PUBFI_MCP_ORIGIN.
The dry run verifies:
- the five generic PubFi MCP tool names;
- capability search;
- route planning;
- route explanation;
- schema readback;
- provider-specific execution rejection.
Optional Live Execution
Live execution consumes request allocation, currently targets the callable
capability:wallet.account_balance route, and requires the hosted backend to have server-side
provider credentials configured:
export PROD_PUBFI_API_KEY='<PubFi API key>'
export PUBFI_MCP_ENDPOINT='https://mcp.pubfi.ai'
export PUBFI_MCP_EXECUTE_LIVE=1
export PUBFI_MCP_SMOKE_WALLET_ADDRESS='<wallet address to query>'
node examples/agents/pubfi-route-tools-mcp/smoke_pubfi_route_tools_mcp.mjs
Do not paste the API key or wallet address into issue comments, prompts, public logs, or docs.
Execution Boundary
pubfi.route.execute executes only supported callable PubFi capability route ids with route-planning
evidence. Contract-ready capabilities can appear in catalog or schema readback without becoming live
MCP execution routes. Provider-specific route ids, unsupported capability ids, missing planning
evidence, non-callable plans, supplier API execution, automatic payment, wallet or facilitator
contact, and production route-time model authority fail closed or remain disabled.
MCP Client Config
{
"mcpServers": {
"pubfi-route-tools": {
"command": "node",
"args": ["examples/agents/pubfi-route-tools-mcp/server.mjs"],
"env": {
"PUBFI_MCP_ENDPOINT": "https://mcp.pubfi.ai"
}
}
}
}
Load PROD_PUBFI_API_KEY through your local secret store rather than committing it to this file.