Connect your own MCP server or REST endpoint
A Custom Connection lets a Flow (a process you define in Harnesty), an Agent (an AI worker in your Workspace) or your own script call an MCP server or a REST endpoint that you run.
The Connection stores the server's address and keeps its credential in your Workspace's vault. It turns each tool or path of the server into an operation, one call that a caller can make. Each call runs under a Mandate, the signed record that someone may do something. Harnesty meters every call and records it in the workspace audit log.
You answer for the server. We answer for everything around the call: the check of who may call, the meter, the audit log entry and the check of the address.
Before you start
- You need a Mandate to administer the Workspace. Creating a Custom Connection is an owner-level act, because you answer for the endpoint.
- The server must answer on a public address. Harnesty refuses a host that resolves to a private, loopback or link-local address.
- Have ready the credential that the server expects. A server that expects no credential takes none.
Connect an MCP server
- Call
connection.createwithkindset tocustom, aresourceof the formcustom:<name>, and anamethat no other live Connection in the Workspace uses. - Give
settingsas a list ofname=valueentries:endpointUrl, the server's URL, andconfirmedHost, the host of that URL. If the two hosts differ, Harnesty refuses the create.
endpointUrl=https://mcp.example.com/mcp
confirmedHost=mcp.example.com- If the server expects a credential, add one more entry,
credential. Its value is a JSON object: a bearer token or a set of headers.
credential={"scheme":"bearer","token":"<token>"}
credential={"scheme":"headers","headers":{"<Name>":"<value>"}}- Harnesty checks the address, contacts the server and reads its tools. Each tool becomes one operation. A tool without the
readOnlyHint: trueannotation is a write operation. - The answer carries the new Connection's id and the count of its operations. You hold the ownership Mandate over the Connection.
Harnesty speaks MCP revision 2026-07-28. It refuses a server that does not speak this revision when you create the Connection.
Connect a REST endpoint
- Publish an OpenAPI 3.1 document of your API, in JSON, at a URL that Harnesty can fetch.
- Call
connection.createas for an MCP server, but givedocumentUrl, the document's URL, in place ofendpointUrl.confirmedHostmust match the host of that URL. - If the API expects a credential, add a
credentialentry. Its value is a JSON object: an API key in a header, a bearer token, or basic credentials.
credential={"scheme":"apiKey","header":"<Name>","value":"<key>"}
credential={"scheme":"bearer","token":"<token>"}
credential={"scheme":"basic","username":"<user>","password":"<password>"}Each path and method becomes one operation, named by its operationId. Every operation must declare an operationId that no other operation uses, or Harnesty refuses the create. A path that the document does not declare does not exist in Harnesty, so no caller can reach it. GET and HEAD are read operations, and every other method is a write, whatever the document says.
Check that it works
connection.getshows the Connection'sstatus. It readsactivewhen the Connection works. Any other status means that the server refused the stored credential, did not answer, or sits at an address that Harnesty does not allow.connection.operation.listlists each operation by name, with its read-only flag. You pass each of these names toconnection.invoke.
A tool that fails, changes shape or disappears is yours to repair. Harnesty returns the tool error to the caller and never retries the call.
Change or refresh a Connection
connection.updatechanges thenameor thesettingsof the Connection that you name inconnection. A change to any settings entry must carry thecredentialentry again, or Harnesty refuses the update. This way a stored credential never reaches a host it was not given for. Harnesty checks the new settings against the server again, and the new credential replaces the stored one.connection.refreshreads the server's tools or the OpenAPI document again and replaces the list of operations. Harnesty reads them again only when you call it.
Give others access to a Connection
A Connection belongs to the member who created it. Every member of the Workspace can see that it exists and which operations it offers. To call an operation, a caller needs a Mandate that reaches the Connection.
connection.sharegives another member, an Agent or a Team access, as a Mandate that you issue at the Connection. Setconnectionto the Connection's id andsubjectto the Principal, the member, Agent or Team that receives access. Setpermissionstoread, or toreadandwrite, andverbsto the actions that the share gives out, such asharnesty:connection.invoke. Read reaches the read operations alone, and write reaches the write operations. You can never give more than your own Mandate holds, and you can never give the ownership.mandate.issueissues a Mandate at the Connection that grants the actionharnesty:connection.invoke, to any other Principal.mandate.revokeends that access. The revoke also ends every Mandate issued beneath it.
The holder then calls an operation with connection.invoke. The call returns an Operation, the record that Harnesty keeps of the call until it ends, and the output arrives on it. Harnesty refuses a caller whose Mandate does not reach the operation. No Mandate hands the credential out: Harnesty makes the call with it.
See what a call costs
A call through a Custom Connection costs 1 Credit per call, and 1 Credit = $0.01. connection.get and connection.list show the price of one call through each Connection. connection.invoke.quote quotes a call before you make it. The price and the quote both come from the same published rate.
Remove a Connection
connection.remove removes a Connection. In the same act, Harnesty revokes every Mandate issued over it, so no caller reaches the server through it again. Its name is free for a new Connection. The stored credential stays in the vault until you delete it with object.delete, with objectId set to the Connection's id.
Sources
- Workspace REST and MCP reference
- Model Context Protocol Specificationread November 25, 2026
- OpenAPI Specification v3.1.2read November 25, 2026