Connect to Remote MCP Servers
Remote MCP servers extend AI capabilities beyond your local environment, providing access to internet-hosted tools, services, and data sources.
Understanding Remote Servers
Remote MCP servers are hosted on the internet rather than your local machine. They offer several advantages:
| Feature | Local Servers | Remote Servers |
|---|---|---|
| Accessibility | Single device | Any device with internet |
| Setup | Install per device | One-time connection |
| Maintenance | Manual updates | Server-side updates |
| Use Case | Local resources | Cloud services, APIs |
Connection Methods
Method 1: Claude Web (Custom Connectors)
The Claude web interface provides built-in support for remote MCP servers through Custom Connectors.
Steps to Connect
Navigate to Settings
- Go to claude.ai
- Click your profile icon → Settings → Connectors
Add Custom Connector
- Scroll to “Add custom connector”
- Enter the remote server URL
- Click “Add”
Complete Authentication
- Follow the server’s authentication flow
- May involve OAuth, API keys, or username/password
Configure Permissions
- Review available tools
- Enable only the tools you need
- Set appropriate usage limits
Method 2: Claude Desktop (SSE Transport)
For desktop applications, configure remote servers using Server-Sent Events transport:
{
"mcpServers": {
"remote-server": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/inspector",
"https://your-server.example.com/sse"
]
}
}
}Method 3: Custom Client Implementation
Build a custom MCP client that connects to remote servers:
from mcp.client.sse import SseClientTransport
from mcp import ClientSession
async def connect_to_remote(server_url: str):
# Create SSE transport for remote connection
transport = SseClientTransport(server_url)
# Initialize session
async with ClientSession(transport) as session:
await session.initialize()
# List available tools
tools = await session.list_tools()
return toolsSecurity Considerations
Verify Server Authenticity
Before connecting to any remote MCP server:
- Check the source: Only connect to servers from trusted developers
- Review the code: For open-source servers, review the implementation
- Check permissions: Understand what tools the server exposes
- Test in safe environment: Try non-sensitive operations first
Authentication Best Practices
| Auth Type | Use Case | Security Level |
|---|---|---|
| API Keys | Simple integrations | Medium |
| OAuth 2.0 | Third-party services | High |
| JWT Tokens | Enterprise applications | High |
| mTLS | High-security environments | Very High |
Data Privacy
- Review data handling: Understand what data the server processes
- Check encryption: Ensure HTTPS/TLS is used
- Audit logs: Monitor server activity
- Set usage limits: Prevent excessive API calls
Common Remote Server Use Cases
Project Management Integration
Connect to services like Jira, Asana, or Linear:
{
"mcpServers": {
"jira": {
"command": "node",
"args": ["./jira-server/build/index.js"],
"env": {
"JIRA_URL": "https://your-domain.atlassian.net",
"JIRA_EMAIL": "[email protected]",
"JIRA_API_TOKEN": "your-api-token"
}
}
}
}Documentation Access
Connect to Confluence, Notion, or GitBook:
# Example: Notion MCP server connection
config = {
"server_url": "https://notion-mcp.example.com",
"auth": {
"type": "bearer_token",
"token": os.getenv("NOTION_INTEGRATION_TOKEN")
}
}Code Repository Integration
Connect to GitHub, GitLab, or Bitbucket:
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "your-github-token",
"GITHUB_REPOSITORY": "owner/repo"
}
}
}
}Troubleshooting Remote Connections
Connection Failures
Symptoms: Server won’t connect or times out
Solutions:
- Verify the server URL is correct and accessible
- Check network connectivity and firewall settings
- Ensure the server is currently running
- Review authentication credentials
Authentication Errors
Symptoms: 401 Unauthorized or invalid token errors
Solutions:
- Verify API keys or tokens are current
- Check token permissions and scopes
- Ensure OAuth flow completed successfully
- Regenerate credentials if needed
Tool Execution Failures
Symptoms: Tools fail or return unexpected errors
Solutions:
- Check server logs for detailed error messages
- Verify required parameters are provided
- Ensure proper authentication scope
- Test tools independently
Building a Remote Server
To host your own remote MCP server:
Basic Server Structure
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
import express from "express";
const app = express();
const server = new Server({
name: "my-remote-server",
version: "1.0.0"
});
// Register tools
server.registerTool(
"my_tool",
{
description: "Description of my tool",
inputSchema: {
type: "object",
properties: {
param: { type: "string" }
}
}
},
async ({ param }) => {
// Tool implementation
return { content: [{ type: "text", text: "Result" }] };
}
);
// SSE endpoint
app.get("/sse", async (req, res) => {
const transport = new SSEServerTransport("/message", res);
await server.connect(transport);
});
app.listen(3000, () => {
console.log("Remote MCP server running on port 3000");
});Deployment Considerations
| Aspect | Recommendation |
|---|---|
| Hosting | Use reliable cloud provider (AWS, GCP, Azure) |
| Scaling | Implement horizontal scaling with load balancer |
| Monitoring | Track metrics: latency, error rates, usage |
| Security | Implement rate limiting and authentication |
| Logging | Centralized logging for debugging |
Best Practices
- Start Local, Go Remote: Develop and test locally before deploying remotely
- Graceful Degradation: Handle network failures gracefully
- Caching: Implement caching to reduce API calls
- Rate Limiting: Respect API quotas and implement client-side limits
- Documentation: Clearly document available tools and parameters
- Version Management: Use semantic versioning for server updates