Related MCP Server Resources

Explore more AI models, providers, and integration options:

  • Explore AI Models
  • Explore AI Providers
  • Explore MCP Servers
  • LangDB Pricing
  • Documentation
  • AI Industry Blog
  • MCP Server
  • Amazon VPC Lattice MCP Server
  • Image Generation MCP Server
  • Gemini MCP Image Generation Server
  • Jira MCP Server
Back to MCP Servers
MCP Declarative Server

MCP Declarative Server

Public
johnhenry/mcp-declarative-server

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

Verified
javascript
0 tools
May 30, 2025
Updated May 30, 2025

MCP Declarative Server

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

Installation

npm install mcp-client-router

Usage

import { MCPDeclarativeServer } from "mcp-client-router/declarative-server"; // Create a server declaratively const server = new MCPDeclarativeServer({ 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

MCPDeclarativeServer

new MCPDeclarativeServer(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

Publicly Shared Threads0

Discover shared experiences

Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!

Share your threads to help others
Related MCPs5
  • MCP Server
    MCP Server

    A Model Context Protocol server that provides greeting tools, resources, and prompts, demonstrating ...

    Added May 30, 2025
  • Amazon VPC Lattice MCP Server
    Amazon VPC Lattice MCP Server

    A Model Context Protocol server that provides tools for accessing and managing AWS VPC Lattice infor...

    2 tools
    Added May 30, 2025
  • Image Generation MCP Server
    Image Generation MCP Server

    A Model Context Protocol server that enables generation of high-quality images using the Flux.1 Schn...

    1 tools
    Added May 30, 2025
  • Gemini MCP Image Generation Server
    Gemini MCP Image Generation Server

    A Model Context Protocol server that provides image generation capabilities using Google's Gemini 2 ...

    1 tools
    Added May 30, 2025
  • Jira MCP Server
    Jira MCP Server

    A Model Context Protocol server that enables AI assistants like Claude to interact with Jira, allowi...

    Added May 30, 2025