@pi-unipi/mcp 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # @pi-unipi/mcp
2
+
3
+ MCP (Model Context Protocol) server management extension for Pi coding agent. Browse a catalog of 7,800+ MCP servers, add them interactively, and use their tools seamlessly within pi.
4
+
5
+ ## Features
6
+
7
+ - **Browse Catalog**: Search and discover MCP servers from the awesome-mcp-servers collection
8
+ - **Interactive Add**: Split-pane overlay with server browser + JSON config editor
9
+ - **Settings Management**: Enable/disable, edit, delete servers with scope switching
10
+ - **Config Hierarchy**: Global defaults with project-level overrides
11
+ - **Auto-Discovery**: Tools from MCP servers are automatically registered as pi tools
12
+ - **Offline Support**: Bundled seed catalog with 49 curated servers as fallback
13
+
14
+ ## Commands
15
+
16
+ | Command | Description |
17
+ |---------|-------------|
18
+ | `/unipi:mcp-add` | Open browse + editor overlay to add MCP servers |
19
+ | `/unipi:mcp-settings` | Interactive settings with enable/disable/edit |
20
+ | `/unipi:mcp-sync` | Force sync server catalog from GitHub |
21
+ | `/unipi:mcp-status` | Text summary of all configured servers |
22
+
23
+ ## Setup
24
+
25
+ 1. Install as part of the unipi extension suite
26
+ 2. Add MCP servers via `/unipi:mcp-add` or manually edit config files
27
+ 3. Restart pi to activate newly added servers
28
+
29
+ ## Configuration
30
+
31
+ ### File Locations
32
+
33
+ ```
34
+ ~/.unipi/config/mcp/ ← Global defaults
35
+ {project}/.unipi/config/mcp/ ← Project overrides
36
+ ```
37
+
38
+ ### Files at Each Level
39
+
40
+ - **`mcp-config.json`** — Server definitions (standard MCP format)
41
+ - **`config.json`** — Metadata (enabled/disabled, sync preferences)
42
+ - **`auth.json`** — Sensitive environment variables (chmod 600, optional)
43
+
44
+ ### Config Format
45
+
46
+ `mcp-config.json` uses the standard MCP format compatible with Claude Desktop, Cursor, and other MCP clients:
47
+
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "github": {
52
+ "command": "docker",
53
+ "args": ["run", "-i", "--rm", "-e", "GITHUB_PERSONAL_ACCESS_TOKEN", "ghcr.io/github/github-mcp-server"],
54
+ "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxx" }
55
+ },
56
+ "filesystem": {
57
+ "command": "npx",
58
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/projects"]
59
+ }
60
+ }
61
+ }
62
+ ```
63
+
64
+ ### Config Merge Rules
65
+
66
+ 1. Server exists only in global → loaded normally
67
+ 2. Server exists only in project → loaded normally
68
+ 3. Server exists in both → **project wins entirely**
69
+ 4. `"enabled": false` in project metadata → **disabled** even if defined globally
70
+
71
+ ## Tool Naming
72
+
73
+ MCP tools are registered with the pattern `{serverName}__{toolName}`:
74
+ - `github__search_code`
75
+ - `filesystem__read_file`
76
+ - `brave-search__brave_web_search`
77
+
78
+ ## Architecture
79
+
80
+ ```
81
+ packages/mcp/
82
+ ├── src/
83
+ │ ├── index.ts # Extension entry, command registration
84
+ │ ├── types.ts # TypeScript interfaces
85
+ │ ├── config/
86
+ │ │ ├── schema.ts # Defaults and validation
87
+ │ │ ├── manager.ts # Config read/merge/write
88
+ │ │ └── sync.ts # Catalog fetch and caching
89
+ │ ├── bridge/
90
+ │ │ ├── client.ts # MCP JSON-RPC client (stdio)
91
+ │ │ ├── translator.ts # MCP tool → pi tool
92
+ │ │ └── registry.ts # Server lifecycle management
93
+ │ └── tui/
94
+ │ ├── add-overlay.ts # /unipi:mcp-add UI
95
+ │ └── settings-overlay.ts # /unipi:mcp-settings UI
96
+ ├── data/
97
+ │ └── seed-servers.json # Offline fallback catalog (49 servers)
98
+ ├── skills/mcp/
99
+ │ └── SKILL.md # Agent instructions
100
+ ├── package.json
101
+ └── README.md
102
+ ```
103
+
104
+ ## Troubleshooting
105
+
106
+ - **Server won't start**: Check `/unipi:mcp-status` for errors, verify command exists
107
+ - **Tools not appearing**: Ensure server is running, check MCP protocol support
108
+ - **Config issues**: Validate JSON syntax, check file permissions
109
+ - **Sync issues**: Run `/unipi:mcp-sync`, check network, seed catalog available offline