MCP Declarative Server
MCP 宣言型サーバー
モデルコンテキストプロトコル (MCP) サーバーを宣言的に作成するためのユーティリティ モジュール。
インストール
npm install mcp-client-routerRelated MCP server: YA_MCPServer Template
使用法
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
This server cannot be deployed
Maintenance
Related MCP Connectors
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Build your own tools from chat: design, test and host them on a shareable MCP server URL.
1A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA command-line tool for creating and running Model Context Protocol servers that expose resources, tools, and prompts to LLM clients.89 npm1AGPL 3.0
- FlicenseNot gradedqualityDmaintenanceA boilerplate template for developing Model Context Protocol (MCP) servers, providing a structured framework for defining tools, resources, and prompts.-
- AlicenseNot gradedqualityCmaintenanceEmbeds a secure, curated MCP server inside Python applications, exposing explicit tools, resources, and prompts with dependency injection, security policies, and in-memory testing.MIT
- AlicenseNot gradedqualityCmaintenanceEnables developers to build and deploy secure, typed Model Context Protocol servers with tools, resources, prompts, bearer-token authentication, per-tool scopes, rate limiting, and health probes over Streamable HTTP.MIT