What is the Model Context Protocol (MCP)?
The Model Context Protocol (MCP) is an open standard for connecting AI assistants to external data and tools through natural language.What can the Forest MCP do?
The Forest MCP server lets AI tools like Claude, Dust, and others to:- Access collection schemas
- Securely query and browse your data
- Execute actions on records
Enabling the Forest MCP Server
There are 2 ways to configure the Forest MCP Server:- Standalone: the Forest MCP Server runs as an standalone service, pointing to your existing node.js or ruby back-end
- Mounted: the Forest MCP Server runs as part of your node.js back-end
Standalone Forest MCP Server
To run your Forest MCP Server as a standalone service, you will first need to download the mcp-server package:Follow this guide to retrieve your AUTH and ENV secrets for the relevant environment.
Standalone configuration
The standalone Forest MCP Server is configured entirely through environment variables:Set
FOREST_AGENT_URL when the MCP Server runs next to a self-hosted back-end reachable at an internal address (e.g. http://localhost:3310), so tool calls hit it directly instead of the public back-end URL registered in Forest.{your-standalone-server-url}/mcp
Mounted Forest MCP Server
This is only available with the node.js back-end. For other back-ends, refer to the Standalone method further down.
index.js file, simply call the mountAiMcpServer() method when creating the back-end, for example:
{your-agent-url}/mcp
Your back-end URL can be found in the Forest UI’s Project Settings, under the Environments tab.Note that each Environment has its own Back-end URL, and therefore its own Forest MCP Server URL.
Available tools
The Forest MCP server exposes the following capabilities:Read
Write
Actions
Restrict tools
You can restrict which tools the MCP server exposes usingenabledTools. Only the tools you list will be available, and new tools added in future releases will NOT be automatically enabled, so your configuration stays safe over time.
enabledTools is not set, all tools are enabled by default.
describeCollection is always enabled, even if omitted from the list, as it is required for the MCP server to function properly.Restrict which AI clients can connect
By default, any OAuth client application can register against the MCP server through Dynamic Client Registration and, once one of your users signs in, obtain tokens. UseallowedOAuthClients (@forestadmin/agent ≥ 1.92.0, @forestadmin/mcp-server ≥ 1.21.0) to accept only approved client applications:
http(s) URI on a listed domain or one of its subdomains (dust.tt matches eu.dust.tt). Matching uses redirect URIs because they are the one piece of registration metadata an impostor cannot benefit from — the authorization code is only ever delivered there. Self-declared fields such as the client name are ignored, and custom (non-http(s)) scheme URIs are rejected even on an allowed domain, because they deliver the callback to whatever local application registered the scheme.
Every other client is rejected with a standard OAuth invalid_client error telling the user to contact their administrator; the response does not reveal the allowed domains. Registration itself still succeeds — it happens on the Forest server — the client just cannot use it against your MCP server. Access tokens issued before you enabled the option stay valid until they expire (1 hour at most); refreshes are blocked immediately.
Token lifetimes
The MCP server issues OAuth tokens whose lifetimes come from Forest: 1 hour (3600s) for an access token, 8 days (691200s) for a refresh token. Forest re-grants those 8 days on every refresh, so withoutrefreshTokenSeconds an assistant that keeps working is never asked to sign in again. You can shorten them with tokenTtl, to reduce how long a leaked token stays usable and to force users to log in again periodically.
refreshTokenSeconds is measured from the login itself, not from the last refresh, so an assistant that keeps working cannot keep extending its own session. Refresh tokens issued before you enabled the option carry no login timestamp, so their window is measured from their last refresh instead — one longer session each, then bounded.
The minimum for either value is 60 seconds; a lower value is raised to it. An invalid value (zero, negative or fractional) stops the server at startup rather than silently leaving your tokens uncapped.
Action file uploads
Actions with File fields work over MCP out of the box. The file never travels through the AI’s context window: the model asks for an upload destination, sends the bytes there directly, and passes a signed reference — a handle — as the field value.method and headers are not
decoration: a pinned sha256 is signed into a checksum header on S3, and the upload is rejected
without it. Apply them as returned rather than assuming PUT with no headers.
fileHandle is a string of the form $uploadedFile:<signed token> — pass it through unchanged,
the prefix is already there.
Nothing to provision: by default the back-end holds uploaded files in memory and serves its own
upload endpoint at <your-agent-url>/mcp/uploads, or <your-agent-url>/<basePath>/mcp/uploads if
you passed basePath to mountAiMcpServer — that host is the one to get allowed in the next
section. Objects are lost on restart, and it is correct for a single back-end instance
only: with several replicas or on a serverless runtime, the upload and the action can land on
different instances. Plug a storage
backend (S3 presigned URLs, GCS, Azure SAS) for those deployments, or turn the feature off:
Client prerequisites
The upload itself is an ordinary HTTPS request made by the AI client, outside the MCP protocol. Whether the client can make it depends on where it runs:Integrity
- The upload URL is pre-authorized and expires after 15 minutes by default
(
fileUploads.uploadUrlTtlSeconds); against the built-in in-memory store it accepts a single upload. - The handle is a signed token bound to the user who requested it, expiring after 45 minutes by
default (
fileUploads.handleTtlSeconds). - The AI is instructed to pin the file’s sha256: the digest is re-verified when the action runs, so content substituted after the upload is rejected.
- Files are capped at 20 MiB each by default (
fileUploads.maxBytes). - The in-memory store holds 64 MiB across all pending uploads (
fileUploads.ephemeralMaxTotalBytes). Redeeming a file does not free it — it lives until the handle expires — so on the defaults that is about three max-size files per 45-minute window, not a rolling 64 MiB. Past that an upload is refused with a413when it is what exceeds the total, or a507when the store was already full — in both cases the response body names the store. A413alone does not distinguish this from a file overmaxBytes, so branch on the body, not the status.
The four
fileUploads.* settings above are code-only — they are passed to mountAiMcpServer,
and there is no environment variable for any of them. On a standalone server they are set in the
module FOREST_MCP_UPLOAD_STORAGE_MODULE points at, which carries the whole fileUploads object
and not just the storage.The filename is whatever the AI client reports, and sandboxes have been observed normalizing it
(a dropped hyphen) while the bytes stay exact. In your action code, treat
file.name as a label,
not an identifier.This capability is experimental: the MCP specification is designing its own file transfer
story (SEP-2631). The
UploadStorage contract is expected to survive — safe to write an adapter against — but the
requestActionFileUpload tool and the handle format may change to follow the specification.Connect your AI assistant
Your MCP endpoint is available at/mcp (<your-agent-url>/mcp when mounted, <your-standalone-server-url>/mcp when standalone). On first connection, a browser window opens for you to log in with your Forest credentials; the assistant then operates with that user’s permissions.
Use the MCP transport type
"http" (not "sse" or "url"): the Forest MCP server uses Streamable HTTP. Your URL should still use https://. Clients that rely on mcp-remote (Claude Desktop, Windsurf, JetBrains) require Node.js 18+ (some versions need 20+).Use cases
AI-assisted operations
Use Claude or other AI assistants to:- Answer questions about your data
- Generate reports and insights
- Automate routine tasks
- Perform data analysis
Example prompts
“Show me all pending orders from the last 24 hours”
“What customers have the highest lifetime value?”
“Execute the ‘Send Invoice’ action on order #12345”
Security
The Forest MCP server:- Respects all Forest permissions and roles
- Uses your environment’s authentication
- Logs all operations for audit purposes
- Never exposes sensitive data without proper access
- Lets you restrict which AI client applications can connect (see Restrict which AI clients can connect)
- Lets you shorten the OAuth token lifetimes (see Token lifetimes)