Skip to content

Self-hosted MCP gateway for AI agents

Self-hosted MCP gateway · Apache 2.0

Your agent gets the tools.
ToolMesh keeps the keys.

ToolMesh is a self-hosted MCP gateway. Claude, ChatGPT and other MCP clients connect to one endpoint and call tools from GitHub, NetBox, Stripe, Zammad or your own REST API. ToolMesh holds the API keys, checks for every call whether the caller may make it, and writes each call to an audit log.

REST APIs come in through DADL files, a few lines of YAML per endpoint that an LLM can write for you. Existing MCP servers, over HTTP or stdio, sit behind the same endpoint.

AuthverifiedAuthZallowedsk_live_4eC3...********Credsinjectedjohn@acme.com[REDACTED]GatefilteredExecexecuted200 OKtool:list_reposAuditloggedAIAgentAPIBackendREQ

Current release: v0.6.0 · credentials out of .env, held in memory only, withergosum releasing the key on the bound machine.How it works → ·Upgrade notes →

4,591 tools across 36 APIs in the DADL registryAPI keys stay on the serverAuthorization on by defaultAn audit entry for every callREST APIs and MCP serversApache 2.0Self-hosted
In the registry today

36 APIs already described as DADL files.

4,591tools

One tool is one API action: list a repo, create an invoice, reboot a server. Each backend is one YAML file; ToolMesh serves them all behind one endpoint.

Why

An MCP client that talks to five systems usually holds five API keys in its configuration, and every agent that uses the client may call every tool those keys open. An MCP server offers the endpoints its author chose; when you need another one, you wait for a release or fork the server. And when an agent did something unexpected, the question “which tool did it call, with which parameters?” often has no answer.

ToolMesh moves the keys, the permissions and the record of calls into one service you run yourself.

What you get

๐Ÿ”Œ

One endpoint for many backends

REST APIs through DADL files and existing MCP servers over HTTP or stdio. Tools are named <backend>_<tool>, for example github_list_issues.

๐Ÿ”‘

API keys stay on the server

ToolMesh reads them from its environment, or from a command such as a sops decryption, and adds them to the request at call time. They appear neither in prompts nor in the client configuration.

๐Ÿ”

Authorization from the first start

OpenFGA runs inside ToolMesh. Grants name users, roles, plans or companies and allow all tools, a backend, single tools or an access class such as read. Tool listings show each caller only what it may call.

๐Ÿ“‹

An audit entry for every call

Who called which tool with which parameters, how long it took and how it ended. Structured log lines by default; with AUDIT_STORE=sqlite a database you query with SQL.

๐Ÿ’ป

Code Mode

The model sees two tools, discover_tools and execute_code, looks up the signatures it needs and writes short JavaScript that makes several calls in one round trip. In the DADL paper, advertising 1,833 tools took about 142,000 tokens; the two Code Mode tools take about 1,000.

๐Ÿ›ก๏ธ

Optional JavaScript policies

A policy checks a call before it runs and filters its result, for example to redact personal data. None is active until you add one; examples ship with ToolMesh.

How it works

Every tool call runs through the same steps. A step that fails stops the call, and every exit writes an audit entry.

An agent is asked: “List the open invoices from Stripe.”

โœ“
AuthenticateOAuth 2.1 or API key
โœ“
AuthorizeOpenFGA: may this caller call stripe_list_invoices?
๐Ÿ”‘
Add the credentialThe Stripe API key, from the server's environment. The model never sees it.
๐Ÿ›ก๏ธ
Policy, beforeOptional JavaScript check of the parameters
โšก
CallGET /v1/invoices?status=open
๐Ÿ›ก๏ธ
Policy, afterOptional JavaScript filter of the result, for example customer emails → [EMAIL]
๐Ÿ“‹
AuditOne entry per call, also for denied and failed calls

Architecture at a glance

Clients connect over MCP. Behind ToolMesh sit your MCP servers and the REST APIs described in DADL files.

Claude CodetrustedClaude Desktoptrusted3rd Party AgentuntrustedMCP + CallerIDToolMeshSelf-hosted MCP gatewayAuthOAuth 2.1AuthZOpenFGACredentialsSecret InjectGateJS PoliciesExecuteMCP / RESTAuditslog / SQLiteMCP ServersHTTP / STDIOAny existing MCP serverDADL LibraryREST APIs described in YAML, one file per APIdadl.aiStripeGitHubHetznerDeepLCloudflareyour REST API4,591 tools across 36 APIs in the registry at dadl.ai
REST APIs

A REST API becomes tools with a few lines of YAML per endpoint.

A DADL file describes a REST API as MCP tools. It also declares how the API authenticates (bearer token, API key, OAuth2, session login), how it pages and when to retry. ToolMesh does the HTTP work.

mcp-server.js39 lines
import { Server } from "@modelcontextprotocol/sdk";
import express from "express";

const app = express();
const server = new Server({ name: "github" });

server.setRequestHandler("tools/list", () => ({
  tools: [{
    name: "list_repos",
    description: "List repositories",
    inputSchema: {
      type: "object",
      properties: {
        sort: {
          type: "string",
          enum: ["created", "updated"]
        }
      }
    }
  }]
}));

server.setRequestHandler("tools/call",
  async (req) => {
    const resp = await fetch(
      "https://api.github.com/user/repos",
      { headers: {
          Authorization: "Bearer " + TOKEN
      }}
    );
    return { content: [
      { type: "text", text: await resp.text() }
    ]};
  });

app.use(server.transport);
app.listen(3000);
// + error handling, pagination,
// retries, auth refresh, types...
Also needed:Node.js runtimenpm dependenciesDocker imageProcess managerHealth checksDeployment
โ†’
github.dadl25 lines
spec: "https://dadl.ai/spec/dadl-spec-v0.2.md"
backend:
  name: github
  type: rest
  base_url: https://api.github.com
  auth:
    type: bearer
    credential: github_token
    inject_into: header
    header_name: Authorization
    prefix: "Bearer "
  defaults:
    pagination:
      strategy: page
      request:
        page_param: page
        limit_param: per_page
  tools:
    list_repos:
      method: GET
      path: /user/repos
      access: read
      description: "List repositories"
      params:
        sort: { type: string, in: query }
Prompt“Create a DADL for the Hetzner Cloud API: list servers, create server, delete server”
โ†’
ResultA hetzner-cloud.dadl with three tools. Test it against the real API before you rely on it.

The DADL registry has descriptions for 36 APIs. For others, ask an LLM that knows the DADL spec. ToolMesh does not check a DADL an LLM wrote, so try new tools with a throwaway account or test data first.

Four APIs as four MCP servers, and the same four as DADL files behind ToolMesh:

Without DADLAI AgentContext Window Overflowhundreds of individual toolsgithub-mcpNode.jsGitHub APIstripe-mcpNode.jsStripe APIhetzner-mcpPythonHetzner APIdeepl-mcpGoDeepL API4 servers ยท 4 runtimes ยท 4 deploymentsEach server: deps, Docker, health checks, maintenanceWith DADL + Code ModeAI AgentCode Modediscover_tools + execute_codeToolMeshgithub.dadlGitHubstripe.dadlStripehetzner.dadlHetznerdeepl.dadlDeepLYAML files ยท no code ยท no servers ยท no deployment2 meta-tools replace hundreds of individual tools
MCP servers

Existing MCP servers sit behind the same endpoint.

ToolMesh also runs without DADL. Add an MCP server you already operate toconfig/backends.yaml, over HTTP or stdio, and its tools go through the same authorization, credential handling, policies and audit log.

backends:
  - name: notes
    transport: http
    url: "https://notes.example.com/mcp"
    api_key_env: "NOTES_API_KEY"

The key goes into .env as CREDENTIAL_NOTES_API_KEY.All backend fields →

What to know about DADL

An open format.

The DADL specification is published under CC BY-SA 4.0. Write your own files, version them in git, share them, fork them.

Files on your own server.

ToolMesh reads .dadl files from its dadl/ directory. The daily usage statistics carry only a hash of each file, and one line in .env switches them off.

No runtime dependency on dadl.ai.

dadl.ai is a catalog you can copy files from. ToolMesh does not call it at runtime. Mirror the files, or write your own.

Optional.

ToolMesh also runs with MCP servers only. DADL is one of two ways in.

Runtime: Apache 2.0. Spec: CC BY-SA 4.0. DADL details →

Policies can tell which client is calling.

An API key in apikeys.yaml can carry a caller ID, and an OAuth client is identified by its client ID. config/caller-classes.yaml maps caller IDs to classes; an ID that matches no pattern is untrusted. Policies read the class. The example policypii_protection.js masks by class as shown below. It is inactive until you copy it intoconfig/policies/.

Caller classWhat pii_protection.js masks in a result
trustedAWS keys and API tokens
standardCredit card numbers, US social security numbers, AWS keys and API tokens
untrusted and any other classAll of the above, plus email addresses, phone numbers and IPv4 addresses
Since v0.5.0: kits and signed approvals

A person grants the rights for one task. And signs the grant.

Grants cover the daily work. For the task that needs more, an agent asks for a kit: a named bundle of tools with a time limit, defined by you in config/authz.yaml. The request becomes a link. The person who approves it signs a statement of exactly what is granted, with a key that never leaves their browser. ToolMesh verifies the signature, keeps it with the statement in the audit trail, and the grant ends by itself.

  • The agent asks once.tell_me_my_rights names the tools a task lacks and the kit that covers them; request_grant answers with the link and a fingerprint, also from inside execute_code.
  • The approval is a signature by the approver.A plain-text statement (BIP-322) names the request, the entries granted, the duration and the requester. ToolMesh holds the address, never the key. Approve part of a kit, or for less time.
  • The audit trail keeps the proof.Address, signature and statement of every approval, and for every call under a kit, which kit applied and which gate policies it replaced. Verifiable later by anyone with the log.
  • Where it ends.A grant expires or is revoked. Denies in authz.yaml win over every kit, and parameter filters marked enforce-with-kit still run.

Kits and approvals →

Getting started

Hosted demo

Look first.

Connect Claude Desktop, Claude Code or ChatGPT to the public demo at demo.toolmesh.io. It serves two Hacker News backends and needs no API key of yours. The login is dadl / toolmesh.

Open the hosted demoA demo instance. For your own systems, self-host.
Self-host

Run your own instance.

You need Docker with Docker Compose and a free port, 8123 by default. Claude Code connects over plain HTTP on localhost. Claude Desktop, claude.ai and most other clients accept only HTTPS URLs, so they need a reverse proxy with TLS in front of ToolMesh. The steps below end with a first tool call and use the Hacker News DADL that ships with ToolMesh.

1
Clone the repository
git clone https://github.com/DunkelCloud/ToolMesh.git && cd ToolMesh
2
Create .env and set an API key
cp .env.example .env
In .env, set TOOLMESH_API_KEY, for example to the output of openssl rand -hex 32. Without a password or API key ToolMesh rejects every request.
3
Register the Hacker News backend
backends:
  - name: hackernews
    transport: rest
    dadl: hackernews.dadl
Save this as config/backends.yaml. The Hacker News API needs no key.
4
Start ToolMesh and check that it answers
docker compose up -d
curl http://localhost:8123/health
5
Connect Claude Code
claude mcp add -t http -H "Authorization: Bearer <YOUR_API_KEY>" -s user toolmesh http://localhost:8123/mcp
6
Ask: “What are the top stories on Hacker News right now?”Claude Code calls hackernews_get_top_stories through ToolMesh, and the audit entry shows up in docker compose logs toolmesh.

What it does not do

  • It does not terminate TLS. ToolMesh serves plain HTTP; put a reverse proxy in front for anything beyond localhost.
  • It holds the backends' keys. Each client still signs in to ToolMesh, with OAuth or with an API key that sits in its configuration.
  • It enforces no policy until you add one. The shipped examples stay inactive.
  • Its default audit log is write-only. Searching past calls with SQL needs AUDIT_STORE=sqlite.
  • It speaks REST through DADL, and MCP. Other protocols, such as gRPC, SOAP or direct database access, need an MCP server in front.
  • It does not check a DADL an LLM wrote. Test new tools against the real API, best with a throwaway account or test data.
  • An execute_code script makes at most 50 tool calls and runs at most 120 seconds (TOOLMESH_CODE_TIMEOUT).
For platform teams

ToolMesh and DADL as an Enterprise Tool Library

MCP defines how an agent talks to one tool. A company with a four-digit catalog of tools across many backends also needs one place for access rules, one audit trail and one description format that lives in git. The DADL paper calls this an Enterprise Tool Library. ToolMesh and DADL are an open, self-hosted way to build one.

Anatomy of an Enterprise Tool Library →

All backends in the registry

36 backends ยท 4,591 tools, from the live registry.

NetBoxNetBox DCIM/IPAM API -- full v4 coverage: sites, racks, devices, modules, interfaces, cables, power, IPAM (prefixes, IPs, VLANs, VRFs, route-targets, VLAN translation), virtualization, circuits (including virtual circuits), tenants, contacts, VPN (IKE/IPSec/L2VPN), wireless, extras (webhooks, event-rules, scripts, config-templates, bookmarks, notifications), users/permissions/tokens, and core data sources & jobs608 toolsOpnsenseOPNsense firewall REST API โ€” manage firewall rules, aliases, interfaces, VPN, DHCP, DNS, diagnostics, firmware, and services on OPNsense appliances347 toolsMikroTikMikroTik RouterOS REST API -- manage interfaces, IP addresses, routing, firewall, DHCP, DNS, PPP, queues, wireless, system configuration, users, certificates, files, logs, and diagnostics on RouterOS v7.1+ devices297 toolsXen OrchestraXen Orchestra REST API (XO 6.4+, current through 6.10) -- complete coverage: VMs (incl. PATCH update + snapshot revert + forced migration), VM controllers, hosts (incl. full power/lifecycle actions + maintenance mode + PIF rescan + SR probing of NFS/iSCSI/HBA/ZFS targets), pools (incl. add_host, rolling reboot/update with interrupted-update recovery + finalize), storage (SR create/delete, VDI incl. PATCH update + vhd/raw/qcow2/vmdk export, VBD), networks (VIF incl. PATCH update + PIF/PBD), VM/VDI snapshots, VM templates, hardware (PCI/PGPU/SM), tasks, backups (archives incl. live mount of backup disks, jobs/logs, repositories incl. health + benchmark + space reclaim), schedules, messages, alarms, events (SSE incl. non-XAPI collections and backup archives), RBAC v2 (users/groups/acl-roles/acl-privileges incl. assignment introspection), XO plugins (list, load/unload, autoload, self-test), proxies, servers, dashboards, SDN traffic rules (add/delete/update incl. OpenFlow priority), IPMI sensor inventory (plugin), audit records (plugin), health check291 toolsCloudflareCloudflare API -- DNS, Pages, Workers, KV, R2, D1, Zones, SSL/TLS, Cache, Load Balancers, Firewall/WAF, Page Rules, Access (Zero Trust), Email Routing, Email Sending, DMARC/SPF email auth, and account management284 toolsGitHubGitHub REST API โ€” repositories, issues, pull requests, commits, and code search259 toolsGraylogGraylog REST API -- log search (Views/Search + legacy universal), streams, pipelines, inputs, alerts, events, dashboards, users, roles, sidecars, index management, and cluster administration. Targets Graylog 6.x.222 toolsZammadZammad helpdesk REST API -- tickets, articles, users, organizations, groups, roles, knowledge base, SLAs, calendars, object manager (custom fields), macros, triggers, overviews, reports, time accounting, and full admin surface. Supports X-On-Behalf-Of impersonation on every endpoint.209 toolsCentralstationcrmCentralStationCRM REST API v1 โ€” German small-business CRM: people, companies, deals in pipelines, projects, tasks, notes (protocols), calendar, tags, custom fields, attachments, activity stream and webhooks183 toolsLinodeLinode (Akamai) cloud infrastructure API -- compute instances, volumes, DNS, networking, Kubernetes, databases, object storage, and account management182 toolsCheckmkCheckmk REST API (version 1.0, Checkmk 2.4) -- live host and service status via Livestatus queries, downtimes, acknowledgements and comments, the Event Console (list, acknowledge, change state and archive events) and BI (packs, rules, aggregations and live aggregation state), plus the full Setup side: hosts, clusters, folders, service discovery, rules and rulesets, host/service/contact groups, users, roles, passwords, time periods, host tags, notification rules, site connections and change activation. 149 toolsBillomatBillomat REST API โ€” German cloud invoicing & accounting: invoices, estimates, credit notes, recurring invoices, delivery notes, order confirmations, dunning reminders, clients, contacts, articles, payments, expenses, taxes145 toolsPlacetelPlacetel REST API v2 โ€” German cloud telephone system (hosted PBX): call log and voicemails, click-to-dial, call detail records, call recordings, contacts and caller lookup, SMS and fax, phone numbers and number profiles, call routing (forwards, ring groups, IVR menus, call center queues, routing plans, time settings), SIP users and short codes, users and permissions, announcements (text-to-speech prompts), call center agents and queues, CTI call control of desk phones, phone provisioning, call event webhooks, Microsoft Teams direct routing and Webex Calling. 128 toolsHetzner CloudHetzner Cloud API -- servers, volumes, networks, load balancers, firewalls, floating IPs, primary IPs, images, SSH keys, placement groups, certificates, and infrastructure metadata123 toolsZulipZulip REST API โ€” messages, channels (streams), topics, users, user groups, subscriptions, reactions, drafts, scheduled messages, saved snippets, presence, real-time events, invitations, attachments, custom emoji, linkifiers, and server settings. Self-hosted or Zulip Cloud.117 toolsMastodonMastodon REST API โ€” statuses, timelines, accounts, notifications, search, media, lists, polls, conversations, trends, filters, and instance info. Base URL must be set to the target Mastodon instance (e.g. https://mastodon.social).115 toolsUnifiUbiquiti UniFi Network Controller API -- manage sites, APs, switches, gateways, clients, networks, WLANs, firewall rules, DPI stats, guests, vouchers, and backups99 toolsStripeStripe REST API โ€” payment processing, billing, subscriptions, invoices, products, and financial infrastructure96 toolsMempoolmempool.space โ€” Bitcoin block explorer, mempool visualizer, fee estimator, Lightning Network explorer, and transaction accelerator93 toolsUmamiUmami open-source web analytics โ€” privacy-friendly alternative to Google Analytics89 toolsPeeringdbPeeringDB v2 API -- the public peering database of networks (ASNs), Internet Exchanges, and colocation facilities: full CRUD over net, ix, fac, org, carrier, campus, point-of-contact records, and the netixlan/netfac/ixfac/carrierfac/ixlan/ixpfx relationships that map who peers where85 toolsGitLabGitLab REST API v4 โ€” projects, issues, merge requests, pipelines, CI/CD, and code search75 toolsBookStackBookStack wiki and documentation platform REST API -- shelves, books, chapters, pages (HTML/Markdown content), attachments, image gallery, comments, cross-entity search, exports (HTML/Markdown/PDF/ZIP), ZIP imports, users, roles, content permissions, recycle bin, audit log and tags. Hierarchy: shelves > books > chapters > pages.69 toolsTailscaleTailscale API -- devices, users, auth keys, DNS, ACL/policy, webhooks, contacts, posture integrations, log streaming, and tailnet settings60 toolsVictron VRMVictron Energy VRM API -- monitor and control solar installations, batteries, inverters, and energy systems via the Victron Remote Management portal44 toolsVikunjaVikunja open-source task management โ€” project planning, kanban boards, and task tracking36 toolsDokuWikiDokuWiki JSON-RPC API โ€” wiki pages, media files, search, ACL management, and user administration33 toolsSonioxSoniox Speech AI โ€” async speech-to-text for recorded audio (60+ languages, speaker diarization, language identification, speech translation), text-to-speech synthesis with voice cloning, audio file management, model discovery, temporary API keys for untrusted clients, and per-request usage, cost and concurrency reporting. 29 toolsDeepLDeepL REST API โ€” text translation (with style profiles, translation memory, glossaries and improved tag handling), document translation, multilingual glossary management, style rules CRUD, text improvement (Write), language metadata and usage tracking. Mixes /v2 and /v3 endpoints. 27 toolsShlinkShlink self-hosted URL shortener REST API v3 โ€” create, edit and delete short URLs with custom slugs, tags, expiry dates and visit limits, define dynamic redirect rules (device, language, query parameter, IP address, geolocation, date, browser), read and summarize visit tracking per short URL, tag or domain including orphan visits and bot filtering, manage tags and per-domain "not found" redirects, and check instance health. 24 toolsElitedomainsELITEDOMAINS domain registrar API -- register/transfer/manage .de and gTLD domains, redirector & inline DNS, AuthInfo/AuthInfo2 transfer codes, RGP catcher backorders, contact handles, and marketplace offers (Sedo, sale pages)20 toolsShelly CloudShelly Cloud Control API โ€” monitor and control Shelly IoT devices (switches, covers, lights) via the Shelly Cloud15 toolsHacker NewsHacker News API โ€” read-only access to stories, comments, polls, jobs, users, and live feeds from news.ycombinator.com13 toolsAlertmanagerPrometheus Alertmanager API v2 -- alerts, silences, receivers, alert groups, status, and operational health12 toolsAlgolia HN SearchAlgolia Hacker News Search API โ€” full-text search, filtering, and retrieval for stories, comments, and users on Hacker News9 toolsYoutubeYouTube Data API v3 โ€” read videos (metadata, visibility, statistics) by ID and update a video's visibility, title, description and tags with a read-merge-write that keeps every field the caller did not change. 4 tools+ your own REST APIone YAML file

Source: dadl.ai/registry.json(schema v1.0), refreshed on every deploy.

Project statusOpen source · actively developed · version 0.xToolMesh runs in production at Dunkel Cloud. A minor release can still change the configuration; the upgrade notes list what an operator has to adjust.
Maintained byBuilt by Dunkel Cloud GmbHA German cloud-engineering company. Questions or commercial support: contact.
PricingOpen source & self-hosted today.Managed service planned, not announced. No paywalled features, no “enterprise edition” today.
TelemetryAnonymous usage statistics, once a day.A random site ID, the hash of each DADL file, call and error counts per DADL, the number of MCP backends and the version. No user IDs, keys, parameters, URLs or request content. DO_NOT_SEND_ANONYMOUS_STATISTICS=yes switches it off. Details →
ResearchThe design is written up in a paper.DADL and the token measurement for Code Mode (about 142,000 down to about 1,000 for 1,833 tools) are described on arXiv (cs.SE) and archived on Zenodo with a DOI.