DEV Community

Cover image for Remote MCP Servers: Connecting and Securing SaaS Tools
Kuldeep Paul
Kuldeep Paul

Posted on

Remote MCP Servers: Connecting and Securing SaaS Tools

Remote MCP Servers: Connecting and Securing SaaS Tools

TL;DR

  • Connecting remote MCP servers directly to local AI clients creates credential sprawl, audit blind spots, and unmonitored SaaS API access.
  • Deploying a dedicated gateway unifies remote tool connections over Server-Sent Events (SSE) and Streamable HTTP into a single authenticated interface.
  • Bifrost provides 11 microseconds of internal routing overhead at 5,000 requests per second while managing OAuth 2.0 handshakes, virtual keys, and request-level tool filtering.
  • Centralized policy enforcement prevents sensitive data exfiltration by inspecting tool arguments before payloads reach third-party SaaS infrastructure.

Connecting remote MCP servers directly to developer workstations introduces severe operational challenges, including exposed credentials, unversioned endpoints, and fragmented client configurations. Bifrost, an open-source AI gateway built by Maxim AI, solves this architectural problem by sitting between AI applications and distributed SaaS tools. Instead of managing individual connections inside every desktop client or coding agent, engineering teams route all tool discovery and execution through a single governed control plane. This article examines how remote MCP servers operate, the transport and security protocols that underpin them, and how to centralize tool management across enterprise environments.

What Are Remote MCP Servers and Why Do They Matter?

Remote MCP servers are standalone network services that implement the Model Context Protocol specification over standard web protocols, exposing tools, prompts, and resources to AI clients across network boundaries. Unlike local servers that execute as child subprocesses on an individual developer machine, a remote server runs inside cloud environments, Kubernetes clusters, or third-party SaaS infrastructure.

+-------------------+        JSON-RPC over HTTP/SSE        +------------------------+
|   AI Assistant    | -----------------------------------> |   Remote MCP Server    |
| (Claude, Cursor)  | <----------------------------------- | (Cloud SaaS / Hosting) |
+-------------------+                                      +------------------------+
                                                                       |
                                                                       v
                                                           +------------------------+
                                                           |   Upstream SaaS APIs   |
                                                           | (GitHub, Jira, Linear) |
                                                           +------------------------+
Enter fullscreen mode Exit fullscreen mode

When Anthropic introduced the Model Context Protocol, the initial ecosystem focused on local development. Engineers ran servers locally via standard input and output (stdio), spawning utilities directly from configuration files inside Claude Desktop or Cursor. While stdio works well for local file inspection and development scripts, it fails in shared enterprise environments. Teams cannot easily distribute updates to hundred-line JSON configuration files on individual laptops, nor can security administrators revoke access to database credentials stored in local plaintext files.

Remote servers resolve these distribution problems by decoupling tool definitions from client runtimes. A SaaS provider such as GitHub, Notion, or Linear can host a managed MCP endpoint that any authenticated client accesses over the internet. Development teams receive real-time schema updates without reinstalling local binaries or updating local packages. Furthermore, because the execution environment sits in the cloud, remote servers can maintain persistent database connections, orchestrate distributed microservices, and scale compute resources independently of client hardware.

However, moving tool execution from local subprocesses to remote network endpoints fundamentally transforms tool calling into a distributed systems problem. AI clients now communicate over untrusted networks, requiring standardized transport layers, robust authentication, and low-latency proxying.

Transport Protocols: Comparing Stdio, SSE, and Streamable HTTP

The Model Context Protocol specification defines clear transport mechanisms to standardize how clients and servers exchange JSON-RPC 2.0 messages across process and network boundaries. Choosing the appropriate transport determines connection reliability, firewall compatibility, and operational complexity.

Dimension Standard Input / Output (stdio) Server-Sent Events (SSE) Streamable HTTP
Network Scope Local machine only Network / Internet Network / Internet
Connection Model Subprocess pipe (stdin/stdout) Dual-endpoint (GET for SSE, POST for data) Single-endpoint bi-directional HTTP
Firewall / Proxy Fit Not applicable Moderate (requires persistent HTTP connections) High (standard HTTP/1.1 and HTTP/2 semantics)
Authentication Environment variables, local files HTTP headers, Bearer tokens, OAuth HTTP headers, Bearer tokens, OAuth
State Handling Tied to process lifecycle Stateful session IDs across dual endpoints Stateless or session-header driven
Target Workload Local CLI tools, desktop exploration Cloud servers (legacy specification) Modern SaaS-hosted MCP infrastructure

The earliest implementations of remote MCP servers relied on Server-Sent Events (SSE). Under the original HTTP with SSE specification, an MCP client initiates an HTTP GET request to an /sse endpoint, establishing a persistent downstream connection over which the server streams JSON-RPC notifications and tool responses. To send requests back to the server, the client must transmit separate HTTP POST requests to a distinct /messages endpoint, passing a session identifier generated during the SSE handshake.

While functional, this dual-endpoint architecture introduces significant operational friction. Long-lived SSE connections frequently drop when traversing enterprise load balancers, corporate forward proxies, and serverless edge gateways with aggressive timeout policies. If the downstream SSE stream disconnects during a multi-step tool sequence, in-flight responses can be lost, leaving the AI model waiting indefinitely for a tool result.

To resolve these transport limitations, modern remote MCP architectures have moved toward Streamable HTTP. Streamable HTTP consolidates client-server communication into a single unified endpoint using standard HTTP POST and GET methods. Clients send JSON-RPC calls as standard HTTP POST payloads, receiving responses directly in the HTTP response stream or via chunked transfer encoding. This design allows remote MCP servers to deploy seamlessly on serverless runtimes like AWS Lambda or Cloudflare Workers, eliminates the fragility of dual-connection session tracking, and simplifies traversal through corporate web application firewalls.

Two contrasting communication channels across a digital network, one depicting a bifurcated dual pipeline with intermitt

Security Risks of Direct Client-to-SaaS MCP Connections

Connecting client applications directly to third-party remote MCP servers creates acute security vulnerabilities that can compromise corporate infrastructure and confidential business records. Without an intermediary security layer, security teams lose both visibility and enforcement capability.

1. Credential Sprawl and Identity Blind Spots

When individual developers connect their IDEs or desktop assistants to SaaS-hosted MCP servers, each client must hold authentication credentials. In practice, this leads to static API keys, personal access tokens, or long-lived service account secrets stored in unencrypted configuration files on employee laptops. If a workstation is compromised, attackers gain immediate access to all upstream SaaS tools configured in that environment.

2. Lack of Fine-Grained Authorization

Most remote servers offer all-or-nothing authorization. When a developer connects an AI agent to an enterprise issue tracker or cloud provider MCP server, the agent inherits all tools exposed by that server. A software engineer using an AI assistant to read Jira tickets might inadvertently grant the model access to delete projects or modify sprint permissions because the client configuration cannot selectively filter out destructive tools.

3. Prompt Injection and Tool Hijacking

Remote tools act as actuators that interact with internal business systems. If an AI agent processes untrusted input, such as a malicious pull request or an external customer support email, an indirect prompt injection attack can trick the model into executing privileged remote tools. Without real-time argument inspection, an injected prompt can command the remote server to exfiltrate private source code or execute unauthorized database updates.

4. Zero Audit Trails and Compliance Failures

Regulated industries subject to SOC 2, HIPAA, or GDPR cannot permit unmonitored external network traffic. Direct client-to-server connections leave audit logs fragmented across dozens of individual developer laptops and proprietary third-party logs. Compliance officers cannot determine which developer executed a specific tool call, what parameters were supplied, or what sensitive customer data was returned in the response payload.

Architecture of an MCP Gateway: Centralizing Tool Execution

An MCP gateway addresses these security and operational risks by introducing a centralized proxy and policy engine between client agents and remote MCP servers. Rather than maintaining point-to-point connections, all AI clients interface exclusively with the gateway.

Bifrost implements this pattern by functioning simultaneously as an MCP client and an MCP server. On the downstream side, Bifrost acts as a server, exposing a single unified endpoint (/mcp) that accepts standard JSON-RPC connections from client applications such as Claude Code, Cursor, Codex CLI, and custom agents. On the upstream side, Bifrost acts as a client, establishing and maintaining connections to diverse remote MCP servers across the internet.

+-------------------+
|    Claude Code    | \
+-------------------+  \
+-------------------+   \     JSON-RPC / Virtual Key
|      Cursor       | ----> +------------------------+
+-------------------+   /   |   Bifrost MCP Gateway  |
+-------------------+  /    |  (Routing & Policies)  |
| Custom Agent SDK  | /     +------------------------+
+-------------------+                   |
                                        | Upstream Transports
                                        | (Streamable HTTP, SSE, stdio)
                    +-------------------+-------------------+
                    |                   |                   |
                    v                   v                   v
          +-------------------+ +-------------------+ +-------------------+
          | Remote SaaS MCP 1 | | Remote SaaS MCP 2 | | Internal Micro-   |
          | (GitHub / Git)    | | (Jira / Linear)   | | service MCP       |
          +-------------------+ +-------------------+ +-------------------+
Enter fullscreen mode Exit fullscreen mode

When Bifrost connects to an upstream remote MCP server, it automatically runs the protocol handshake, executes tool discovery via tools/list, and caches the schemas in memory. It aggregates schemas from all connected remote servers, deduplicates conflicting tool definitions, and presents a consolidated catalog to downstream clients.

Beyond connection pooling, an enterprise MCP gateway transforms how models orchestrate complex tool calls. In standard tool calling, an AI model executes tools sequentially: the model issues a call, waits for the client to execute it over the network, inspects the returned text, and then generates the next call. This conversational ping-pong consumes substantial context window tokens and introduces significant network latency.

To eliminate this overhead, Bifrost introduces Code Mode. Instead of generating separate JSON tool calls for each step, the language model writes an executable Python or TypeScript script that invokes multiple remote MCP tools within a single sandbox execution pass. According to published technical benchmarks, Code Mode delivers up to 50% lower token consumption and 40% faster overall execution by executing intermediate data filtering directly on the gateway infrastructure rather than sending bulky intermediate payloads back and forth to the model context window.

Managing Authentication: OAuth 2.0, Virtual Keys, and Federated Identity

Authentication represents one of the most complex operational hurdles when managing remote MCP servers at scale. Different SaaS providers implement disparate authorization models, ranging from static bearer tokens to complex OAuth 2.0 flows with dynamic client registration.

Bifrost centralizes identity management through a dual-sided authentication model:

Downstream Authentication via Virtual Keys

Downstream AI clients authenticate to Bifrost using virtual keys. A virtual key is an opaque, gateway-managed credential that encapsulates consumer identity, rate limits, spending budgets, and tool access policies. Individual developers configure their local IDE or CLI tool once with a single virtual key. The developer never receives or manages the underlying credentials for upstream SaaS systems.

# Connecting Claude Code to Bifrost using a Virtual Key
claude mcp add-json bifrost '{
  "type": "http",
  "url": "https://gateway.internal.net/mcp",
  "headers": {
    "Authorization": "Bearer vk_live_7f8a9c2b4e1d"
  }
}'
Enter fullscreen mode Exit fullscreen mode

Upstream Authentication to Remote SaaS Providers

Upstream from the gateway, Bifrost manages the authentications required by remote MCP servers:

  1. Static Bearer and API Key Headers: For remote servers secured by static secrets, Bifrost injects the required authorization headers during request forwarding. Upstream secrets are stored in enterprise key management systems rather than distributed to end users.
  2. OAuth 2.0 with PKCE: When interacting with multi-tenant SaaS providers like GitHub or Salesforce, Bifrost manages the full OAuth 2.0 lifecycle. It handles initial authorization redirects, token exchanges using Proof Key for Code Exchange (PKCE), and automatic background token refreshes before access tokens expire.
  3. Federated Authentication: In enterprise environments, Bifrost Enterprise supports MCP with federated auth, allowing existing REST APIs and internal microservices to be converted into governed MCP endpoints without rewriting underlying authentication layers. Identity assertions from Okta, Microsoft Entra ID, or Google Workspace map directly into upstream tool execution contexts.

Tool Filtering, Access Control, and Guardrail Enforcement

Centralizing remote MCP traffic through a gateway enables granular policy enforcement that is impossible to achieve with direct client connections. Rather than exposing every upstream tool to every user, administrators enforce the principle of least privilege.

Incoming Request (Virtual Key: DataScienceTeam)
                       |
                       v
         +---------------------------+
         |  Virtual Key Tool Filter  | ---> Drops unauthorized tools:
         |  (Strict Allowlists)      |      [github_delete_repo, drop_table]
         +---------------------------+
                       |
                       v
         +---------------------------+
         |   Enterprise Guardrails   | ---> Scans prompt arguments for PII,
         |   (Gitleaks / PII Regex)  |      secrets, and SQL injection
         +---------------------------+
                       |
                       v
         Forwarded to Remote SaaS MCP Servers
Enter fullscreen mode Exit fullscreen mode

Granular Tool Filtering

Through MCP tool filtering, Bifrost restricts which tools are visible and executable based on the client's virtual key. In enterprise deployments, security teams configure MCP tool groups, defining logical clusters of permissions such as "Read-Only GitHub", "Production Database Admin", or "Support Ticket Reader".

If a machine learning engineer queries the gateway using a virtual key assigned to "Support Ticket Reader", Bifrost dynamically strips administrative tools from the schema returned during the tools/list handshake. Because the language model never sees the schemas for unauthorized tools, it cannot attempt to invoke them, eliminating unauthorized execution attempts at the source.

Argument Guardrails and Content Safety

Even when a tool call is authorized, the parameters supplied to that tool must be validated. Remote tools that query internal databases or external APIs are susceptible to prompt injection payloads that attempt data exfiltration.

Bifrost enforces enterprise guardrails directly on tool execution payloads. Before an outgoing tool call is dispatched to a remote MCP server, the gateway scans the arguments using native Gitleaks-backed secrets detection, custom regex patterns, and integrations with external content safety engines like AWS Bedrock Guardrails and Azure Content Safety. If an AI agent attempts to pass an unencrypted private key or customer social security number to a third-party remote server, the gateway blocks the request and triggers a security alert.

Beyond gateway-level routing, Bifrost applies governance and security controls (virtual keys, budgets, guardrails, audit logs) centrally, and Bifrost Edge extends that same governance and security to AI traffic on employee machines, with endpoint enforcement on each device. While currently in alpha, Bifrost Edge ensures that coding assistants, desktop applications, and browser tools adhere to organizational app governance and MCP governance rules without requiring individual developers to configure custom proxy settings manually.

A multi-layered cryptographic filtering gateway inspecting and sorting glowing data packets, allowing valid structural c

Step-by-Step Configuration: Connecting a Remote Server Through Bifrost

Deploying a governed gateway between client applications and remote MCP servers requires three straightforward configuration steps: deploying the gateway, registering upstream servers, and pointing clients to the proxy endpoint.

Step 1: Deploy Bifrost

Bifrost deploys as a lightweight Go binary, a container image, or a native Kubernetes pod. In sustained benchmarks at 5,000 requests per second, the gateway adds only 11 microseconds of internal routing overhead.

To launch Bifrost locally using the command line:

# Run Bifrost locally using npx
npx -y @maximhq/bifrost
Enter fullscreen mode Exit fullscreen mode

For production deployments, configure Bifrost within your VPC using Docker or Helm, ensuring that network egress permits outbound HTTPS traffic to your target SaaS MCP endpoints.

Step 2: Register Upstream Remote MCP Servers

Upstream servers can be registered through the Bifrost web dashboard or defined statically inside config.json. The configuration specifies the upstream transport (Streamable HTTP or SSE), the remote URL, and any required authentication credentials.

{
  "mcp_servers": {
    "github_remote": {
      "transport": "http",
      "url": "https://mcp.github.internal/tools",
      "headers": {
        "Authorization": "Bearer env.GITHUB_SERVICE_TOKEN"
      },
      "timeout_seconds": 30
    },
    "linear_saas": {
      "transport": "sse",
      "url": "https://mcp.linear.app/sse",
      "auth": {
        "type": "oauth2",
        "client_id": "env.LINEAR_CLIENT_ID",
        "client_secret": "env.LINEAR_CLIENT_SECRET",
        "scopes": ["read", "write:issues"]
      }
    }
  },
  "governance": {
    "virtual_keys": [
      {
        "name": "developer_key",
        "key": "vk_dev_8849201934",
        "allowed_mcp_tools": [
          "github_remote:get_issue",
          "github_remote:list_pull_requests",
          "linear_saas:search_issues"
        ],
        "rate_limits": {
          "requests_per_minute": 60
        }
      }
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

In this configuration, Bifrost connects to both a Streamable HTTP server and an SSE server. It defines a virtual key (vk_dev_8849201934) that enforces a strict allowlist: developers using this key can search and read issues, but cannot invoke destructive repository management tools.

Step 3: Configure AI Clients

Developers configure their local AI applications to target the Bifrost gateway rather than connecting directly to the SaaS endpoints. Because Bifrost exposes a standard MCP interface, client configuration requires only the gateway URL and the assigned virtual key.

For Cursor, developers add the gateway inside ~/.cursor/mcp.json:

{
  "mcpServers": {
    "enterprise_gateway": {
      "url": "https://gateway.company.internal/mcp",
      "headers": {
        "Authorization": "Bearer vk_dev_8849201934"
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

For applications utilizing the OpenAI SDK or Anthropic SDK to build autonomous agents, developers route chat completions directly through Bifrost's OpenAI-compatible proxy. Bifrost inspects the request, automatically injects the permitted MCP tool schemas into the model prompt, and handles tool execution upstream when the model returns a tool call.

from openai import OpenAI

# Initialize client pointing to the Bifrost gateway
client = OpenAI(
    base_url="https://gateway.company.internal/v1",
    api_key="vk_dev_8849201934"
)

# Bifrost automatically injects governed remote MCP tools
response = client.chat.completions.create(
    model="anthropic/claude-3-5-sonnet",
    messages=[
        {"role": "user", "content": "Check Linear for high-priority bugs assigned to me."}
    ],
    extra_body={
        "mcp_mode": "agent"  # Enables automatic execution of permitted tools
    }
)

print(response.choices[0].message.content)
Enter fullscreen mode Exit fullscreen mode

Production Observability and Audit Logging

Operating remote MCP servers in enterprise environments requires complete visibility into tool execution latencies, failure rates, and payload contents. When a remote SaaS tool fails or returns an error, engineering teams must isolate whether the failure originated in the model prompt, the gateway routing layer, or the upstream SaaS infrastructure.

Bifrost includes native observability features that record every tool call lifecycle event:

  • Immutable Audit Trails: For compliance standards including SOC 2, HIPAA, and ISO 27001, Bifrost generates audit logs detailing the invoking virtual key, client IP address, target tool name, input arguments, execution duration, and response status.
  • Payload Redaction: To satisfy data privacy regulations, administrators can toggle sensitive content redaction. Gateway policies capture request metadata and execution metrics while masking PII, passwords, and sensitive arguments before logs are persisted.
  • OpenTelemetry and Prometheus Metrics: Bifrost exports native Prometheus metrics for tool call frequency, error counts (such as HTTP 5xx responses from upstream servers), and execution latency. Distributed tracing spans integrate directly with APM tools like Datadog, Grafana, and New Relic, tracing an agent call from the initial client prompt through the gateway to the remote SaaS endpoint.

By reviewing centralized metrics, engineering leaders can monitor third-party SaaS availability, identify slow tools that degrade agent performance, and maintain an authoritative record of all automated actions executed within enterprise systems.

Frequently Asked Questions

What is the difference between a local and a remote MCP server?

A local MCP server runs on the same machine as the AI client, communicating via standard input/output (stdio) subprocesses. A remote MCP server runs on an external server or cloud infrastructure, communicating across networks using web protocols such as Streamable HTTP or Server-Sent Events (SSE).

Why is the MCP community shifting from SSE to Streamable HTTP?

Server-Sent Events require two separate connections: a persistent GET stream for downstream server messages and a POST endpoint for upstream client requests. Streamable HTTP consolidates communication into standard bidirectional HTTP POST and GET requests, which handles timeouts better, simplifies serverless hosting, and scales more reliably through corporate proxies.

How does an MCP gateway prevent prompt injection attacks against remote tools?

An MCP gateway applies input validation and content guardrails before tool calls are dispatched to remote servers. It evaluates arguments against regex patterns and security policies, blocking malicious payloads or sensitive data leaks before the request reaches the external tool.

Can an MCP gateway convert REST APIs into remote MCP servers?

Yes. Using Bifrost Enterprise with federated authentication, organizations can expose existing internal REST APIs as governed MCP tools. The gateway handles schema generation, parameter formatting, and credential injection without requiring teams to write custom MCP server wrappers.

What happens if an upstream remote MCP server goes offline?

When a remote server becomes unavailable, Bifrost catches the connection failure, generates a standardized JSON-RPC error response, and prevents the client from hanging. Gateway fallbacks allow administrators to route around failed endpoints or notify the language model gracefully so it can choose an alternate tool.

Can different teams access different remote MCP tools through the same gateway?

Yes. Bifrost uses virtual keys to enforce granular tool filtering. Administrators create distinct virtual keys for different teams or projects, configuring strict allowlists that restrict each key to specific remote MCP servers and individual tool functions.

How does Code Mode reduce costs when executing remote MCP tools?

Standard MCP tool calling requires conversational round-trips for every single tool invocation, consuming input and output tokens on each step. Bifrost Code Mode allows the model to write a programmatic script that executes multiple tools in a single pass, filtering intermediate data and reducing token consumption by up to 50%.

Sources

Top comments (0)