dynamic-mcp-server

dynamic-mcp-server

3.4

Dynamic MCP Server is a flexible, extensible framework for building Model Context Protocol (MCP) servers with modern API key authentication, user management, and dynamic tool sharing.

Dynamic MCP Server enables secure, user-aware, and extensible AI tool servers. It supports API key-based authentication, user management and authorization, session-based per-user tool loading, tool sharing, and fine-grained access control. The framework is designed to be extensible with custom HTTP and database layers for downstream projects. It allows for dynamic tool management, enabling the creation, deletion, and authorization of tools at runtime, which is a primary differentiator from most other MCP servers. The server uses MongoDB for user management and authorization, and tools are loaded per user session, not globally. This setup ensures that tools can be shared with other users, with managed access levels and real-time updates.

Features

  • {'name': 'Dynamic Tool Management', 'description': 'Create, delete, and authorize tools at runtime, allowing for true runtime extensibility.'}
  • {'name': 'User Management', 'description': 'Add, update, delete, and list users with role-based access and admin bootstrapping.'}
  • {'name': 'Tool Sharing', 'description': 'Share tools with other users, manage access levels, and receive real-time updates.'}
  • {'name': 'Modern Auth', 'description': 'Simple API key authentication with MongoDB for authorization.'}
  • {'name': 'Extensibility', 'description': 'Add custom HTTP routes and MongoDB collections in downstream projects.'}

Usage with Different Platforms

Node.js

js
const myHandlerPackage = {
  name: "my-domain",
  tools: [
    {
      name: "my-tool",
      description: "A custom tool",
      inputSchema: {
        /* ... */
      },
      handler: { type: "my-domain", config: {} },
      rolesPermitted: ["user", "admin"],
    },
    // ...more tools...
  ],
  handler: async (args, context, config, toolName) => {
    // Dispatch logic based on toolName, if needed
  },
};

const server = new DynamicMcpServer({ name: "my-mcp", version: "1.0.0" });
await server.start();
await server.registerHandler(myHandlerPackage);