Skip to main content

Direct HTTP Connection

Call the ECGrid MCP Server directly over HTTP from any language or framework. No Node.js, no SDK, no local bridge.

Server Details

ItemValue
URLhttps://mcp.ecgrid.io/mcp
ProtocolMCP over HTTP (JSON-RPC 2.0)
AuthX-APIKey: YOUR_API_KEY_HERE
Acceptapplication/json, text/event-stream (required — 406 without it)
Response formatServer-Sent Events (SSE)

Quick Test — curl

curl -s -X POST https://mcp.ecgrid.io/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "X-APIKey: YOUR_API_KEY_HERE" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"connectivity_system_hello-world","arguments":{"request":{"name":"Test"}}}}'

Request Lifecycle

1. POST initialize → confirm protocol version
2. POST tools/list → discover available tools and their schemas
3. POST tools/call → call tools

The server is stateless — each request carries the full credential. No session token to manage.

Example

using System.Net.Http;
using System.Text;
using System.Text.Json;

var client = new HttpClient();
client.DefaultRequestHeaders.Add("X-APIKey", "YOUR_API_KEY_HERE");
client.DefaultRequestHeaders.Add("Accept", "application/json, text/event-stream");

var baseUrl = "https://mcp.ecgrid.io/mcp";

async Task<JsonElement> PostAsync(object payload)
{
var json = JsonSerializer.Serialize(payload);
var response = await client.PostAsync(baseUrl,
new StringContent(json, Encoding.UTF8, "application/json"));
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
// Step 1 — extract the data: line from the SSE envelope
var dataLine = body.Split('\n')
.FirstOrDefault(l => l.StartsWith("data: "))?.Substring(6) ?? body;
var envelope = JsonDocument.Parse(dataLine).RootElement;
// Step 2 — parse content[0].text as JSON to get the structured data
var resultText = envelope.GetProperty("result")
.GetProperty("content")[0].GetProperty("text").GetString()!;
return JsonDocument.Parse(resultText).RootElement;
}

var result = await PostAsync(new {
jsonrpc = "2.0", id = 1, method = "tools/call",
@params = new {
name = "connectivity_system_hello-world",
arguments = new { request = new { name = "My Agent" } }
}
});
Console.WriteLine(result);

See Also