Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nicobailon/pi-mcp-adapter/llms.txt
Use this file to discover all available pages before exploring further.
Overview
While~/.pi/agent/mcp.json provides global MCP configuration, you can override or extend it on a per-project basis using .pi/mcp.json in your project root. This is useful for:
- Adding project-specific MCP servers (e.g., a database server only needed for one codebase)
- Overriding global server configurations
- Setting different lifecycle modes or direct tools for specific projects
- Keeping sensitive project configurations out of your global config
Configuration Precedence
The adapter loads configurations in this order, with later sources overriding earlier ones:- Global config (
~/.pi/agent/mcp.json) - Imported configs (if
importsis specified in global config) - Project config (
.pi/mcp.jsonin current working directory)
.pi/mcp.json will override the same server from global or imported configs.
Example: Project Database Server
Suppose you’re working on a project that needs access to a PostgreSQL database via MCP:.pi/mcp.json
- The
postgresserver is available - It won’t interfere with other projects
- Connection credentials stay in the project (add
.pi/to.gitignore)
Overriding Global Servers
You can override settings for globally-defined servers. For example, if you havegithub configured globally but want different settings in one project:
.pi/mcp.json
github configuration entirely when working in this project.
Settings Override
- Tool prefix becomes
short(strips-mcpsuffix) - All servers get
directTools: trueby default idleTimeout: 10from global config is preserved (not overridden)
Import Behavior with Project Config
Imports are processed from the global config only. Project configs cannot specifyimports. The load order is:
- Load global config from
~/.pi/agent/mcp.json - Process
importsarray from global config - Load project config from
.pi/mcp.json - Merge: project config overrides imported and global servers
Why can't project configs use imports?
Why can't project configs use imports?
Imports are resolved relative to fixed paths (e.g.,
~/.cursor/mcp.json). Since these are user-level configs, it doesn’t make sense to re-import them per-project. If you need to reference another project’s config, copy the server definitions explicitly.File Location
The adapter looks for.pi/mcp.json in the current working directory (process.cwd()). This is typically:
- The directory where you ran
pi - The workspace root in most editor integrations
.pi/mcp.json in that subdirectory, not the project root.
Security Considerations
Secrets in Project Config
Project configs often contain sensitive data:Environment Variable Interpolation
Use${VAR} syntax for secrets. Set the environment variable before running Pi:
${DATABASE_PASSWORD} from the environment.
Shared Project Configs
If you want to commit a shared config for your team:-
Create
.pi/mcp.json.examplewith placeholder values: -
Add
.pi/mcp.jsonto.gitignore - Document required environment variables in your README
Real-World Example
Here’s a complete project config for a web app:.pi/mcp.json
- Uses
shortprefix mode for cleaner tool names - Adds a project database with lazy connection
- Restricts filesystem server to
./srcand./public - Promotes specific Puppeteer tools to direct access
- All servers use lazy lifecycle to minimize startup overhead
Troubleshooting
Project Config Not Loading
-
Check working directory: Run
pwdbefore starting Pi. The adapter looks for.pi/mcp.jsonrelative to this path. -
Verify JSON syntax: Invalid JSON will fail silently. Test with:
-
Check console warnings: The adapter logs to stderr if it can’t parse the project config:
Server Not Overriding Global Config
Make sure server names match exactly. Server names are case-sensitive:Settings Not Merging
Settings merge is shallow. If you want to preserve global settings:Global
Project