moltbook-http-mcp 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -166,8 +166,7 @@ If you prefer not to put the key in the config file, set `MOLTBOOK_API_KEY` in y
166
166
 
167
167
  You can use both in the same config (e.g. `molt` for HTTP and `moltcli` for stdio).
168
168
 
169
- [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=MOLT&config=eyJ1cmwiOiJodHRwOi8vMTI3LjAuMC4xOjg1MDIvbWNwIn0%3D)
170
-
169
+ [![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=molt&config=eyJ1cmwiOiJodHRwOi8vMTI3LjAuMC4xOjMwMDMvbWNwIn0%3D)
171
170
  ---
172
171
 
173
172
  ## Features (MCP tools)
@@ -1,2 +1,2 @@
1
- "use strict";import c from"express";import f from"cors";import l from"fs";import S from"https";import d from"path";import{fileURLToPath as y}from"url";import{StdioServerTransport as v}from"@modelcontextprotocol/sdk/server/stdio.js";import{handleRequest as w}from"../mcp/mcp.server-handler.js";import{createMCPServer as P}from"../mcp/mcp.server.js";import{requireAuth as g}from"./app.auth.js";import{getMoltbookApiKey as M,getAppVersion as h}from"../utils/env.js";import{LOGGER as p}from"../utils/logger.js";export const startStdioServer=async(s={})=>{const e=new v;await P(s).connect(e),process.stderr.writable&&process.stderr.write(`Moltbook MCP stdio server ready
2
- `)};const R=(s={})=>{const e=c();e.use(f({origin:"*",exposedHeaders:["Mcp-Session-Id"]})),e.use(c.json()),e.use(c.json({limit:"10mb"})),e.use(c.urlencoded({extended:!0}));const n=d.dirname(y(import.meta.url)),a=d.join(n,"..","..","public");return e.use(c.static(a)),e.get("/health",async(r,t)=>{try{const o=M();let i="disconnected",m="not authorized";if(o)try{(await fetch("https://www.moltbook.com/api/v1/agents/status",{headers:{Authorization:`Bearer ${o}`}})).ok&&(i="connected",m="authorized")}catch{}const u={status:"healthy",moltbook:i,auth:m,mcp:"ready",timestamp:new Date().toISOString(),version:h()||"1.0.0"};t.json(u)}catch(o){t.status(500).json({status:"unhealthy",error:o.message,timestamp:new Date().toISOString()})}}),e.post("/mcp",g(s),async(r,t)=>{await w(r,t,s)}),e.get("/mcp",async(r,t)=>{t.status(405).set("Allow","POST").send("Method Not Allowed")}),e.delete("/mcp",async(r,t)=>{p.log("Received DELETE MCP request"),t.writeHead(405).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}),e.get("/",(r,t)=>{t.json({name:"Moltbook MCP Gateway Server",description:"MCP server for Moltbook: the social network for AI agents. Post, comment, upvote, DMs, communities.",version:h()||"1.0.0",endpoints:{health:{method:"GET",path:"/health",description:"Health check for all services"},mcp:{method:"POST",path:"/mcp",description:"JSON-RPC endpoint for MCP calls"},wellKnownMcp:{method:"GET",path:"/.well-known/mcp.json",description:"MCP server manifest (tools list)"}},architecture:"MCP integration",timestamp:new Date().toISOString()})}),e};export const startServer=(s={})=>{const{mcpPort:e=3003,keyPath:n,certPath:a}=s||{},r=R(s),t=o=>{o&&(p.error("Failed to start server:",o),process.exit(1));const i=n&&a?"https":"http";p.log(`0. Moltbook MCP Server listening on ${i}://localhost:${e}`)};if(n&&a)try{const o=l.readFileSync(n,"utf8"),i=l.readFileSync(a,"utf8");S.createServer({key:o,cert:i},r).listen(e,()=>t())}catch(o){p.error("HTTPS: failed to read key or cert:",o?.message??o),process.exit(1)}else r.listen(e,t)};process.on("SIGINT",async()=>{p.log("Shutting down server..."),process.exit(0)});
1
+ "use strict";import c from"express";import f from"cors";import m from"fs";import S from"https";import d from"path";import{fileURLToPath as y}from"url";import{StdioServerTransport as w}from"@modelcontextprotocol/sdk/server/stdio.js";import{handleRequest as v}from"../mcp/mcp.server-handler.js";import{createMCPServer as P}from"../mcp/mcp.server.js";import{requireAuth as g}from"./app.auth.js";import{getMoltbookApiKey as M,getAppVersion as h}from"../utils/env.js";import{LOGGER as p}from"../utils/logger.js";export const startStdioServer=async(s={})=>{const e=new w;await P(s).connect(e),process.stderr.writable&&process.stderr.write(`Moltbook MCP stdio server ready
2
+ `)};const R=(s={})=>{const e=c();e.use(f({origin:"*",exposedHeaders:["Mcp-Session-Id"]})),e.use(c.json()),e.use(c.json({limit:"10mb"})),e.use(c.urlencoded({extended:!0}));const n=d.dirname(y(import.meta.url)),a=d.join(n,"..","..","public");return e.use(c.static(a,{dotfiles:"allow"})),e.get("/health",async(r,t)=>{try{const o=M();let i="disconnected",l="not authorized";if(o)try{(await fetch("https://www.moltbook.com/api/v1/agents/status",{headers:{Authorization:`Bearer ${o}`}})).ok&&(i="connected",l="authorized")}catch{}const u={status:"healthy",moltbook:i,auth:l,mcp:"ready",timestamp:new Date().toISOString(),version:h()||"1.0.0"};t.json(u)}catch(o){t.status(500).json({status:"unhealthy",error:o.message,timestamp:new Date().toISOString()})}}),e.post("/mcp",g(s),async(r,t)=>{await v(r,t,s)}),e.get("/mcp",async(r,t)=>{t.status(405).set("Allow","POST").send("Method Not Allowed")}),e.delete("/mcp",async(r,t)=>{p.log("Received DELETE MCP request"),t.writeHead(405).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}),e.get("/",(r,t)=>{t.json({name:"Moltbook MCP Gateway Server",description:"MCP server for Moltbook: the social network for AI agents. Post, comment, upvote, DMs, communities.",version:h()||"1.0.0",endpoints:{health:{method:"GET",path:"/health",description:"Health check for all services"},mcp:{method:"POST",path:"/mcp",description:"JSON-RPC endpoint for MCP calls"},wellKnownMcp:{method:"GET",path:"/.well-known/mcp.json",description:"MCP server manifest (tools list)"}},architecture:"MCP integration",timestamp:new Date().toISOString()})}),e};export const startServer=(s={})=>{const{mcpPort:e=3003,keyPath:n,certPath:a}=s||{},r=R(s),t=o=>{o&&(p.error("Failed to start server:",o),process.exit(1));const i=n&&a?"https":"http";p.log(`0. Moltbook MCP Server listening on ${i}://localhost:${e}`)};if(n&&a)try{const o=m.readFileSync(n,"utf8"),i=m.readFileSync(a,"utf8");S.createServer({key:o,cert:i},r).listen(e,()=>t())}catch(o){p.error("HTTPS: failed to read key or cert:",o?.message??o),process.exit(1)}else r.listen(e,t)};process.on("SIGINT",async()=>{p.log("Shutting down server..."),process.exit(0)});
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "moltbook-http-mcp",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Moltbook MCP server: post, comment, upvote, DMs, communities. API key auth.",
5
5
  "private": false,
6
+ "mcpName": "io.github.easingthemes/moltbook-mcp",
6
7
  "publishConfig": {
7
8
  "access": "public"
8
9
  },