MCP Servers
Posit Assistant can connect to external tool servers using the Model Context Protocol (MCP). This lets you extend the assistant with custom tools — database access, API integrations, internal services, and more.
Configuration
Add MCP servers to your settings file under the mcpServers key. Each server has a name and a configuration object.
Local Servers
Local servers run as subprocesses, communicating over stdio. Use these for MCP servers installed as npm packages, Python packages, or standalone executables.
{
"mcpServers": {
"filesystem": {
"type": "local",
"command": ["npx", "@anthropic-ai/mcp-server-filesystem", "/path/to/dir"]
}
}
}
Options
| Key | Type | Description |
|---|---|---|
command | string[] | Command and arguments to start the server. Required. |
environment | object | Environment variables passed to the subprocess. |
enabled | boolean | Whether this server is active. Default: true. |
timeout | number | Connection timeout in milliseconds. Default: 10000. |
Environment Variables
Pass secrets to local servers via the environment field:
{
"mcpServers": {
"database": {
"type": "local",
"command": ["npx", "mcp-server-postgres"],
"environment": {
"DATABASE_URL": "{env:DATABASE_URL}"
}
}
}
}
The {env:VAR_NAME} syntax expands to the value of the environment variable at runtime. This works in command, environment, url, and headers fields.
Remote Servers
Remote servers communicate over HTTP or SSE (Server-Sent Events).
{
"mcpServers": {
"my-api": {
"type": "remote",
"url": "https://mcp.example.com",
"headers": {
"Authorization": "Bearer {env:MCP_API_KEY}"
}
}
}
}
Options
| Key | Type | Description |
|---|---|---|
url | string | Server URL. Required. |
headers | object | HTTP headers sent with every request. |
transport | string | Protocol: "http" (default) or "sse" (legacy). |
auth | object | OAuth configuration (see below). |
enabled | boolean | Whether this server is active. Default: true. |
timeout | number | Connection timeout in milliseconds. Default: 10000. |
Authentication
Remote servers support three authentication approaches:
Bearer Token
Pass a static token via headers:
{
"headers": {
"Authorization": "Bearer {env:API_TOKEN}"
}
}
OAuth (Dynamic Registration)
Use "oauth" for servers that support RFC 7591 dynamic client registration:
{
"auth": "oauth"
}
The assistant handles the browser-based authorization flow automatically.
OAuth (Pre-Registered Client)
For servers that require a specific client ID:
{
"auth": {
"clientId": "my-app",
"clientSecret": "{env:CLIENT_SECRET}"
}
}
Enabling and Disabling
Set enabled: false to temporarily disable a server without removing its configuration:
{
"mcpServers": {
"staging-api": {
"type": "remote",
"url": "https://staging.example.com",
"enabled": false
}
}
}
How It Works
When Posit Assistant starts, it connects to all enabled MCP servers and registers their tools. These tools appear alongside the built-in tools and can be used by the assistant in the same way — you don’t need to reference them explicitly.
Tools from MCP servers are namespaced: mcp__<server-name>__<tool-name>.