Dynamic MCP Server Framework logo

Dynamic MCP Server Framework

by scitara-cto

A flexible framework for building Model Context Protocol (MCP) servers that conforms to the Model Context Protocol specification. It enables both static and dynamic tool registration, allowing tools to be defined at runtime as well as compile time.

View on GitHub

Last updated: N/A

What is Dynamic MCP Server Framework?

The Dynamic MCP Server Framework is a framework for building Model Context Protocol (MCP) servers. It allows for dynamic tool registration, enabling tools to be defined and registered at runtime, providing flexibility and adaptability in tool management.

How to use Dynamic MCP Server Framework?

To use the framework, install it using npm install dynamic-mcp-server. Then, create a basic server instance using the DynamicMcpServer class, configure it with a name, version, port, and host, and start the server. You can register custom handlers with associated tools to extend the server's functionality. Examples are provided for basic server setup, custom handler creation, and web service integration.

Key features of Dynamic MCP Server Framework

  • Dynamic Tool Registration

  • Handler-Based Architecture

  • Extensible Design

  • Built-in Tool Management

  • MCP Specification Compliance

Use cases of Dynamic MCP Server Framework

  • Clients can define custom tools that use existing handlers

  • Handlers can be reused across multiple tools

  • Tools can be dynamically created and configured

  • The system remains type-safe and maintainable

FAQ from Dynamic MCP Server Framework

What is the Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is a specification for standardizing communication between different tools and systems.

What is dynamic tool registration?

Dynamic tool registration allows tools to be defined and registered at runtime, rather than only at compile time.

How do I create a custom handler?

Create a custom handler as a plain object with name, handler, and tools properties. The handler property should be an asynchronous function that implements the handler's logic.

How do I define a tool?

Define a tool using the ToolDefinition interface, which includes properties like name, description, inputSchema, and handler.

How do I control tool access for different users?

Use the toolsAvailable and toolsHidden attributes in Keycloak to specify which tools are available or hidden from users or groups.