Skip to main content
Glama

MCP Declarative Server

by johnhenry

MCP 宣言型サーバー

モデルコンテキストプロトコル (MCP) サーバーを宣言的に作成するためのユーティリティ モジュール。

インストール

npm install mcp-client-router

使用法

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リファレンス

DeclarativeMCPServer

new DeclarativeMCPServer(options);
オプション
  • name (文字列): サーバーの名前
  • version (文字列): サーバーのバージョン
  • tools (配列):ツール定義の配列
  • prompts (配列): プロンプト定義の配列
  • resources (配列):リソース定義の配列
ツール定義フォーマット
[ 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 ];
プロンプト定義形式
[ 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 ];
リソース定義フォーマット
[ uri, // string: URI of the resource handler, // function: async function to handle the resource request ];

ライセンス

ISC

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

モデル コンテキスト プロトコル サーバーを宣言的に作成するためのユーティリティ モジュール。開発者は簡略化された構文を使用してツール、プロンプト、リソースを簡単に定義できます。

  1. インストール
    1. 使用法
      1. APIリファレンス
        1. DeclarativeMCPServer
      2. ライセンス

        Related MCP Servers

        • -
          security
          A
          license
          -
          quality
          An unofficial JavaScript SDK to create customized servers for the Model Context Protocol, allowing definition of prompts, resources, and tools for tailored interactions.
          Last updated -
          74
          5
          JavaScript
          Apache 2.0
          • Linux
          • Apple
        • A
          security
          A
          license
          A
          quality
          A production-ready template for creating Model Context Protocol servers with TypeScript, providing tools for efficient testing, development, and deployment.
          Last updated -
          1
          732
          34
          JavaScript
          MIT License
        • A
          security
          F
          license
          A
          quality
          A TypeScript-based template for developing Model Context Protocol servers with features like dependency injection and service-based architecture, facilitating the creation and integration of custom data processing tools.
          Last updated -
          1
          2
          4
          TypeScript
        • 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
          1
          Python
          MIT License
          • Linux
          • Apple

        View all related MCP servers

        MCP directory API

        We provide all the information about MCP servers via our MCP API.

        curl -X GET 'https://glama.ai/api/mcp/v1/servers/johnhenry/mcp-declarative-server'

        If you have feedback or need assistance with the MCP directory API, please join our Discord server