Connect
replit logo

Replit Agent

Replit Agent currently calls external services via plain HTTPS, not MCP. Wire Dock in as a REST backend: store the key as a Secret and call fetch from the generated app.

Client
Replit Agent
Browser-hosted coding agent. Use Dock as a REST backend.
HTTP JSON-RPC (streamable-http)
Dock MCP
trydock.ai/api/mcp
37 tools · OAuth 2.1 + DCR · Bearer
Auth path
1
Mint a dk_ key in Dock Settings → API keys.
2
Paste it as Authorization: Bearer dk_… in the client config.
3
Client calls Dock MCP directly on every request.

Prerequisites

  • Replit account with Agent access.
  • A Dock dk_ key.
Secret
In your Replit project, open Tools · Secrets, add DOCK_API_KEY with value dk_....
Prompt
Tell Replit Agent: "Use the DOCK_API_KEY secret. Base URL is https://trydock.ai/api. Auth is Bearer on every request. Append a row to /workspaces/content-pipeline/rows when the user submits the form."
Generated snippet you'll want to seetypescript
export async function appendRow(title: string) {
  const res = await fetch(
    "https://trydock.ai/api/workspaces/content-pipeline/rows",
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.DOCK_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ data: { title, status: "drafted" } }),
    }
  );
  if (!res.ok) throw new Error(await res.text());
  return res.json();
}

Verify

Inside your running Replit apptext
Submit the form and confirm a new row appears at trydock.ai/{org}/content-pipeline.

Troubleshooting

Symptom
Fix
Agent-generated code hard-codes the token in source
Tell it explicitly: "Use process.env.DOCK_API_KEY, do not embed the key literal." Re-run the prompt.
App works locally but 401s in deployed Replit app
Secrets need to be set in the Deployment as well as the workspace. Replit shows them as separate settings.

Frequently asked questions

How do I connect Dock to Replit Agent?
Add Dock as a remote MCP server in Replit Agent. Either let Replit Agent's OAuth 2.1 + DCR flow handle auth (recommended; no credential ceremony), or paste a scoped Dock `dk_` API key in Replit Agent's MCP config under the `Authorization: Bearer dk_…` header.
Does Replit Agent work with Dock's MCP server?
Yes. Dock exposes 43 MCP tools at `https://trydock.ai/api/mcp` over HTTP transport with OAuth 2.1 + DCR and Bearer-token auth. Any MCP-spec-compliant client, including Replit Agent, discovers them via the standard `tools/list` handshake. Learn more →
How do I limit which Dock workspaces Replit Agent can write to?
When you mint the `dk_` key for Replit Agent in Settings → API keys, pick the workspace from the dropdown. The key returns 403 on every other workspace regardless of what the prompt asks. To scope across multiple, mint multiple keys or add the agent as an explicit member of each. Learn more →
How do I see what Replit Agent did in my Dock workspace?
Open the workspace in your browser. Every row Replit Agent created or updated is stamped with the agent's identity (orb + name) in the createdBy / updatedBy field. The workspace activity feed shows every action chronologically. Learn more →
How do I undo a row Replit Agent wrote to Dock?
Open the row, click the kebab menu, choose Delete (soft-delete preserves history). For bulk reverts use the activity feed to find the agent's session and delete its rows in batch. To prevent future writes, revoke Replit Agent's `dk_` key in Settings → API keys.
Can multiple Replit Agent sessions share state through Dock?
Yes. Every Replit Agent session reads and writes the same workspace, so handoffs across machines or across long-running multi-session workflows just work. The Dock workspace IS the shared state; no separate message bus required.
Does Replit Agent need OAuth or a dk_ API key for Dock?
Either works. OAuth 2.1 + DCR is the recommended path: Replit Agent hits Dock's discovery endpoint at `/.well-known/oauth-authorization-server` and auto-registers as a client. The `dk_` Bearer token path is fine for owned-code agents and CI scripts; pick whichever fits your stack. Learn more →
Can Replit Agent use Dock as a backend?
Yes. Replit Agent generates server code that can call Dock's REST API. Tell it to read DOCK_API_KEY from Replit Secrets and hit `https://trydock.ai/api/workspaces/<slug>/rows` for any data fetches.
How do I set up Dock auth in a Replit project?
Add `DOCK_API_KEY` to Replit Secrets. Replit Agent will reference `os.environ['DOCK_API_KEY']` (Python) or `process.env.DOCK_API_KEY` (Node) automatically when wiring up Dock calls.
Can Replit Agent subscribe to Dock webhooks?
Yes, since Replit gives every project a public URL. Add a webhook handler endpoint in your project, register the URL with Dock's `/api/webhooks`, filter on the events you care about. Replit's hibernation may delay delivery; use the Always-On feature for production webhooks.

Related

Updated