feat: add HTTP server transport for MCP

Adds src/http-server.ts - a Node.js HTTP entry point that exposes the
MCP implementation via Streamable HTTP transport (POST/GET /mcp) per
the MCP 2025-11-25 specification.

- Uses StreamableHTTPServerTransport (stateless mode) from the MCP SDK
- Port configurable via MCP_PORT env var (default: 3000)
- ObsidianMCPServer.connect() now accepts an optional Transport param
  so both stdio (existing) and HTTP (new) modes reuse the same server
- Added 'npm run server' script to start the HTTP server

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-30 19:41:51 -05:00
parent 3948cd6966
commit 8b651d379a
3 changed files with 121 additions and 5 deletions

View File

@@ -6,6 +6,7 @@
"main": "dist/index.js",
"scripts": {
"build": "tsc",
"server": "node dist/http-server.js",
"validate-manifest": "mcpb validate manifest.json",
"pack": "npm run build && mcpb pack",
"test": "jest",