mcp-mongodb-novel
A Model Context Protocol (MCP) server that provides an interface between LLMs and MongoDB databases, optimized for small context windows (3k tokens). Specially for novel.
claude mcp add --transport stdio sfbb-mcp-mongodb-novel-server docker run -i sfbb/mcp-mongodb-novel-server \ --env PORT="3000" \ --env MONGODB_URI="mongodb://localhost:27017" \ --env DATABASE_NAME="your_database"
How to use
This MCP server exposes a high-performance interface between language models and a MongoDB-backed knowledge store focused on novels, chapters, characters, and a Q&A knowledge base. It operates as a dual-server system: an MCP SSE (Server-Sent Events) endpoint for efficient, low-overhead communication with LLMs, and a RESTful CRUD API to manage the MongoDB collections. The MCP interface supports JSON-RPC 2.0 style commands (via the /message endpoint) to query and update domain data, while the SSE channel streams contextually relevant information to the client. Start by launching the server, then connect your LLM client to the SSE endpoint for conversational retrieval or to the /message endpoint for structured, RPC-style requests. A typical workflow involves querying characters, novels, or chapters, or updating chapter summaries, and optionally populating the database via the included scrapers.
How to install
Prerequisites:
- Docker installed and running
- Access to a MongoDB instance (local or remote)
- (Optional) Environment configuration for your MongoDB URI and database name
Installation steps:
-
Pull the server image (or build your own if you maintain a custom image): docker pull sfbb/mcp-mongodb-novel-server
-
Create a configuration file or set environment variables to point to MongoDB:
- MONGODB_URI=mongodb://localhost:27017
- DATABASE_NAME=your_database
- PORT=3000
-
Run the server using Docker (as provided in the mcp_config): docker run -i -e MONGODB_URI="mongodb://localhost:27017" -e DATABASE_NAME="your_database" -e PORT="3000" sfbb/mcp-mongodb-novel-server
-
Verify endpoints are reachable:
- MCP SSE: http://localhost:3000/sse
- MCP POST (RPC): http://localhost:3000/message
- CRUD API: http://localhost:3001/api/ (if exposed by the container)
Notes:
- If you are deploying behind a port map, adjust LOCAL_PORT in your docker run command (e.g., -p 3000:3000 -p 3001:3001).
- The server expects a running MongoDB instance accessible via the MONGODB_URI.
- If you modify the environment, ensure the container has access to the updated variables on startup.
Additional notes
Environment variables:
- MONGODB_URI: Connection string to MongoDB (default: mongodb://localhost:27017)
- DATABASE_NAME: Target database for the MCP server
- PORT: Base port for the MCP SSE server (CRUD API typically at PORT+1)
Common issues and tips:
- Ensure MongoDB is reachable from inside the container (network/networking issues can block access).
- If using a remote MongoDB, ensure proper authentication and network whitelisting are in place.
- For best performance with small context windows, tune MongoDB indexes on the data models (novels, chapters, characters, qa) and consider adjusting the container's CPU/memory limits.
- Use the REST API to populate or update data, and use the MCP POST /message endpoint for LLM-driven queries via JSON-RPC 2.0 payloads.
- When using the SSE endpoint, establish a persistent connection from the LLM client to stream responses efficiently.
Related MCP Servers
goose
an open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
cunzhi
告别AI提前终止烦恼,助力AI更加持久
probe
AI-friendly semantic code search engine for large codebases. Combines ripgrep speed with tree-sitter AST parsing. Powers AI coding assistants with precise, context-aware code understanding.
mcp-center
A centralized platform for managing and connecting MCP servers. MCP Center provides a high-performance proxy service that enables seamless communication between MCP clients and multiple MCP servers.
backlog -rust
MCP server for Backlog, project management service.
perplexity-web-api
🔍 Perplexity AI MCP without API key