Skip to Content
Docs
Tools

MCP Tool Integration

The Model Context Protocol (MCP) integration lets you connect external tool servers to DocsGPT. Your agents can then discover and call tools provided by those servers during conversations — for example, querying a CRM, running code, or accessing a database.

Setup

Step 1: Configure Environment Variables (Optional)

Only needed if your MCP servers use OAuth authentication:

MCP_OAUTH_REDIRECT_URI=https://yourdomain.com/api/mcp_server/callback

If not set, it is derived from the host of CONNECTOR_REDIRECT_BASE_URI, then from API_URL.

Step 2: Add an MCP Server

Go to Settings > Connectors and pick a preset (the MCP presets table lists them). OAuth presets open the service’s sign-in: Sign in to ClickUp, for example, opens ClickUp’s sign-in, and its tools are ready when you return. draw.io, CoinGecko and Excalidraw need no sign-in: click Connect and their tools are ready. For any other server, choose Add custom connector > MCP server and enter its URL and authentication; scopes and the timeout are under Show advanced. Click Test Connection to verify, then Save.

Alpha Vantage’s sign-in works on DocsGPT cloud and on localhost only. On a self-hosted instance with its own domain, add it as a custom MCP server with your API key in the URL, https://mcp.alphavantage.co/mcp?apikey=<KEY>, and choose no authentication.

Step 3: Enable for Your Agent

In your agent configuration, enable the MCP tools you want the agent to use.

Presets need no URL entry. Most sign in with OAuth; draw.io, CoinGecko and Excalidraw connect with one click and need no credentials. draw.io’s create_diagram tool returns a link to an editable diagram in draw.io. The hosted server receives the diagram content; draw.io’s MCP server also documents a self-hosted option. CoinGecko gives agents live crypto market data through two tools: CoinGecko’s search_docs looks up its SDK documentation (methods, parameters and request structure), and execute runs the TypeScript the agent writes against the CoinGecko SDK in a sandbox. Its keyless server shares rate limits across all users. Neon’s consent screen lets each member choose a project, turn off write access and pick tool categories; its URL parameters — readonly=true, projectId=<project-id> and category=<name> — fix those choices instead, so add it as a custom MCP server only when a grant has to be fixed; see Neon. For Excalidraw, read_me describes the diagram format and create_view draws the diagram as an interactive canvas in the answer (see MCP Apps); the canvas exports it to an editable https://excalidraw.com/#json=… link. Admins can turn presets off one by one, and turn off custom MCP servers, in Admin > Connectors. See Connectors.

A server’s tool descriptions reach the model verbatim, so a hostile server can plant instructions in them. While an admin has turned on Warn about tool descriptions that look like prompt injection in Admin > Guardrails, and the operator has turned the decision model on, each action is scored when the server is saved or refreshed, and an action that reads like a prompt injection is marked in the tool’s permissions. Nothing is turned off; check the action under Customize before you allow it. See MCP tool descriptions.

MCP servers in a team

In a team workspace, a server you sign in to (OAuth) can be used two ways. When an Admin adds one, the form asks Who signs in:

  • Each person signs in with their own account (the default). Everyone who uses the server’s tools signs in to it with their own account; nobody’s is shared. You need your own sign-in to the server in Personal first, and DocsGPT offers to take you there when you don’t have one.
  • The team signs in once, with your account. You sign in now, and everyone in the team uses that account. It becomes the team’s connection, connected by you, on the team’s Connectors page. A team signs in to each server once.

Editors add servers the first way only. OAuth presets and Linear connected from a team’s Connectors page are team sign-ins, made by an Admin.

A team sign-in follows the rules of any account connected for the team: it pauses when whoever signed in leaves the team or stops being an Admin, another Admin can Reconnect it with their own account from Connectors, and its tools never run for anyone outside the team. A team server saved without sign-in can’t be switched to OAuth by editing it: add it as a new server. Servers with a bearer token or API key keep the key on the team’s tool, as before.

Parallel Search MCP provides public web search and page extraction without a Parallel account or API key. Free access is rate-limited.

  1. Follow Step 2 above to add a custom MCP server, and name it Parallel Search.
  2. Enter https://search.parallel.ai/mcp as the server URL and select No authentication. DocsGPT automatically uses Streamable HTTP for this URL.
  3. Click Test Connection. The discovered tools should include web_search and web_fetch. Click Save.
  4. Enable the saved MCP tool in your agent configuration. Start a conversation and ask, for example: “Search the web for the official Python documentation on virtual environments and fetch the relevant page.”

web_search returns web results with source URLs and excerpts. web_fetch extracts text from public URLs. To stop an agent from using these tools, remove the MCP tool from that agent’s configuration.

Once enabled, the agent can call these tools during conversations. Queries, requested URLs, and any supplied objectives or context are sent to Parallel. Only enable the connection for agents whose data may be shared with this service.

Supabase

The Supabase preset asks for a project ID before you sign in, and the connection reaches that project only. Copy the ID from Project Settings > General in your Supabase dashboard. Signing in again keeps the connection on the same project, and a Supabase tool removed from Tools comes back on it too. Project-scoped mode drops Supabase’s account-management tools, such as listing and managing projects.

Supabase’s plain URL reaches every project the signed-in account can see, so DocsGPT refuses it: a custom MCP server at mcp.supabase.com needs project_ref as well. To also run SQL with read-only database access, add Supabase as a custom MCP server with both parameters:

https://mcp.supabase.com/mcp?project_ref=<project-ref>&read_only=true

Use a development project for testing rather than a production one.

Authentication Types

Auth TypeConfig Fields
None—
Bearerbearer_token
API Keyapi_key, api_key_header (default: X-API-Key)
Basicusername, password
OAuthoauth_scopes (optional)

For OAuth in production, MCP_OAUTH_REDIRECT_URI must be a publicly accessible URL pointing to your DocsGPT backend.

OAuth servers, including the OAuth presets, also need ENABLE_SSE_PUSH=true (the default) and the API served through the ASGI app. The sign-in link and its result reach the web app only as mcp.oauth.* events on the realtime events stream; with the publisher off, adding an OAuth server never gets past Test Connection.

API Endpoints

EndpointMethodDescription
/api/mcp_server/testPOSTTest a connection without saving
/api/mcp_server/savePOSTSave or update a server configuration
/api/mcp_server/callbackGETOAuth callback handler
/api/mcp_server/auth_statusGETBatch check auth status for all MCP tools

For an OAuth server, /api/mcp_server/test answers with requires_oauth: true and a task_id, and the sign-in runs in the background. Its progress arrives on the user event stream, GET /api/events, as mcp.oauth.in_progress, mcp.oauth.awaiting_redirect (with the authorization_url to open), mcp.oauth.completed or mcp.oauth.failed events whose scope.id is that task_id. After completed, call /api/mcp_server/save with oauth_task_id set to the task_id in the config. See Realtime events; the event stream needs the API served through the ASGI app.

In a team workspace, send owner: "team" beside config to both calls to sign in for the team (team Admins; the team is the one the X-DocsGPT-Workspace header names). The sign-in’s events reach the Admin who started it. To reconnect the team’s sign-in, also send its connection_id, and no tool id, to both. save returns the connection_id. A second team sign-in to the same server answers 409 account_already_connected with the existing connection_id. For a server each person signs in to, POST /api/tools/member with connector_key: "custom_mcp" and server_url adds the team’s tool without a test; it answers 409 connect_personal_first until you have your own sign-in to that server.

MCP Apps

Some MCP servers ship an interactive view with a tool, an MCP App: Excalidraw’s create_view draws a live canvas. DocsGPT renders the view inline in the answer, in a sandboxed frame that reaches only the domains the server declares, and renders it again when you reopen the conversation. A tool the server marks as the view’s own (visibility: ["app"]) is not offered to the agent; the view calls it through DocsGPT under the tool’s permission, so a tool set to Needs approval asks on the card first.

The view runs on a sandbox origin, which must differ from the app’s. On a local install with API_URL on localhost or 127.0.0.1, DocsGPT uses the other loopback name and needs no setup. On your own domain, point a second hostname (for example sandbox.docs.example.com) at the API and set MCP_APPS_SANDBOX_URL=https://sandbox.docs.example.com/api/mcp_apps/sandbox. Without a sandbox origin, or with MCP_APPS_ENABLED=false, tools show as ordinary steps and the agent keeps every tool. A connection made before this release shows its view once you open it in Settings > Connectors and click Refresh tools.

Troubleshooting

  • Connection refused — Verify the URL and that the server is reachable from your backend.
  • Invalid server URL: <reason> (when testing or saving) or Invalid MCP server URL: <reason> (when a saved tool connects) — DocsGPT only connects to MCP servers on the public internet. localhost, loopback, private (RFC 1918), link-local and other reserved addresses are refused, including a server on the same host or in the same Docker Compose project, unless the operator lists it in SAFE_URL_ALLOWED_HOSTS (Allowing private hosts). See Outbound network access.
  • 403 Forbidden — Check credentials and permissions.
  • Timed out — Default is 30s; increase timeout in tool config (max 300s).
  • OAuth “needs_auth” persists — Verify MCP_OAUTH_REDIRECT_URI is correct and Redis is running.
Edit this page on GitHub

Last updated on

On this page