Get the FREE Ultimate OpenClaw Setup Guide →

dynamic

A flexible and extensible framework for building Model Context Protocol (MCP) servers that conforms to the [Model Context Protocol specification](https://modelcontextprotocol.io/). This framework enables both static and dynamic tool registration, allowing tools to be defined at runtime as well as compile time.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio scitara-cto-dynamic-mcp-server node path/to/server.js \
  --env PORT="3000" \
  --env MONGO_URI="mongodb://localhost:27017/mcp" \
  --env MCP_API_KEY_HEADER="x-apikey"

How to use

Dynamic MCP Server is a flexible, user-aware framework for building Model Context Protocol (MCP) servers with runtime tool management. It supports API key authentication backed by MongoDB, per-user session tool loading, and fine-grained tool sharing. Tools are registered and loaded per user session, enabling runtime extensibility where new tools can be added, updated, or shared without restarting the server. Clients authenticate via an API key provided either as a query parameter or a header, and interactions with the server occur over HTTP using the streamable MCP transport or the modern single-endpoint design.

Once running, you can manage users (create, update, delete, list), bootstrap admins, and define tool access controls. Tools are grouped into handler packages, each exposing a set of tools and a dispatching handler. When a user logs in (or is created), an apiKey is generated and stored in MongoDB; subsequent requests use this key to access the per-user tool session and perform operations through the MCP endpoint. The server supports dynamic tool creation, sharing with other users, and real-time updates to tool visibility and access levels.

How to install

Prerequisites:

  • Node.js (v18+ recommended) and npm or pnpm
  • MongoDB instance (local or remote) with accessible URI
  • Basic networking access to the MongoDB and MCP server port
  1. Install dependencies
# using npm
npm install
# or using yarn
yarn install
  1. Configure environment Create a .env file or export environment variables as needed. Example variables:
# MongoDB connection string
MONGO_URI=mongodb://localhost:27017/mcp
# Header name used for API key authentication
MCP_API_KEY_HEADER=x-apikey
# Server listening port
PORT=3000
  1. Run the server
# Start the MCP server (adjust path to your entry script)
node path/to/server.js
  1. Initialize and manage users/tools
  • Use the provided admin tooling (via REST endpoints) to bootstrap an admin user, then create additional users and assign tools. See the docs under docs/user-management.md and docs/tool-management.md for details.
  1. Optional: Docker-based deployment
  • If you prefer Docker, build or pull an image and set environment variables accordingly, then expose the port to your network.
# Example (adjust image name and env vars as needed)
docker run -p 3000:3000 -e MONGO_URI=mongodb://db:27017/mcp -e PORT=3000 scitara-cto-dynamic-mcp-server

Additional notes

  • Tools are registered via handler packages. Each package can group related tools and provides a handler function for execution. This enables runtime extensibility without modifying core server code.
  • The authentication model relies on API keys stored per user in MongoDB; protect your database and rotate keys as needed.
  • Tool visibility is per-user; users can hide or unhide tools, and admin actions can adjust access levels in real time.
  • The server supports both legacy and modern MCP transports; use the /mcp endpoint with either query parameter or header-based authentication as described in the docs.
  • For production, consider TLS termination and proper rate limiting, as well as securing MongoDB with access controls.

Related MCP Servers

Sponsor this space

Reach thousands of developers