Skip to content

Agent Mesh

feat: Implement unauthenticated HTTP MCP server and remove stdio transport

Antonio Ojeab93c7397cbec
diff --git a/.github/k8s/sam-node-cop-template.yaml b/.github/k8s/sam-node-cop-template.yaml
index e2730f66..73c94667 100644
--- a/.github/k8s/sam-node-cop-template.yaml
+++ b/.github/k8s/sam-node-cop-template.yaml
@@ -46,7 +46,7 @@ spec:
python -u /app/banana_bot_playground.py
env:
- name: SAM_MCP_URL
- value: "http://127.0.0.1:8080/mcp/events"
+ value: "http://127.0.0.1:8080/mcp"
- name: SAM_API_TOKEN
value: "secret-token"
- name: GEMINI_API_KEY
diff --git a/.github/k8s/sam-node-openclaw-template.yaml b/.github/k8s/sam-node-openclaw-template.yaml
index 2f02ce32..0ce717d1 100644
--- a/.github/k8s/sam-node-openclaw-template.yaml
+++ b/.github/k8s/sam-node-openclaw-template.yaml
@@ -27,7 +27,7 @@ data:
"servers": {
"sam-mesh": {
"enabled": true,
- "url": "http://127.0.0.1:8080/mcp/events"
+ "url": "http://127.0.0.1:8080/mcp"
}
}
}
@@ -74,7 +74,7 @@ spec:
) >/dev/null 2>&1 </dev/null &
env:
- name: SAM_MCP_URL
- value: "http://127.0.0.1:8080/mcp/events"
+ value: "http://127.0.0.1:8080/mcp"
- name: OPENCLAW_STATE_DIR
value: "/data"
- name: OPENCLAW_GATEWAY_TOKEN
diff --git a/.github/workflows/kind-mesh-e2e.yml b/.github/workflows/kind-mesh-e2e.yml
index 86e702ea..320a3a53 100644
--- a/.github/workflows/kind-mesh-e2e.yml
+++ b/.github/workflows/kind-mesh-e2e.yml
@@ -71,7 +71,7 @@ jobs:
- name: Mesh info, discover, find + call calculator
run: |
set -euo pipefail
- URL=http://127.0.0.1:9099/mcp/events
+ URL=http://127.0.0.1:9099/mcp
mcp() { ./bin/mcp-client -url "$URL" -timeout 20 "$@" 2>/dev/null; }
echo "== get_mesh_info =="
diff --git a/cmd/mcp-client/main.go b/cmd/mcp-client/main.go
index d4dab672..c7e44bf5 100644
--- a/cmd/mcp-client/main.go
+++ b/cmd/mcp-client/main.go
@@ -72,7 +72,7 @@ func main() {
}
// Construct URL
- baseURL := strings.TrimSuffix(*serverURL, "/mcp/events")
+ baseURL := strings.TrimSuffix(*serverURL, "/mcp")
baseURL = strings.TrimSuffix(baseURL, "/")
if !strings.Contains(baseURL, "/sam/service/discover") {
baseURL = baseURL + "/sam/service/discover"
diff --git a/cmd/sam-node/main.go b/cmd/sam-node/main.go
index 7991d175..9c8b9156 100644
--- a/cmd/sam-node/main.go
+++ b/cmd/sam-node/main.go
@@ -182,7 +182,20 @@ func main() {
if jwtStr == "" {
token, _ := store.LoadIdentity()
if len(token) == 0 {
- logger.Fatal("No JWT or stored identity found. Cannot authenticate.")
+ displayHub := hubAddr
+ if displayHub == "" {
+ if h, err := store.LoadHubURL(); err == nil && h != "" {
+ displayHub = h
+ } else {
+ displayHub = "https://bananas.sam-mesh.dev"
+ }
+ }
+ logger.Infof("No identity found. Starting unauthenticated sidecar for enrollment over MCP...")
+ if err := startUnauthSidecarServer(displayHub, bindAddrFlag, tlsCertFlag, tlsKeyFlag); err != nil {
+ logger.Fatalf("Failed to start unauthenticated sidecar: %v", err)
+ }
+ <-ctx.Done()
+ return
}
logger.Infoln("Using stored identity.")
@@ -554,7 +567,7 @@ func resolveDataDir() string {
func getOrGenerateKey(s *Store) crypto.PrivKey {
kb, _ := s.LoadKey()
if len(kb) == 0 {
- fmt.Println("[Store] Generating new Peer Identity...")
+ logger.Info("[Store] Generating new Peer Identity...")
priv, _, err := crypto.GenerateKeyPair(crypto.Ed25519, -1)
if err != nil {
logger.Fatalf("Failed to generate key: %v", err)
@@ -667,6 +680,6 @@ func (n *SamNode) Enroll(ctx context.Context, jwt string) error {
return fmt.Errorf("failed to connect and authenticate with any hub after HTTP enrollment (last error: %v)", lastAuthErr)
}
- fmt.Println("Successfully enrolled via HTTP and stored identity and hub config.")
+ logger.Info("Successfully enrolled via HTTP and stored identity and hub config.")
return nil
}
diff --git a/cmd/sam-node/mcp.go b/cmd/sam-node/mcp.go
index 461cfc49..6790efa9 100644
--- a/cmd/sam-node/mcp.go
+++ b/cmd/sam-node/mcp.go
@@ -46,9 +46,8 @@ Other useful tools: discover_remote_services browses services by type, get_mesh_
Remote tool names are namespaced as '<service>.<tool>' (e.g. 'code-reviewer.review_pr'). Prefer discovering and describing a tool before calling it rather than guessing arguments.`
-// NewMCPHandler creates a new HTTP handler for the MCP server using the official SDK.
-func NewMCPHandler(node *SamNode) http.Handler {
- // Create an MCP server.
+// NewMCPServer creates a new MCP server instance with all tools registered.
+func NewMCPServer(node *SamNode) *mcp.Server {
mcpServer := mcp.NewServer(&mcp.Implementation{
Name: "sam-node-mcp",
Version: "0.1.0",
@@ -144,14 +143,76 @@ func NewMCPHandler(node *SamNode) http.Handler {
Description: "Returns the last few lines of the node's log output.",
}, node.handleGetRecentLogs)
+ return mcpServer
+}
+
+// NewUnauthenticatedMCPServer creates a minimal MCP server that instructs the client on how to authenticate.
+func NewUnauthenticatedMCPServer(hubURL string) *mcp.Server {
+ mcpServer := mcp.NewServer(&mcp.Implementation{
+ Name: "sam-node-mcp-unauth",
+ Version: "0.1.0",
+ }, &mcp.ServerOptions{Instructions: "This node is unauthenticated. Use the get_login_instructions tool or help_user_login prompt."})
+
+ mcp.AddTool(mcpServer, &mcp.Tool{
+ Name: "get_login_instructions",
+ Description: "Get instructions on how to authenticate this node so it can join the SAM mesh.",
+ }, func(ctx context.Context, req *mcp.CallToolRequest, params map[string]any) (*mcp.CallToolResult, any, error) {
+ msg := fmt.Sprintf("The node is unauthenticated. Please open a regular terminal and run:\n\n sam-node join %s\n\nOnce complete, restart this MCP client.", hubURL)
+ return &mcp.CallToolResult{
+ Content: []mcp.Content{
+ &mcp.TextContent{Text: msg},
+ },
+ }, nil, nil
+ })
+
+ mcpServer.AddPrompt(&mcp.Prompt{
+ Name: "help_user_login",
+ Description: "Provides the user with login instructions when the node is unauthenticated.",
+ }, func(ctx context.Context, req *mcp.GetPromptRequest) (*mcp.GetPromptResult, error) {
+ return &mcp.GetPromptResult{
+ Description: "Instructions for joining the SAM mesh.",
+ Messages: []*mcp.PromptMessage{
+ {
+ Role: "user",
+ Content: &mcp.TextContent{
+ Text: fmt.Sprintf("Please open a terminal and run:\n\n`sam-node join %s`\n\nAfter you finish, please restart this MCP connection.", hubURL),
+ },
+ },
+ },
+ }, nil
+ })
+
+ return mcpServer
+}
+
+// NewUnauthenticatedMCPHandler creates an HTTP handler for the unauthenticated MCP server.
+func NewUnauthenticatedMCPHandler(hubURL string) http.Handler {
+ mcpServer := NewUnauthenticatedMCPServer(hubURL)
+
+ sseHandler := mcp.NewSSEHandler(func(request *http.Request) *mcp.Server {
+ return mcpServer
+ }, nil)
+
+ mux := http.NewServeMux()
+ mux.Handle("/mcp", sseHandler)
+
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ logger.Debugf("Unauth MCP Request: %s %s from %s", r.Method, r.URL.Path, r.RemoteAddr)
+ mux.ServeHTTP(w, r)
+ })
+}
+
+// NewMCPHandler creates a new HTTP handler for the MCP server using the official SDK.
+func NewMCPHandler(node *SamNode) http.Handler {
+ mcpServer := NewMCPServer(node)
+
// Create the SSE handler using the SDK
sseHandler := mcp.NewSSEHandler(func(request *http.Request) *mcp.Server {
return mcpServer
}, nil)
mux := http.NewServeMux()
- mux.Handle("/mcp/events", sseHandler)
- mux.Handle("/mcp/message", sseHandler)
+ mux.Handle("/mcp", sseHandler)
// Wrap in logging middleware to debug incoming requests
wrappedHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
diff --git a/cmd/sam-node/mcp_handlers_test.go b/cmd/sam-node/mcp_handlers_test.go
index 998e0ad1..05db489f 100644
--- a/cmd/sam-node/mcp_handlers_test.go
+++ b/cmd/sam-node/mcp_handlers_test.go
@@ -439,7 +439,7 @@ func TestNewMCPHandler_RegistersFindRemoteTools(t *testing.T) {
defer srv.Close()
client := mcp.NewClient(&mcp.Implementation{Name: "tc", Version: "0.0.1"}, nil)
- transport := &mcp.SSEClientTransport{Endpoint: srv.URL + "/mcp/events"}
+ transport := &mcp.SSEClientTransport{Endpoint: srv.URL + "/mcp"}
session, err := client.Connect(ctx, transport, nil)
if err != nil {
t.Fatalf("connect: %v", err)
@@ -703,7 +703,7 @@ func TestNewMCPHandler_RegistersDescribeRemoteTool(t *testing.T) {
defer srv.Close()
client := mcp.NewClient(&mcp.Implementation{Name: "tc", Version: "0.0.1"}, nil)
- transport := &mcp.SSEClientTransport{Endpoint: srv.URL + "/mcp/events"}
+ transport := &mcp.SSEClientTransport{Endpoint: srv.URL + "/mcp"}
session, err := client.Connect(ctx, transport, nil)
if err != nil {
t.Fatalf("connect: %v", err)
diff --git a/cmd/sam-node/mcp_test.go b/cmd/sam-node/mcp_test.go
index 71ed7b79..0fe44640 100644
--- a/cmd/sam-node/mcp_test.go
+++ b/cmd/sam-node/mcp_test.go
@@ -53,8 +53,8 @@ func TestMCPHandler_HTTP(t *testing.T) {
t.Errorf("Expected status NotFound on root, got %d", resp.StatusCode)
}
- // Test GET on /mcp/events
- req2, err := http.NewRequest("GET", ts.URL+"/mcp/events", nil)
+ // Test GET on /mcp
+ req2, err := http.NewRequest("GET", ts.URL+"/mcp", nil)
if err != nil {
t.Fatal(err)
}
@@ -66,7 +66,7 @@ func TestMCPHandler_HTTP(t *testing.T) {
defer func() { _ = resp2.Body.Close() }()
if resp2.StatusCode != http.StatusOK && resp2.StatusCode != http.StatusBadRequest {
- t.Errorf("Expected status OK or BadRequest on /mcp/events, got %d", resp2.StatusCode)
+ t.Errorf("Expected status OK or BadRequest on /mcp, got %d", resp2.StatusCode)
}
}
diff --git a/cmd/sam-node/sidecar.go b/cmd/sam-node/sidecar.go
index dfabc655..9d08169c 100644
--- a/cmd/sam-node/sidecar.go
+++ b/cmd/sam-node/sidecar.go
@@ -116,6 +116,50 @@ func startSidecarServer(node *SamNode, addr, token, certFile, keyFile, caFile st
return nil
}
+func startUnauthSidecarServer(hubURL, addr, certFile, keyFile string) error {
+ mux := http.NewServeMux()
+
+ // Public endpoints
+ mux.HandleFunc("/healthz", handleHealthz)
+ mux.HandleFunc("/readyz", handleReadyz)
+
+ // Mount Unauthenticated MCP handler
+ mcpHandler := NewUnauthenticatedMCPHandler(hubURL)
+ mux.Handle("/", mcpHandler)
+
+ server := &http.Server{
+ Handler: mux,
+ }
+
+ listener, err := net.Listen("tcp", addr)
+ if err != nil {
+ return fmt.Errorf("failed to listen on %s: %w", addr, err)
+ }
+
+ actualAddr := listener.Addr().String()
+
+ if (certFile != "") != (keyFile != "") {
+ return fmt.Errorf("both --tls-cert and --tls-key must be provided to enable TLS")
+ }
+
+ if certFile != "" && keyFile != "" {
+ logger.Infof("Starting Unauthenticated MCP server on TCP address %s (with TLS Sidecar)", actualAddr)
+ go func() {
+ if err := server.ServeTLS(listener, certFile, keyFile); err != nil && err != http.ErrServerClosed {
+ logger.Errorf("Unauth Sidecar API server error: %v", err)
+ }
+ }()
+ } else {
+ logger.Infof("Starting Unauthenticated MCP server on TCP address %s", actualAddr)
+ go func() {
+ if err := server.Serve(listener); err != nil && err != http.ErrServerClosed {
+ logger.Errorf("Unauth Sidecar API server error: %v", err)
+ }
+ }()
+ }
+ return nil
+}
+
func handleHealthz(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
if _, err := w.Write([]byte("OK")); err != nil {
diff --git a/development/kind/run.sh b/development/kind/run.sh
index 5fabb83a..4bd6a12d 100755
--- a/development/kind/run.sh
+++ b/development/kind/run.sh
@@ -140,7 +140,7 @@ echo
echo "Mesh up. To call a node's MCP API, port-forward it in another shell, e.g.:"
echo " kubectl --context ${KCTX} -n ${NAMESPACE} port-forward deploy/node-a 9091:8080"
echo "then:"
-echo " ./bin/mcp-client -url http://127.0.0.1:9091/mcp/events -tool find_remote_tools -args '{}'"
+echo " ./bin/mcp-client -url http://127.0.0.1:9091/mcp -tool find_remote_tools -args '{}'"
if [[ "${1:-}" != "-s" ]]; then
show_cluster_logs
diff --git a/sam-mcp-python/examples/gemini_agent.py b/sam-mcp-python/examples/gemini_agent.py
index abac6c3b..7a2bb436 100644
--- a/sam-mcp-python/examples/gemini_agent.py
+++ b/sam-mcp-python/examples/gemini_agent.py
@@ -26,7 +26,7 @@ def to_gemini_schema(mcp_schema: dict) -> dict:
async def run_agent():
# 1. Connect to local SAM Node
- # By default, connects to http://localhost:8080/mcp/events
+ # By default, connects to http://localhost:8080/mcp
print("Connecting to local SAM Node...")
client = SamClient()
try:
diff --git a/sam-mcp-python/src/sam_mcp/client.py b/sam-mcp-python/src/sam_mcp/client.py
index 09ad8ed0..f210ec51 100644
--- a/sam-mcp-python/src/sam_mcp/client.py
+++ b/sam-mcp-python/src/sam_mcp/client.py
@@ -9,7 +9,7 @@ class SamClient:
def __init__(self, server_url: Optional[str] = None, token: Optional[str] = None):
if server_url is None:
- server_url = os.environ.get("SAM_MCP_URL", "http://localhost:8080/mcp/events")
+ server_url = os.environ.get("SAM_MCP_URL", "http://localhost:8080/mcp")
if token is None:
token = os.environ.get("SAM_API_TOKEN")
self.server_url = server_url
diff --git a/sam-mcp-python/test_client.py b/sam-mcp-python/test_client.py
index 09444579..d8eeb974 100644
--- a/sam-mcp-python/test_client.py
+++ b/sam-mcp-python/test_client.py
@@ -4,7 +4,7 @@ import sys
from sam_mcp.client import SamClient
async def main():
- url = os.environ.get("SAM_MCP_URL", "http://sam-node-1:8080/mcp/events")
+ url = os.environ.get("SAM_MCP_URL", "http://sam-node-1:8080/mcp")
print(f"Connecting to {url}")
try:
async with SamClient(server_url=url) as client:
diff --git a/site/content/docs/development/testnet-validation.md b/site/content/docs/development/testnet-validation.md
index 620de7a6..53e995f0 100644
--- a/site/content/docs/development/testnet-validation.md
+++ b/site/content/docs/development/testnet-validation.md
@@ -66,23 +66,23 @@ You can invoke control plane tools on your local `sam-node` to locate, query, an
### List Local Control Plane Tools
```bash
-bin/mcp-client -url http://localhost:8080/mcp/events -token secret-token -list
+bin/mcp-client -url http://localhost:8080/mcp -token secret-token -list
```
### Find Remote Tools on a Specific Peer
```bash
-bin/mcp-client -url http://localhost:8080/mcp/events -token secret-token -tool find_remote_tools -args '{"peer_id":"12D3KooWKquLDsMiFc5BXsaHmVoJLDDGddqEWbVYYCpUnHR9u6RR"}'
+bin/mcp-client -url http://localhost:8080/mcp -token secret-token -tool find_remote_tools -args '{"peer_id":"12D3KooWKquLDsMiFc5BXsaHmVoJLDDGddqEWbVYYCpUnHR9u6RR"}'
```
This returns the list of available tools (e.g., `everything.get-sum`, `everything.echo`).
### Inspect Tool Schemas
```bash
-bin/mcp-client -url http://localhost:8080/mcp/events -token secret-token -tool describe_remote_tool -args '{"peer_id":"12D3KooWKquLDsMiFc5BXsaHmVoJLDDGddqEWbVYYCpUnHR9u6RR", "tool_name":"everything.get-sum"}'
+bin/mcp-client -url http://localhost:8080/mcp -token secret-token -tool describe_remote_tool -args '{"peer_id":"12D3KooWKquLDsMiFc5BXsaHmVoJLDDGddqEWbVYYCpUnHR9u6RR", "tool_name":"everything.get-sum"}'
```
### Call the Remote Tool
```bash
-bin/mcp-client -url http://localhost:8080/mcp/events -token secret-token -tool call_remote_tool -args '{"peer_id":"12D3KooWKquLDsMiFc5BXsaHmVoJLDDGddqEWbVYYCpUnHR9u6RR", "tool_name":"everything.get-sum", "arguments":{"a":37.5, "b":5.2}}'
+bin/mcp-client -url http://localhost:8080/mcp -token secret-token -tool call_remote_tool -args '{"peer_id":"12D3KooWKquLDsMiFc5BXsaHmVoJLDDGddqEWbVYYCpUnHR9u6RR", "tool_name":"everything.get-sum", "arguments":{"a":37.5, "b":5.2}}'
```
Response:
```text
diff --git a/site/content/docs/integrations/_index.md b/site/content/docs/integrations/_index.md
index c0c52158..2b6ade2d 100644
--- a/site/content/docs/integrations/_index.md
+++ b/site/content/docs/integrations/_index.md
@@ -47,7 +47,7 @@ from sam_mcp.client import SamClient
async def main():
# Connect to the local SAM node's MCP SSE endpoint
# By default, sam-node listens at 127.0.0.1:8080
- url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp/events")
+ url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp")
print(f"Connecting to SAM Node at {url}")
try:
@@ -79,7 +79,7 @@ if __name__ == "__main__":
When you run the demo while a `sam-node` is running locally, you'll see output similar to this:
```
-Connecting to SAM Node at http://127.0.0.1:8080/mcp/events
+Connecting to SAM Node at http://127.0.0.1:8080/mcp
Discovered tools:
- get_mesh_info: Get information about the mesh network
- call_remote_tool: Call an MCP tool on a remote agent
diff --git a/site/content/docs/integrations/claude-code.md b/site/content/docs/integrations/claude-code.md
index c22fea1e..d13d27dd 100644
--- a/site/content/docs/integrations/claude-code.md
+++ b/site/content/docs/integrations/claude-code.md
@@ -20,7 +20,7 @@ Register the node as an SSE MCP server. Replace `<YOUR_TOKEN>` with your `--api-
```bash
claude mcp add --transport sse p2p-mesh-node \
- http://localhost:8080/mcp/events \
+ http://localhost:8080/mcp \
--header "Authorization: Bearer <YOUR_TOKEN>"
```
@@ -33,7 +33,7 @@ Alternatively, add it to a project `.mcp.json` directly:
"mcpServers": {
"p2p-mesh-node": {
"type": "sse",
- "url": "http://localhost:8080/mcp/events",
+ "url": "http://localhost:8080/mcp",
"headers": {
"Authorization": "Bearer <YOUR_TOKEN>"
}
diff --git a/site/content/docs/integrations/claude-desktop.md b/site/content/docs/integrations/claude-desktop.md
index f86520d3..79c1ab27 100644
--- a/site/content/docs/integrations/claude-desktop.md
+++ b/site/content/docs/integrations/claude-desktop.md
@@ -33,7 +33,7 @@ Add the node through the `mcp-remote` bridge (replace `<YOUR_TOKEN>` with your `
"args": [
"mcp-remote",
"--sse",
- "http://localhost:8080/mcp/events",
+ "http://localhost:8080/mcp",
"--allow-http",
"--header",
"Authorization: Bearer <YOUR_TOKEN>"
diff --git a/site/content/docs/integrations/gemini.md b/site/content/docs/integrations/gemini.md
index bc3a764c..3a06181c 100644
--- a/site/content/docs/integrations/gemini.md
+++ b/site/content/docs/integrations/gemini.md
@@ -49,7 +49,7 @@ python3 examples/gemini_agent.py
```
Upon starting, the script will:
-1. Connect to the local SAM node's MCP server at `http://localhost:8080/mcp/events`.
+1. Connect to the local SAM node's MCP server at `http://localhost:8080/mcp`.
2. Discover all tools currently available in the mesh.
3. Map the mesh tools to Gemini-compatible OpenAPI schemas.
4. Spin up a chat loop with Gemini (`gemini-2.5-flash`).
diff --git a/site/content/docs/integrations/openclaw.md b/site/content/docs/integrations/openclaw.md
index 8a752ba0..e8603d04 100644
--- a/site/content/docs/integrations/openclaw.md
+++ b/site/content/docs/integrations/openclaw.md
@@ -16,7 +16,7 @@ To bridge your local `sam-node` into your OpenClaw agent runtime, use the `openc
# Add your local sam-node as an MCP server
# Replace <YOUR_TOKEN> with the token used in --api-token
openclaw mcp set p2p-mesh-node '{
- "url": "http://localhost:8080/mcp/events",
+ "url": "http://localhost:8080/mcp",
"transport": "sse",
"headers": {
"Authorization": "Bearer <YOUR_TOKEN>"
@@ -54,6 +54,6 @@ Because these tools are surfaced automatically, no remote tool needs to be regis
## Troubleshooting
-* Connection Issues: Ensure `sam-node` is reachable at the configured URL (default `http://localhost:8080/mcp/events`).
+* Connection Issues: Ensure `sam-node` is reachable at the configured URL (default `http://localhost:8080/mcp`).
* Authentication: Double-check that the `Authorization` header matches the `--api-token` provided to your `sam-node`.
* Gateway Status: Use `openclaw status` to confirm the gateway is running and the MCP bridge is active.
diff --git a/site/content/docs/quickstart.md b/site/content/docs/quickstart.md
index 128344e2..c12e28f5 100644
--- a/site/content/docs/quickstart.md
+++ b/site/content/docs/quickstart.md
@@ -95,14 +95,14 @@ Your SAM node exposes a standard Model Context Protocol (MCP) server. The easies
Query the list of tools available on your local node (e.g. peer discovery, message broadcast, and remote tool execution):
```bash
-mcp-client -url http://localhost:8080/mcp/events -token my-secret-token -list
+mcp-client -url http://localhost:8080/mcp -token my-secret-token -list
```
### Discover Remote Services in the Mesh
List active MCP services currently registered across the public mesh network:
```bash
-mcp-client -url http://localhost:8080/mcp/events \
+mcp-client -url http://localhost:8080/mcp \
-tool discover_remote_services \
-args '{"type":"mcp"}'
```
@@ -111,7 +111,7 @@ mcp-client -url http://localhost:8080/mcp/events \
Using a `peer_id` returned from the service discovery, find the tools available on that peer:
```bash
-mcp-client -url http://localhost:8080/mcp/events \
+mcp-client -url http://localhost:8080/mcp \
-tool find_remote_tools \
-args '{"peer_id":"<target-peer-id>"}'
```
@@ -120,7 +120,7 @@ mcp-client -url http://localhost:8080/mcp/events \
Call a tool hosted on a remote peer through your local node's P2P stream reverse proxy:
```bash
-mcp-client -url http://localhost:8080/mcp/events \
+mcp-client -url http://localhost:8080/mcp \
-tool call_remote_tool \
-args '{"peer_id":"<target-peer-id>","tool_name":"everything.get-sum","arguments":{"a":12.5,"b":7.5}}'
```
diff --git a/site/content/docs/snippets/agent_demo.py b/site/content/docs/snippets/agent_demo.py
index 83bf128b..260038ca 100644
--- a/site/content/docs/snippets/agent_demo.py
+++ b/site/content/docs/snippets/agent_demo.py
@@ -6,7 +6,7 @@ from sam_mcp.client import SamClient
async def main():
# Connect to the local SAM node's MCP SSE endpoint
# By default, sam-node listens at 127.0.0.1:8080
- url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp/events")
+ url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp")
print(f"Connecting to SAM Node at {url}")
try:
diff --git a/site/content/docs/snippets/banana_bot_playground.py b/site/content/docs/snippets/banana_bot_playground.py
index aea72960..039d5d76 100644
--- a/site/content/docs/snippets/banana_bot_playground.py
+++ b/site/content/docs/snippets/banana_bot_playground.py
@@ -12,7 +12,7 @@ class SamClient:
"""Inlined SAM Client for self-contained execution."""
def __init__(self, server_url: Optional[str] = None, token: Optional[str] = None):
if server_url is None:
- server_url = os.environ.get("SAM_MCP_URL", "http://localhost:8080/mcp/events")
+ server_url = os.environ.get("SAM_MCP_URL", "http://localhost:8080/mcp")
if token is None:
token = os.environ.get("SAM_API_TOKEN")
self.server_url = server_url
@@ -323,7 +323,7 @@ async def poll_chat_messages(client: SamClient):
async def run_banana_bot():
api_key = os.environ.get("GEMINI_API_KEY")
- url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp/events")
+ url = os.environ.get("SAM_MCP_URL", "http://127.0.0.1:8080/mcp")
token = os.environ.get("SAM_API_TOKEN", "secret-token")
if not api_key:
diff --git a/site/content/docs/user/agent-usage.md b/site/content/docs/user/agent-usage.md
index 6bbc34dd..fdf2af0a 100644
--- a/site/content/docs/user/agent-usage.md
+++ b/site/content/docs/user/agent-usage.md
@@ -88,7 +88,7 @@ Your AI agent connects to the node's local MCP server. The local server translat
### Exposing the API
The local MCP endpoint is served via **HTTP Server-Sent Events (SSE)** at:
-`http://127.0.0.1:8080/mcp/events`
+`http://127.0.0.1:8080/mcp`
### Authentication
When configuring your agent client, you must pass the API token in the headers:
diff --git a/tests/e2e/datapath.bats b/tests/e2e/datapath.bats
index fa31fd37..6aefab60 100644
--- a/tests/e2e/datapath.bats
+++ b/tests/e2e/datapath.bats
@@ -47,7 +47,7 @@ teardown() {
# Explicitly connect Node 1 to Node 2 (DHT auto-discovery is slow/unreliable in this E2E setup)
echo "[$(date +%T)] Explicitly connecting Node 1 to Node 2"
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp/events" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
# Verify connection
diff --git a/tests/e2e/docs_snippets.bats b/tests/e2e/docs_snippets.bats
index 6896ced3..405a9995 100644
--- a/tests/e2e/docs_snippets.bats
+++ b/tests/e2e/docs_snippets.bats
@@ -34,7 +34,7 @@ teardown() {
-v "$(pwd)/sam-mcp-python:/sam-mcp-python" \
-v "$(pwd)/site/content/docs/snippets:/snippets" \
-e PYTHONPATH=/sam-mcp-python/src \
- -e SAM_MCP_URL="http://sam-node-1:8080/mcp/events" \
+ -e SAM_MCP_URL="http://sam-node-1:8080/mcp" \
python:3.12 \
bash -c 'pip install mcp httpx && python3 /snippets/agent_demo.py'
diff --git a/tests/e2e/find_remote_tools.bats b/tests/e2e/find_remote_tools.bats
index 9710e70f..19eb0ea2 100644
--- a/tests/e2e/find_remote_tools.bats
+++ b/tests/e2e/find_remote_tools.bats
@@ -60,14 +60,14 @@ teardown() {
echo "[$(date +%T)] Connecting Node 1 to Node 2"
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp/events" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
mesh_wait_for_peer_connection 1 "${node2_peer_id}" 20
echo "[$(date +%T)] Calling find_remote_tools from Node 1, targeting Node 2"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "find_remote_tools" \
-args "{\"peer_id\":\"${node2_peer_id}\"}"
echo "find_remote_tools output: $output"
@@ -116,7 +116,7 @@ teardown() {
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -127,7 +127,7 @@ teardown() {
call_args="{\"peer_id\":\"${node2_peer_id}\",\"tool_name\":\"calculator.add\",\"arguments\":{\"a\":2,\"b\":3}}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "call_remote_tool" \
-args "${call_args}"
echo "call_remote_tool output: $output"
@@ -167,7 +167,7 @@ teardown() {
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -178,7 +178,7 @@ teardown() {
describe_args="{\"peer_id\":\"${node2_peer_id}\",\"tool_name\":\"calculator.add\"}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "describe_remote_tool" \
-args "${describe_args}"
echo "describe_remote_tool output: $output"
@@ -232,7 +232,7 @@ teardown() {
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -243,7 +243,7 @@ teardown() {
describe_args="{\"peer_id\":\"${node2_peer_id}\",\"tool_name\":\"calculator.does-not-exist\"}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "describe_remote_tool" \
-args "${describe_args}"
echo "describe_remote_tool output: $output"
diff --git a/tests/e2e/lib/container_mesh.bash b/tests/e2e/lib/container_mesh.bash
index 79c7dabd..c03cf6f8 100644
--- a/tests/e2e/lib/container_mesh.bash
+++ b/tests/e2e/lib/container_mesh.bash
@@ -115,7 +115,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local timeout_s="${2:-20}"
local i
for ((i=0; i<timeout_s; i++)); do
- if docker run --rm --network "${MESH_NETWORK}" python:3.12 curl -s --max-time 5 -D - http://sam-node-${idx}:8080/mcp/events | grep -q "200 OK"; then
+ if docker run --rm --network "${MESH_NETWORK}" python:3.12 curl -s --max-time 5 -D - http://sam-node-${idx}:8080/mcp | grep -q "200 OK"; then
return 0
fi
sleep 1
@@ -126,7 +126,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
mesh_get_node_count_via_mcp() {
local idx="$1"
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp/events" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "${output}" | jq 'if .connected_peers then (.connected_peers | length) - 1 else 0 end'
}
@@ -137,7 +137,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local i
for ((i=0; i<timeout_s; i++)); do
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp/events" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "Node ${idx} get_mesh_info raw output: ${output}"
local count
count="$(echo "${output}" | jq 'if .connected_peers then (.connected_peers | length) - 1 else 0 end')"
@@ -157,7 +157,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local i
for ((i=0; i<timeout_s; i++)); do
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp/events" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "[$(date +%T)] Node ${idx} get_mesh_info raw output: ${output}"
local connected
connected="$(echo "${output}" | jq -r --arg peer "$target_peer" '.connected_peers | index($peer) != null')"
@@ -177,7 +177,7 @@ if [[ -z "${MESH_HELPERS_LOADED:-}" ]]; then
local i
for ((i=0; i<timeout_s; i++)); do
local output
- output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp/events" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(timeout 15s docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${idx}:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
echo "[$(date +%T)] Node ${idx} get_mesh_info raw output: ${output}"
local connected
connected="$(echo "${output}" | jq -r --arg peer "$target_peer" '.connected_peers | index($peer) != null')"
diff --git a/tests/e2e/policy.bats b/tests/e2e/policy.bats
index a29c2523..7e0c0d15 100644
--- a/tests/e2e/policy.bats
+++ b/tests/e2e/policy.bats
@@ -131,7 +131,7 @@ mesh_call_remote_tool() {
local args="{\"peer_id\":\"${target_peer_id}\",\"tool_name\":\"${tool_name}\",\"arguments\":{}}"
- docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${caller_idx}:8080/mcp/events" -tool "call_remote_tool" -args "${args}"
+ docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-${caller_idx}:8080/mcp" -tool "call_remote_tool" -args "${args}"
}
setup() {
@@ -221,9 +221,9 @@ EOF"
# Start Node 2 (Caller) without specific local policy
mesh_start_node 2
+ mesh_wait_for_log "${MESH_PREFIX}-node-2" "SAM Node Online" 20
mesh_wait_for_mcp_ready 2
- mesh_wait_for_log "${MESH_PREFIX}-node-2" "SAM Node Online" 20
local node2_id
node2_id=$(docker logs "${MESH_PREFIX}-node-2" 2>&1 | grep "PeerID:" | grep -oE '12D3Koo[a-zA-Z0-9]+' | head -n 1)
@@ -235,7 +235,7 @@ EOF"
for ((i=0; i<40; i++)); do
local output
- output="$(docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp/events" -tool "get_mesh_info" 2>/dev/null)"
+ output="$(docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "get_mesh_info" 2>/dev/null)"
TARGET_PEER_ID=$(echo "${output}" | grep -oE '12D3Koo[a-zA-Z0-9]+' | grep -v "${hub_id}" | grep -v "${node2_id}" | head -n 1)
if [[ -n "${TARGET_PEER_ID}" ]]; then
break
@@ -253,7 +253,7 @@ EOF"
# Explicitly connect Node 2 to Node 1 to avoid "no addresses" error
local node1_addr="/dns4/sam-node-1/tcp/5002/p2p/${TARGET_PEER_ID}"
- docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp/events" -tool "connect_peer" -args "{\"peer_addr\":\"${node1_addr}\"}" >/dev/null
+ docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-2:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node1_addr}\"}" >/dev/null
}
teardown() {
diff --git a/tests/e2e/revocation_test.bats b/tests/e2e/revocation_test.bats
index b6939f36..3d9a9007 100644
--- a/tests/e2e/revocation_test.bats
+++ b/tests/e2e/revocation_test.bats
@@ -67,7 +67,7 @@ teardown() {
# Explicitly connect Node 1 to Node 2
echo "[$(date +%T)] Explicitly connecting Node 1 to Node 2"
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp/events" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
# Verify Node 1 connects to Node 2
@@ -109,7 +109,7 @@ teardown() {
# Verify Node 1 cannot reconnect to Node 2
echo "[$(date +%T)] Attempting to reconnect (should fail)"
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
- run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp/events" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
+ run docker run --rm --network "${MESH_NETWORK}" "${MESH_RUNTIME_IMAGE}" mcp-client -url "http://sam-node-1:8080/mcp" -tool "connect_peer" -args "{\"peer_addr\":\"${node2_addr}\"}"
echo "Reconnect output: $output"
[[ "$output" == *"gater disallows connection"* ]]
}
diff --git a/tests/e2e/sam.bats b/tests/e2e/sam.bats
index 2b7af2f2..955d089b 100644
--- a/tests/e2e/sam.bats
+++ b/tests/e2e/sam.bats
@@ -3,6 +3,7 @@
setup() {
export SAM_NODE_BINARY="${SAM_NODE_BINARY:-./bin/sam-node}"
export SAM_HUB_BINARY="${SAM_HUB_BINARY:-./bin/sam-hub}"
+ export MCP_CLIENT_BINARY="${MCP_CLIENT_BINARY:-./bin/mcp-client}"
export TEST_TMPDIR
TEST_TMPDIR="$(mktemp -d)"
@@ -26,10 +27,30 @@ teardown() {
-@test "sam-node run --trust-hub-rbac without identity fails" {
- run "$SAM_NODE_BINARY" run
- [[ "$status" -ne 0 ]]
- [[ "$output" == *"No JWT or stored identity found"* ]]
+@test "sam-node run without identity starts unauthenticated sidecar and serves mcp" {
+ # Start sam-node in background with a specific port to avoid conflicts
+ "$SAM_NODE_BINARY" run --bind-addr "127.0.0.1:8085" > "$TEST_TMPDIR/unauth-node.log" 2>&1 &
+ local node_pid=$!
+
+ # Give it a moment to start
+ sleep 2
+
+ # Call get_login_instructions using mcp-client
+ run "$MCP_CLIENT_BINARY" -url "http://127.0.0.1:8085/mcp" -tool "get_login_instructions" -args "{}"
+
+ # Clean up
+ kill "$node_pid" || true
+ wait "$node_pid" || true
+
+ # Check the output of mcp-client
+ [[ "$status" -eq 0 ]]
+ [[ "$output" == *"The node is unauthenticated. Please open a regular terminal and run:"* ]]
+ [[ "$output" == *"sam-node join"* ]]
+
+ # Check node logs for the initial message
+ local log_output
+ log_output=$(cat "$TEST_TMPDIR/unauth-node.log")
+ [[ "$log_output" == *"No identity found. Starting unauthenticated sidecar for enrollment over MCP"* ]]
}
diff --git a/tests/e2e/services.bats b/tests/e2e/services.bats
index b250b8bd..c811786b 100644
--- a/tests/e2e/services.bats
+++ b/tests/e2e/services.bats
@@ -63,7 +63,7 @@ teardown() {
local node2_addr="/dns4/sam-node-2/tcp/5002/p2p/${node2_peer_id}"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "connect_peer" \
-args "{\"peer_addr\":\"${node2_addr}\"}"
[[ "$status" -eq 0 ]]
@@ -75,7 +75,7 @@ teardown() {
echo "[$(date +%T)] Discovering MCP services from Node 1 (type-only)"
run docker run --rm --network "${MESH_NETWORK}" \
"${MESH_RUNTIME_IMAGE}" mcp-client \
- -url "http://sam-node-1:8080/mcp/events" \
+ -url "http://sam-node-1:8080/mcp" \
-tool "discover_remote_services" \
-args '{"type":"mcp"}'
echo "Discovery output: $output"
diff --git a/tests/integration/catalog_test.go b/tests/integration/catalog_test.go
index 38a2229a..4796df8a 100644
--- a/tests/integration/catalog_test.go
+++ b/tests/integration/catalog_test.go
@@ -75,7 +75,7 @@ func callMCP(t *testing.T, mcpAddr string, toolName string, params map[string]an
Version: "0.1.0",
}, nil)
- session, err := client.Connect(ctx, &mcp.SSEClientTransport{Endpoint: "http://" + mcpAddr + "/mcp/events"}, nil)
+ session, err := client.Connect(ctx, &mcp.SSEClientTransport{Endpoint: "http://" + mcpAddr + "/mcp"}, nil)
if err != nil {
t.Fatalf("Failed to connect: %v", err)
}
@@ -172,7 +172,7 @@ func TestCatalogRoutingAndFailover(t *testing.T) {
for time.Now().Before(deadline) {
client := mcp.NewClient(&mcp.Implementation{Name: "test-client", Version: "0.1.0"}, nil)
- session, err := client.Connect(context.Background(), &mcp.SSEClientTransport{Endpoint: "http://" + mcpAddrA + "/mcp/events"}, nil)
+ session, err := client.Connect(context.Background(), &mcp.SSEClientTransport{Endpoint: "http://" + mcpAddrA + "/mcp"}, nil)
if err != nil {
t.Logf("Poll: failed to connect: %v", err)
time.Sleep(500 * time.Millisecond)
diff --git a/tests/integration/federation_test.go b/tests/integration/federation_test.go
index 9fede8cd..8ef36ff8 100644
--- a/tests/integration/federation_test.go
+++ b/tests/integration/federation_test.go
@@ -179,7 +179,7 @@ roles:
// Search for the service from Node B
t.Log("Searching for tool from Node B...")
searchCmd := exec.Command(clientBin,
- "-url", fmt.Sprintf("http://127.0.0.1:%d/mcp/events", apiPortB),
+ "-url", fmt.Sprintf("http://127.0.0.1:%d/mcp", apiPortB),
"-token", "tokenB",
"-tool", "discover_remote_services",
"-args", `{"type": "mcp"}`,
@@ -302,7 +302,7 @@ func waitForDHTReady(t *testing.T, clientBin string, apiPort int, token string)
t.Helper()
deadline := time.Now().Add(10 * time.Second)
cmdArgs := []string{
- "-url", fmt.Sprintf("http://127.0.0.1:%d/mcp/events", apiPort),
+ "-url", fmt.Sprintf("http://127.0.0.1:%d/mcp", apiPort),
"-token", token,
"-tool", "get_mesh_info",
"-args", `{}`,
diff --git a/tests/integration/p2p_test.go b/tests/integration/p2p_test.go
index 19c86b20..cfb30112 100644
--- a/tests/integration/p2p_test.go
+++ b/tests/integration/p2p_test.go
@@ -34,7 +34,7 @@ func TestSamNodeRunWithoutIdentity(t *testing.T) {
t.Fatalf("expected sam-node run without identity to fail, but it succeeded\nstdout:\n%s\nstderr:\n%s", stdout, stderr)
}
out := stdout + stderr
- if !strings.Contains(out, "No JWT or stored identity found") {
+ if !strings.Contains(out, "No identity found. Starting unauthenticated sidecar for enrollment over MCP") {
t.Fatalf("expected missing identity message, got:\n%s", out)
}
}
diff --git a/tests/integration/pubsub_test.go b/tests/integration/pubsub_test.go
index a4afb274..20dd8269 100644
--- a/tests/integration/pubsub_test.go
+++ b/tests/integration/pubsub_test.go
@@ -105,7 +105,7 @@ func TestPubSubTools(t *testing.T) {
Version: "0.1.0",
}, nil)
- session, err := client.Connect(context.Background(), &mcp.SSEClientTransport{Endpoint: "http://" + mcpAddr + "/mcp/events"}, nil)
+ session, err := client.Connect(context.Background(), &mcp.SSEClientTransport{Endpoint: "http://" + mcpAddr + "/mcp"}, nil)
if err != nil {
t.Fatalf("Failed to connect: %v", err)
}