# ADR-0016: Pi-MCP Adapter — Model Context Protocol Bridge

**Status:** Accepted
**Date:** 2026-05-13
**Package:** `pi-mcp-adapter@2.6.1`
**Maintainer:** @nicobailon | **Repo:** github.com/nicobailon/pi-mcp-adapter
**Last published:** today | **Publish cadence:** ~3-4/week

## Problem

MCP is the open standard for connecting AI systems to external tools. Ecosystem: 5,800+ MCP servers, 97M+ monthly SDK downloads, donated to Linux Foundation Agentic AI Foundation. Without an adapter, the agent is locked out of this ecosystem.

## Decision

Bridges MCP servers into the agent's tool registry:

- Discovers servers from `mcp.json`
- Translates MCP tools → native pi tool calls
- Handles MCP lifecycle (connect, list, call, disconnect)
- Auto-restart on config changes

Currently: Playwright MCP for browser automation (Chromium/Firefox/WebKit).

## Alternatives

| Approach          | Why Rejected                 |
| ----------------- | ---------------------------- |
| No MCP            | Locked out of 5,800+ servers |
| Custom per-server | Not reusable                 |

## Trade-offs

JSON-RPC hop adds latency. Version mismatches possible. **Security**: MCP servers execute arbitrary code — trust boundary is the server config. [PolicyLayer audit](https://policylayer.com/research/state-of-mcp-2026): 43% of public servers have command injection flaws. Only use trusted, audited servers.

## References

- [npm](https://www.npmjs.com/package/pi-mcp-adapter)
- [MCP spec](https://modelcontextprotocol.io) — official protocol
- [Playwright MCP](https://playwright.dev/mcp) — browser automation
- [PolicyLayer MCP Audit](https://policylayer.com/research/state-of-mcp-2026) — 1,787 servers classified
- arXiv 2604.18071: "MCP- and plugin-oriented extensions are emerging"
