MCP servers
SkillDatabases & datamcp-servers is a skill that guides an AI agent through installing, configuring, authenticating, and troubleshooting MCP (Model Context Protocol) servers. It covers writing mcp.json configuration for local command-based servers and remote hosted endpoints, handling OAuth logins, and diagnosing connections that fail.
Available today. Use it from your connected AI after setup.
No other account needed.
Have an agent with a built-in MCP client that reads server definitions from mcp.json.
Then ask your AI: use the MCP servers skill
What your AI can do with it
- Create and edit mcp.json files at global or project-local scope
- Configure local stdio servers spawned as subprocesses via npx or uvx
- Configure remote servers using streamable-http or sse transports
- Set up OAuth login in the browser for hosted services
- Diagnose why MCP tools are failing and apply fixes
- Explain how to restart sessions so config changes take effect
Getting started
- Have an agent with a built-in MCP client that reads server definitions from mcp.json.
- Decide on scope: a global config file for personal servers, or a project-local one for project-specific servers.
- Add server entries to mcp.json, using a command for local servers or a URL for remote ones.
- Provide any needed API keys or log in through the browser when OAuth is required.
- Reload the session so the new config is read and the servers start.
What this skill tells your AI
The instructions your AI receives, as published by posthog/posthog in products/desktop/packages/harness/src/extensions/mcp/skills/mcp-servers/SKILL.md and read by ahel’s review.
This agent has a built-in MCP client. Servers are declared in mcp.json; their tools
appear as mcp_<server>_<tool> once connected. The model can also always find and call
MCP tools via a single mcp proxy tool (mcp({ search: "..." }) / mcp({ tool: "...", args })
without their schemas ever being loaded into context, and without a lifecycle: "lazy"
server being connected until one of its tools is actually needed — see "Context window
control" below.
Config files
| File | Scope |
|---|---|
~/.pi/agent/mcp.json | global (all projects) |
<project>/.pi/mcp.json | project-local, only honored in trusted projects |
Project entries override global entries with the same server name; project settings
keys override global ones per key. Prefer project-local config for project-specific
servers, global for personal/general-purpose ones. Create the file if it doesn't exist.
Applying changes: config is read at session start. After editing mcp.json, tell
the user to run /reload (this re-reads config, restarts servers, and refreshes tools).
You cannot run /reload yourself.
Config format
{
"settings": {
"toolPrefix": "mcp",
"requestTimeoutMs": 30000,
"maxRetries": 3,
"searchResultLimit": 15
},
"mcpServers": {
"<server-name>": { ... }
}
}
settings is optional. Server names: keep them short and lowercase; they become part
of tool names.
Local (stdio) server — spawned as a subprocess
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"],
"env": { "SOME_VAR": "literal-value" }
}
}
}
commandis required;transportdefaults to"stdio".envvalues are literals merged over the parent environment — there is no${VAR}interpolation. If a server needs a secret, ask the user to provide it or reference their shell environment by launching via a wrapper script.- Most published servers run via
npx -y <package>(Node) oruvx <package>(Python). If unsure of the package name, search the web for " MCP server".
Remote (HTTP) server
{
"mcpServers": {
"internal": {
"transport": "streamable-http",
"url": "https://mcp.example.com/mcp",
"headers": { "Authorization": "Bearer <api-key>" }
}
}
}
transport:"streamable-http"(preferred) or"sse"(legacy);urlrequired.headersis for static API-key auth. Never invent keys — ask the user for theirs.
Remote server with OAuth (user login in browser)
{
"mcpServers": {
"linear": {
"transport": "streamable-http",
"url": "https://mcp.linear.app/mcp",
"auth": { "type": "oauth" }
}
}
}
auth: { "type": "oauth" }is enough for most servers (discovery + dynamic client registration + PKCE are automatic). Optional fields:scope,clientId,clientSecret,redirectUrl(only for pre-registered clients),clientName.- After
/reload, the first connection will fail with "Authentication required" — that is expected. Start the login yourself with themcp_authtool (opens the user's browser), or tell the user to run/mcp:auth <server-name>. Tokens are stored and refreshed automatically afterwards. - OAuth is only valid for
streamable-http/sse, notstdio. - If dynamic client registration is rejected (e.g. a client-name policy error), set
"clientName"in theauthobject and retry.
Other per-server options
lifecycle:"lazy"(default — starts on first use of one of its tools via themcpproxy tool, or manually with/mcp:start <name>) or"eager"(starts at session start). Use eager only for a server you want connected from the very first turn.requestTimeoutMs,healthCheckIntervalMs: numeric overrides, rarely needed.idleTimeoutMs:lifecycle: "lazy"only — auto-disconnect this many ms after the server's last tool call. Good for servers used in bursts, e.g.600000(10 min).description: one-line summary shown bymcpsearch before this server has ever connected (its real tool list isn't known yet). Set this on lazy servers so the model can find them via search before the first connection.directTools:false(default — all tools stay searchable-only viamcp),true(all tools load straight into context), or an array of MCP-side tool names to keep direct while the rest stay proxy-only. Settrue(or list specific names) only for a small server used on nearly every turn, where asearchround-trip isn't worth it.
Context window control (the mcp proxy tool)
A single mcp tool is always available, independent of mcp.json:
mcp({ search: "keywords" })— finds relevant tools/servers by keyword, including ones that are not currently connected (their cached or configureddescriptionmetadata is searched instead of connecting).mcp({ tool: "<name>", args: '{"key":"value"}' })— calls a tool by its exact name (from search), starting its server automatically if needed. Passing a bare server name instead of a tool name connects that server and lists its tools without calling anything.
You do not need to do anything for this to work — it's automatic for every configured
server. Only mention directTools/idleTimeoutMs/description to the user if they
ask about reducing context usage or about servers not starting immediately.
Workflow for "install X MCP server"
- Find the server's package name (stdio) or MCP endpoint URL (remote). Use web search
if unsure; official docs usually show an
mcpServersJSON snippet you can adapt. - Decide global vs project config; read the existing file first and merge — do not clobber other servers.
- Write the config. Validate: stdio needs
command; http/sse needsurl. - Ask the user to run
/reload, then/mcpto confirm the server isready. If it uses OAuth, start the login with themcp_authtool once the server exists.
Agent tool
mcp_auth({ "server": "<name>" }): queues the interactive browser OAuth flow for a configured server. Use it when the user asks you to log in / authenticate an MCP server. The flow starts after your turn ends; the user completes it in the browser.
Commands (user-facing — suggest these, you cannot run them)
| Command | Purpose |
|---|---|
/mcp | status of all servers |
/mcp <name> | state, last error, recent server logs |
/mcp:start <name> / /mcp:stop <name> | start/stop a server |
/mcp:auth <name> [reset] | browser OAuth login (reset wipes stored credentials) |
/reload | apply mcp.json changes |
Troubleshooting
- Server stuck at
stoppedwith an error: suggest/mcp <name>to see its stderr log. Common causes: package name typo, missing runtime (npx/uvxnot installed), missing env var/API key, wrong URL. 401/Unauthorizedon an OAuth server:mcp_authtool or/mcp:auth <name>; if it keeps failing,/mcp:auth <name> reset.- OAuth registration rejected with a client-name error: set
"clientName"in the server'sauthconfig to a compliant name,/reload, and retry the login. - Tools missing after config edit:
/reloadwas probably not run. - Project config ignored: the project may not be trusted; move the server to
~/.pi/agent/mcp.jsonor have the user trust the project.
Signals
- GitHub stars
- 40k
- Forks
- 3k
- Last commit
- Sep 2026
Others that do the same job
Questions
- How do I add an MCP server?
- Add an entry under mcpServers in mcp.json. Local servers need a command (often npx or uvx); remote servers need a URL and transport. Then reload the session.
- Where does mcp.json go?
- Global config lives at ~/.pi/agent/mcp.json and applies to all projects. Project-local config goes in <project>/.pi/mcp.json and is only honored in trusted projects.
- Why aren't my MCP tools showing up?
- Config is read at session start. After editing mcp.json, the session must be reloaded so servers restart and tools refresh.
Advanced
- Item type
- skill
- Key
mcp-servers-posthog- Source
- github.com/posthog/posthog