Documentation / MCP Servers

MCP Servers

Expose, discover, and connect to Model Context Protocol servers through stunl

Overview

The stunl mcp subcommand lets you share local MCP servers with your team through secure tunnels. Expose a local MCP server, browse available servers, or connect Claude Desktop to a remote MCP server -- all with a single command.

Requires an agent key (st_agent_ prefix) from your team settings in the portal.

Quick Start

1

Expose your MCP server

$ stunl mcp expose -port 8080 -name "my-tools"

  Probing MCP server at localhost:8080/mcp...
  Found 5 tools, 2 resources, 1 prompt

  ● MCP Server exposed

  ╭── ◎ ── MCP
  │   Name      my-tools
  │   URL       https://my-tools.mcp.stunl.io/mcp
  │   Protocol  streamable-http
  │   Tools     5 | Resources 2 | Prompts 1
2

List available servers

$ stunl mcp list

  NAME          TOOLS  RESOURCES  OWNER
  my-tools      5      2          val
  db-query      3      0          alice
  code-search   8      1          bob
3

Connect from Claude Desktop

$ stunl mcp connect my-tools
# Bridges stdio (JSON-RPC) to the remote MCP server

Subcommands

stunl mcp expose

Exposes a local MCP server through a tunnel. On startup, stunl probes your server by calling initialize, tools/list, resources/list, and prompts/list to discover capabilities. It then creates a tunnel and registers the server with the portal API. A heartbeat is sent every 30 seconds to keep the registration alive.

Flag Default Description
-port required Port your MCP server listens on
-name required Name for your MCP server
-description Human-readable description
-path /mcp HTTP path for the MCP endpoint
-protocol streamable-http sse or streamable-http
-visibility team team, private, or public
-subdomain Custom subdomain for the tunnel
-domain Custom domain for the tunnel
-key Agent key (or set STUNL_API_KEY)
stunl mcp list

Lists all MCP servers currently exposed by your team. Shows server name, number of tools, resources, and owner. Requires an agent key.

stunl mcp connect

A stdio-to-HTTP bridge designed for Claude Desktop integration. Reads JSON-RPC messages from stdin, POSTs them to the remote MCP server, and writes responses to stdout.

Takes a server name (resolved via the portal) or a --url flag for direct connection.

How It Works

┌─────────────┐    stdio     ┌───────────┐    HTTPS    ┌────────────┐   gRPC   ┌────────────────┐
│   Claude    │ ◄──────────► │  stunl    │ ◄────────► │   stunl    │ ◄──────► │  stunl client  │
│   Desktop   │   JSON-RPC   │  connect  │            │   server   │          │  (mcp expose)  │
└─────────────┘              └───────────┘            └────────────┘          └───────┬────────┘
                                                                                     │
                                                                              ┌──────▼───────┐
                                                                              │  Local MCP   │
                                                                              │  Server      │
                                                                              └──────────────┘

Claude Desktop Configuration

Add the following to your Claude Desktop configuration file to connect to a team MCP server.

claude_desktop_config.json
{
  "mcpServers": {
    "my-tools": {
      "command": "stunl",
      "args": ["mcp", "connect", "my-tools"],
      "env": {
        "STUNL_API_KEY": "st_agent_xxx"
      }
    }
  }
}
Direct URL connection
{
  "mcpServers": {
    "custom-server": {
      "command": "stunl",
      "args": ["mcp", "connect", "--url", "https://my-tools.mcp.stunl.io/mcp"]
    }
  }
}

Examples

Expose with SSE protocol and custom description
$ stunl mcp expose -port 3001 -name "db-tools" \
    -protocol sse -description "Database query and schema tools"
Private server with custom subdomain
$ stunl mcp expose -port 8080 -name "private-tools" \
    -visibility private -subdomain my-private-mcp
Custom MCP endpoint path
$ stunl mcp expose -port 9000 -name "api-tools" -path /api/mcp

Next Steps