Edgewatch MCP Client Guide
1.0.0 MCP 3.0

This is a comprehensive guide for connecting to and using the Edgewatch MCP (Model Context Protocol) server to get insights about IP addresses using the official MCP SDK. The guide provides detailed instructions for authentication, connection setup, and tool usage with practical examples and best practices.

🔐 Access Notice

To use the Edgewatch MCP server, you must obtain a client-id and client-secret. Please send an email to support@edgewatch.com with the subject "MCP-Access-Request". We will provide you with credentials. Access is currently free during the testing phase. In the future, only Edgewatch clients will have token-based access to the MCP server.

Server URL: mcp.edgewatch.com
Protocol: MCP (Model Context Protocol)
Available Tools: IP Insights and IP Explorer

Install the required dependencies:

npm install @modelcontextprotocol/sdk zod

Parameters

{ "name": "getInsight", "parameters": { "ip": "string" // The IP address to get insights for } }

Parameters

{ "name": "getExplorer", "parameters": { "ip": "string" // The IP address to explore } }

To connect to the MCP server, you must authenticate using your client-id and client-secret. These credentials must be included in your requests as HTTP headers or as query parameters. The server will validate your credentials before allowing access to any tools or data.

Authentication Methods

Header method: x-client-id and x-client-secret
Query parameter method: ?clientId=...&clientSecret=...

If authentication fails, you will receive a 401 or 403 error with details. If you do not have credentials, request them by emailing support@edgewatch.com.

Example (using headers):

fetch('https://mcp.edgewatch.net/mcp', { method: 'GET', headers: { 'x-client-id': 'YOUR_CLIENT_ID', 'x-client-secret': 'YOUR_CLIENT_SECRET' } });

Example (using query parameters):

https://mcp.edgewatch.net/mcp?clientId=YOUR_CLIENT_ID&clientSecret=YOUR_CLIENT_SECRET

Once authenticated, you can establish an SSE (Server-Sent Events) connection and interact with the MCP tools as described below.

1. Import Required Components

import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; import { z } from 'zod';

2. Create and Configure the Client

const client = new Client({ name: 'your-client-name', version: '1.0.0' }); // Set up error handler client.onerror = (error) => { console.error('Client error:', error); };

3. Connect to the Server

The client will automatically try both transport methods:

// Try Streamable HTTP transport first try { const transport = new StreamableHTTPClientTransport(new URL(serverUrl)); await client.connect(transport); console.log('Connected using Streamable HTTP transport'); } catch (error) { // Fall back to SSE transport const transport = new SSEClientTransport(new URL(serverUrl)); await client.connect(transport); console.log('Connected using SSE transport'); }

4. Call Tools

Use the client to call tools with proper response validation:

// Example: Get insights for an IP address const result = await client.request({ method: 'tools/call', params: { name: 'getInsight', arguments: { ip: '8.8.8.8' } } }, z.object({ content: z.array(z.object({ type: z.literal('text'), text: z.string() })) })); // Process the result result.content.forEach(item => { if (item.type === 'text') { console.log(item.text); } });

To configure a client application (like Claude Desktop) to use the MCP server, add the following configuration:

{ "mcpServers": { "ewmcp-server": { "url": "https://mcp.edgewatch.net/mcp", "name": "ewmcp-server", "version": "1.0.0" } } }

This configuration tells the client application:

Where to find the MCP server: url
What name to use for the server: name
Which version of the server to use: version

import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js'; import { z } from 'zod'; async function connectToServer(serverUrl) { const client = new Client({ name: 'ewmcp-client', version: '1.0.0' }); client.onerror = (error) => { console.error('Client error:', error); }; try { // Try Streamable HTTP transport first const transport = new StreamableHTTPClientTransport(new URL(serverUrl)); await client.connect(transport); console.log('Connected using Streamable HTTP transport'); return { client, transport }; } catch (error) { // Fall back to SSE transport const transport = new SSEClientTransport(new URL(serverUrl)); await client.connect(transport); console.log('Connected using SSE transport'); return { client, transport }; } } async function getIPInsights(client, ip) { const result = await client.request({ method: 'tools/call', params: { name: 'getInsight', arguments: { ip } } }, z.object({ content: z.array(z.object({ type: z.literal('text'), text: z.string() })) })); return result.content[0].text; } // Example usage async function main() { try { const { client, transport } = await connectToServer('https://mcp.edgewatch.net/mcp'); const insights = await getIPInsights(client, '8.8.8.8'); console.log('IP Insights:', insights); await transport.close(); } catch (error) { console.error('Error:', error); } } main();

Always handle connection errors and timeouts
Implement retry logic for failed requests
Cache responses when appropriate
Validate IP addresses before sending requests
Implement rate limiting on the client side
Always close the transport when done
Use proper response validation with Zod schemas

The client will handle errors in the following ways:

Connection errors will be caught and logged
Tool request errors will be thrown with detailed messages
Response validation errors will be caught and logged

For additional support or questions, please contact the Edgewatch support team at support@edgewatch.com