Docs

Connect your own MCP server or REST endpoint

Updated View as Markdown

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

  1. Call connection.create with kind set to custom, a resource of the form custom:<name>, and a name that no other live Connection in the Workspace uses.
  2. Give settings as a list of name=value entries: endpointUrl, the server's URL, and confirmedHost, the host of that URL. If the two hosts differ, Harnesty refuses the create.
   endpointUrl=https://mcp.example.com/mcp
   confirmedHost=mcp.example.com
  1. 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>"}}
  1. Harnesty checks the address, contacts the server and reads its tools. Each tool becomes one operation. A tool without the readOnlyHint: true annotation is a write operation.
  2. 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

  1. Publish an OpenAPI 3.1 document of your API, in JSON, at a URL that Harnesty can fetch.
  2. Call connection.create as for an MCP server, but give documentUrl, the document's URL, in place of endpointUrl. confirmedHost must match the host of that URL.
  3. If the API expects a credential, add a credential entry. 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.get shows the Connection's status. It reads active when 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.list lists each operation by name, with its read-only flag. You pass each of these names to connection.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.update changes the name or the settings of the Connection that you name in connection. A change to any settings entry must carry the credential entry 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.refresh reads 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.share gives another member, an Agent or a Team access, as a Mandate that you issue at the Connection. Set connection to the Connection's id and subject to the Principal, the member, Agent or Team that receives access. Set permissions to read, or to read and write, and verbs to the actions that the share gives out, such as harnesty: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.issue issues a Mandate at the Connection that grants the action harnesty:connection.invoke, to any other Principal.
  • mandate.revoke ends 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

  1. Workspace REST and MCP reference
  2. Model Context Protocol Specificationread November 25, 2026
  3. OpenAPI Specification v3.1.2read November 25, 2026