MCP Declarative Server

Integrations

  • Allows installation of the MCP server through the npm package manager with the 'mcp-client-router' package.

MCP Declarative Server

A utility module for creating Model Context Protocol (MCP) servers declaratively.

Installation

npm install mcp-client-router

Usage

import { DeclarativeMCPServer } from "mcp-client-router/declarative-server"; // Create a server declaratively const server = new DeclarativeMCPServer({ name: "my-server", version: "1.0.0", // Define tools as arrays of arguments tools: [ [ "greeting", { message: "string" }, async ({ message }) => ({ content: [{ type: "text", text: `Hello, ${message}!` }], }), ], [ "farewell", { name: "string" }, async ({ name }) => ({ content: [{ type: "text", text: `Goodbye, ${name}!` }], }), ], ], // Define prompts prompts: [ [ "welcome", { name: "string", formality: { type: "string", default: "CASUAL" } }, async ({ name, formality }) => { const text = formality === "FORMAL" ? `Dear ${name}, welcome to our service.` : `Hi ${name}! Welcome aboard!`; return { messages: [{ role: "assistant", content: { text } }], }; }, "A welcome prompt template", ], ], // Define resources resources: [ [ "docs/readme", async () => ({ contents: [ { uri: "docs/readme", text: "This is the documentation readme file.", }, ], }), ], ], }); // Connect to a transport await server.connect(transport);

API Reference

DeclarativeMCPServer

new DeclarativeMCPServer(options);
Options
  • name (string): The name of the server
  • version (string): The version of the server
  • tools (array): An array of tool definitions
  • prompts (array): An array of prompt definitions
  • resources (array): An array of resource definitions
Tool Definition Format
[ name, // string: name of the tool paramSchema, // object: parameter schema handler, // function: async function to handle the tool call description, // string (optional): description of the tool ];
Prompt Definition Format
[ name, // string: name of the prompt paramSchema, // object: parameter schema handler, // function: async function to handle the prompt description, // string (optional): description of the prompt ];
Resource Definition Format
[ uri, // string: URI of the resource handler, // function: async function to handle the resource request ];

License

ISC

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

A utility module for creating Model Context Protocol servers declaratively, allowing developers to easily define tools, prompts, and resources with a simplified syntax.

  1. Installation
    1. Usage
      1. API Reference
        1. DeclarativeMCPServer
      2. License

        Related MCP Servers

        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server built with mcp-framework that allows users to create and manage custom tools for processing data, integrating with the Claude Desktop via CLI.
          Last updated -
          48
          4
          TypeScript
          • Apple
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server that provides tools for code modification and generation via Large Language Models, allowing users to create, modify, rewrite, and delete files using structured XML instructions.
          Last updated -
          12
          Python
          MIT License
          • Linux
          • Apple
        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server providing utility tools for development and testing, offering functionalities like personalized greetings, random card drawing, and datetime formatting with an extensible architecture.
          Last updated -
          19
          545
          1
          TypeScript
          MIT License
          • Apple
          • Linux
        • -
          security
          F
          license
          -
          quality
          A starter template for building Model Context Protocol (MCP) servers, enabling developers to create and add custom tools that can be integrated with Claude Desktop.
          Last updated -
          TypeScript
          • Apple

        View all related MCP servers

        ID: sm6mi601pc