home / mcp / expose mcp server

Expose MCP Server

Provides a self-hosted MCP gateway to run Claude-integrated tools via a unified HTTP endpoint.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "a0dotrun-expose": {
      "url": "http://localhost:3000"
    }
  }
}

Expose lets you build MCP tools that you can invoke with the Claude desktop app. It enables self-hosted tools, a unified HTTP gateway, and flexible customization to fit your workflow.

How to use

You run the MCP server locally or on a host, then register its HTTP endpoint with the Claude MCP client so you can invoke your tools from the app. Start by launching the server, which exposes a single HTTP endpoint. In Claude, point the MCP client to that endpoint and you can call the defined tools directly from the desktop interface. You can also deploy the server to a public URL and use that URL in Claude.

How to install

Prerequisites you need before proceeding: Node.js and npm are installed on your system.

curl -fsSL https://github.com/a0dotrun/expose/releases/download/stable/download_cli.sh | bash

Install the MCP library that enables tool hosting and HTTP exposure.

npm i @a0dotrun/expose

Add your server and tools

Create your server file and define the tools you want to expose. The example shows how to initialize the server and add two sample tools.

// src/server.ts
import { create } from "@a0dotrun/expose"

const app = create({
  tools: [],
})

export default {
  port: 3000,
  fetch: app.fetch,
}

Register your tools

Define each tool with a name, description, input schema, and a run function that implements your logic. The following shows two example tools for managing customer subscriptions.

import { tool } from "@a0dotrun/expose/tool"
import { subscription } from "@acme/lib/subscription"
import { z } from "zod"

const getCustomerSubscription = tool({
  name: "getCustomerSubscription",
  description: "Get subscription information for a customer",
  args: z.object({
      customer: z.string().uuid()
  }),
  run: async (input) => {
    // Your subscription logic here
    return input;
  },
});


const createCustomerSubscription = tool({
  name: "createCustomerSubscription",
  description: "Create a subscription for a customer",
  args: z.object({
      customer: z.string().uuid()
  }),
  run: async (input) => {
    // Your subscription logic here
    return input;
  },
});

const app = create({
  tools: [
    getCustomerSubscription,
    createCustomerSubscription,
  ],
});

Start server

Run the development server to start hosting your MCP tools. The server will listen on the configured port (default 3000). If you deploy, note the public URL for Claude to use.

npm run dev

Register in Claude desktop app

In Claude, register your MCP server so the client can reach it. The config path for Claude on macOS is a standard location containing MCP server configurations.

{
  ...
  "mcpServers": {
    "subscriptionManager": {
      "command": "/Users/acmeuser/.local/bin/expose-cli",
      "args": ["--url", "http://localhost:3000", "--timeout", "15"]
    }
  }
  ...
}

Notes

If you plan to expose your server publicly, replace localhost with your public URL and ensure your hosting setup secures the endpoint. You can deploy the server and then update the Claude config with the new URL.

Security and maintenance

Keep dependencies up to date and review your tool run logic for security considerations. Validate inputs strictly and avoid exposing sensitive internal operations through the MCP endpoint.

Troubleshooting

If Claude cannot reach the MCP endpoint, verify that the server is running, the port is accessible, and the URL configured in Claude matches the deployed endpoint. Check firewall rules and ensure the public URL, if used, is correctly routed to your server.

Available tools

getCustomerSubscription

Get subscription information for a customer

createCustomerSubscription

Create a subscription for a customer

Expose MCP Server - a0dotrun/expose