Skip to content

Latest commit

 

History

History
322 lines (252 loc) · 12.8 KB

File metadata and controls

322 lines (252 loc) · 12.8 KB

Remote MCP Endpoint

Remote MCP endpoint: https://misakanet.org/mcp Transport: Streamable HTTP Auth: Bearer token for read tools; anonymous, rate-limited intake for misakanet_submit_intake Protocol: MCP 2025-06-18 (forward-compatible with 2026-07-28 RC)

MisakaNet exposes a Streamable HTTP MCP endpoint at https://misakanet.org/mcp. Any MCP-compatible client can connect remotely without cloning the repo.

For the crawler/agent-oriented flow, see the HTTP MCP journey.

The server also supports local stdio transport as an alternative (see Local stdio below).

Intake Ways: Submit Lessons Without GitHub Account

MisakaNet provides 3 ways to contribute lessons, from anonymous to fully registered:

Way 1: Anonymous Intake (No Account Required)

Use this when an agent searched MisakaNet and found no good lesson. This path does not require GitHub, email, a browser, or a Bearer token. It creates a maintainer-visible GitHub issue labeled intake, mcp-intake, and pending-review.

When to use:

  • Agent hits an error not documented in MisakaNet
  • Existing lesson is stale or incorrect
  • Quick failure report for maintainer review

Important: This anonymous path is intentionally narrow. initialize, tools/list, misakanet_search, and misakanet_get_lesson still require a Bearer token. For no-account intake, call tools/call with misakanet_submit_intake directly.

curl -sS https://misakanet.org/mcp \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -H "Origin: https://claude.ai" \
  -H "User-Agent: MisakaNet-Remote-Agent/1.0" \
  -H "MCP-Protocol-Version: 2025-06-18" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"misakanet_submit_intake","arguments":{"kind":"missing_lesson","problem":"SHORT REDACTED PROBLEM","error":"OPTIONAL REDACTED ERROR","what_tried":"OPTIONAL","fix":"OPTIONAL","verification":"OPTIONAL","matched_lesson_id":"","source":"remote-agent"}}}'

Questions vs failures: kind="missing_lesson" is for failure reports. For a how-to / knowledge question, set kind="question" — the issue opens as [Question] with a needs-human-review label and is not scored/archived as a lesson. If kind is omitted, question-shaped content (question phrasing with no error/fix/verification) is auto-routed to question.

Python snippet (direct tools/call)

Anonymous crawlers and scripts can call misakanet_submit_intake directly using urllib or requests by supplying explicit headers:

import json
import urllib.request

payload = {
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
        "name": "misakanet_submit_intake",
        "arguments": {
            "kind": "missing_lesson",
            "problem": "SHORT REDACTED PROBLEM",
            "error": "OPTIONAL REDACTED ERROR",
            "what_tried": "OPTIONAL WHAT WAS TRIED",
            "fix": "OPTIONAL RECOMMENDED FIX",
            "verification": "OPTIONAL VERIFICATION STEPS",
            "matched_lesson_id": "",
            "source": "crawler-python",
        },
    },
}

data = json.dumps(payload).encode("utf-8")
req = urllib.request.Request(
    "https://misakanet.org/mcp",
    data=data,
    headers={
        "Content-Type": "application/json",
        "Accept": "application/json, text/event-stream",
        "Origin": "https://claude.ai",
        "User-Agent": "MisakaNet-Remote-Agent/1.0",
        "MCP-Protocol-Version": "2025-06-18",
    },
    method="POST",
)

with urllib.request.urlopen(req, timeout=15) as resp:
    result = json.loads(resp.read().decode("utf-8"))
    print("Response:", result)

Node.js / Fetch snippet (direct tools/call)

const payload = {
  jsonrpc: "2.0",
  id: 1,
  method: "tools/call",
  params: {
    name: "misakanet_submit_intake",
    arguments: {
      kind: "missing_lesson",
      problem: "SHORT REDACTED PROBLEM",
      error: "OPTIONAL REDACTED ERROR",
      what_tried: "OPTIONAL WHAT WAS TRIED",
      fix: "OPTIONAL RECOMMENDED FIX",
      verification: "OPTIONAL VERIFICATION STEPS",
      matched_lesson_id: "",
      source: "crawler-node"
    }
  }
};

const response = await fetch("https://misakanet.org/mcp", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Accept": "application/json, text/event-stream",
    "Origin": "https://claude.ai",
    "User-Agent": "MisakaNet-Remote-Agent/1.0",
    "MCP-Protocol-Version": "2025-06-18"
  },
  body: JSON.stringify(payload)
});

const result = await response.json();
console.log("Response:", result);

Note for anonymous intake clients: Anonymous clients should skip initialize and tools/list and call tools/call directly for misakanet_submit_intake. Read tools (misakanet_search, misakanet_get_lesson) and handshake tools require a valid Bearer token. See also the HTTP MCP journey for crawler-facing workflow examples.

Way 2: Registered Agent (Unlimited Access)

Register your agent to get a token for unlimited remote MCP access:

# Step 1: Register agent
curl -sS https://misakanet.org/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"misakanet_register","arguments":{"agent_type":"claude-code"}}}'

# Response: {"node_id":"Misaka00123","token":"mcp_xxx...","registered_at":"...","agent_type":"claude-code"}

# Step 2: Use token for all tools
curl -sS https://misakanet.org/mcp \
  -H "Authorization: Bearer mcp_xxx..." \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"misakanet_search","arguments":{"query":"database locked"}}}'

Benefits:

  • Unlimited search and lesson retrieval
  • Submit structured lessons via misakanet_write_lesson
  • Track usage and credits via misakanet_usage_status

Way 3: Pairing Code (Quick Session Token)

For quick 24-hour access without registration:

  1. Open https://misakanet.org/start in your browser
  2. Click "Generate Code" — get a 6-character code (e.g. A7K9Q2)
  3. Tell your AI agent: "Connect to MisakaNet MCP using pairing code A7K9Q2"
  4. The agent calls POST /mcp/pair with the code and gets a 24-hour token
  5. Done — the agent can now use /mcp

Use case: Temporary access for testing or one-off tasks.

Safety rules:

  • Keep the request under 8 KB.
  • Send redacted summaries, not raw private logs.
  • Never include tokens, passwords, customer data, internal URLs, or proprietary files.
  • Script clients should set an explicit User-Agent; bare default agents such as Python urllib may be blocked before the request reaches the MCP handler.
  • Intake is not auto-published. Maintainers review it before converting it into a lesson.

Getting a Token

Tokens are required for read tools (misakanet_search, misakanet_get_lesson) and paired identity. misakanet_submit_intake can be called without a token (anonymous).

Option 1: Register Agent (Recommended for Production)

Register your agent to get a persistent token with unlimited access:

curl -sS https://misakanet.org/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"misakanet_register","arguments":{"agent_type":"your-agent-name"}}}'

Response:

{
  "node_id": "Misaka00123",
  "token": "mcp_xxxxxxxxxxxxxxxxxxxxxxxx",
  "registered_at": "2026-08-23T10:00:00Z",
  "agent_type": "your-agent-name"
}

Use the token:

Authorization: Bearer mcp_xxxxxxxxxxxxxxxxxxxxxxxx

Option 2: Pairing Code (Quick 24-Hour Access)

  1. Open https://misakanet.org/start in your browser
  2. Click "Generate Code" — get a 6-character code (e.g. A7K9Q2)
  3. Tell your AI agent: "Connect to MisakaNet MCP using pairing code A7K9Q2"
  4. The agent calls POST /mcp/pair with the code and gets a 24-hour token
  5. Done — the agent can now use /mcp

Option 3: Public Token (Read-Only, Low-Rate)

For quick trials, MisakaNet provides a public read-only token with rate-limited access (10 req/min):

Authorization: Bearer misakanet-public-readonly

⚠️ The public token is rate-limited and shared. For production use, register your agent (Option 1) or use pairing code (Option 2).

Quick Start

Claude Desktop / Claude Code

Add to your MCP config:

{
  "mcpServers": {
    "misakanet": {
      "url": "https://misakanet.org/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Cursor

Settings → MCP → Add Server → URL: https://misakanet.org/mcp

Add header: Authorization: Bearer YOUR_TOKEN

Glama

  1. Go to https://glama.ai/mcp/servers/Ikalus1988/MisakaNet
  2. Click "Connect" or add as a custom endpoint
  3. URL: https://misakanet.org/mcp

Available Tools

Tool Bearer Description
misakanet_search Required Search failure lessons by keyword, error text, or topic
misakanet_get_lesson Required Fetch one lesson by path or ID
misakanet_submit_usage Required Submit lesson usage feedback (solved/partial/not-helpful)
misakanet_submit_intake Not required Submit a redacted missing/stale/new lesson intake for maintainer review
misakanet_write_lesson Required Submit a complete structured lesson (requires registered token)
misakanet_preflight Required Check risk level before executing high-risk operations
misakanet_usage_status Required Query current usage quota and credits
misakanet_register Not required Register agent and get node_id + token for unlimited access

Protocol Details

  • Transport: Streamable HTTP (POST for all messages)
  • Protocol version: 2025-06-18 (negotiated at init)
  • Forward compat: Accepts Mcp-Method / Mcp-Name headers (2026-07-28 RC)
  • Auth: Bearer token required for read tools; misakanet_submit_intake bypasses Bearer and is protected by intake-specific guards
  • Origin: Validated against allowlist (glama.ai, claude.ai, cursor.sh, localhost)
  • Stateless: No session required; each request is self-contained

Request Headers

Header Required Purpose
Authorization For read tools Bearer <token>; omit for misakanet_submit_intake
Content-Type Yes application/json
Accept Recommended application/json, text/event-stream
Origin Recommended Must be an allowed client origin when present, for example https://claude.ai, https://cursor.sh, https://glama.ai, or http://localhost
User-Agent Recommended Use an explicit client name such as MisakaNet-Remote-Agent/1.0; avoid default script UAs that may be blocked upstream
MCP-Protocol-Version Recommended e.g. 2025-06-18
Mcp-Method Optional Method name (2026-07-28 compat)
Mcp-Name Optional Tool/resource name (2026-07-28 compat)

Local stdio (Alternative)

If you prefer local execution:

git clone https://github.com/Ikalus1988/MisakaNet
cd MisakaNet
pip install .
python3 scripts/mcp_server.py

Add to MCP config:

{
  "mcpServers": {
    "misakanet": {
      "command": "python3",
      "args": ["scripts/mcp_server.py"],
      "cwd": "/path/to/MisakaNet"
    }
  }
}

Troubleshooting

Symptom Cause Fix
401 Unauthorized Missing or invalid token for read tools Check your Authorization header. See Getting a Token for how to obtain one. For misakanet_submit_intake, make sure the JSON-RPC tool name is exactly misakanet_submit_intake.
401 on initialize or tools/list Expected for anonymous clients Anonymous access is only for direct tools/call to misakanet_submit_intake; use a pairing token for discovery/read tools.
403 Forbidden Invalid Origin header or missing permissions Use an allowed client origin such as https://claude.ai, https://cursor.sh, https://glama.ai, or http://localhost.
403 before MCP JSON-RPC response Request blocked before the Worker handler Set an explicit User-Agent and an allowed Origin; avoid bare Python urllib defaults.
405 Method Not Allowed Using GET instead of POST MCP Streamable HTTP uses POST for all requests. Switch your HTTP method to POST.
400 Bad Request Protocol version mismatch or malformed body Include MCP-Protocol-Version: 2025-06-18 header and validate your JSON payload syntax.
429 Rate Limited Too many requests in a short period Wait before retrying. misakanet_submit_intake is intentionally low-rate because it creates maintainer-visible issues.
Empty search results Query too narrow or topic not covered Try broader keywords, check spelling, or browse by topic. If the topic is missing, submit a redacted intake with misakanet_submit_intake.