MCP Server

Integrations
  • Integrates with Express web framework, allowing the MCP server to be placed after the Express layer in the application stack and leverage Express for HTTP connections.

MCP サーバー - MCP サーバーを構築するための Node In Layers パッケージ

このライブラリは、Node In Layers を使用して MCP サーバーを簡単に作成する機能を追加します。

MCPクライアントの作成に使用される「@node-in-layers/mcp-client」というコンパニオンライブラリがあります。これら2つのライブラリは、モデルとツールを定義するための同じ機能を共有しています。

新しいレイヤー

このライブラリは、システムに新しいレイヤーmcpを追加します。express expressの後に配置する必要があります。

使用法

このライブラリを使用するには、設定に追加を行うだけでなく、アプリ/ドメインから「mcp」レイヤーを作成してエクスポートする必要があります。

設定

このアプリ/ドメインを設定ファイルに追加します。MCPサーバーにツールを追加するアプリの前に、この作業を行う必要があります。

次に、 mcpアプリ/ドメインを次のように構成します。

const mcpConfig = { // (optional) The name of your MCP server. name: 'mcp', // (optional) The version of your MCP server. version: '1.0.0', // The server config from @l4t/mcp-ai/simple-server/types.js server: { connection: { type: 'http', host: 'localhost', port: 3000, }, }, logging: { // optional // If you want to change the default. Its 'info' by default. requestLogLevel: 'info', // If you want to change the default. Its 'info' by default. responseLogLevel: 'info', }, } const config = { ['@node-in-layers/mcp-server']: mcpConfig, }

MCPレイヤーの作成

アプリ/ドメインからレイヤーを返す関数をエクスポートすることで、MCP レイヤーを作成できます。

// /src/yourDomain/mcp.ts import { McpContext, McpNamespace } from '@node-in-layers/mcp-server' import { Config } from '@node-in-layers/core' import { YourFeaturesLayer } from './features.js' const create = (context: McpContext<Config, YourFeaturesLayer>) => { // Adds your tool. context.mcp[McpNamespace].addTool({ name: 'my-hello-world-tool', description: 'My Tool', execute: async (input: any) => { return 'Hello, world!' }, }) // Create a tool from your feature context.mcp[McpNamespace].addTool({ name: 'my-hello-world-tool', description: 'My Tool', inputSchema: { type: 'object', properties: { name: { type: 'string', }, }, required: ['name'], }, execute: (input: any) => { // You get an object, pass it back to your feature. Handles async for you. return context.features.yourDomain.yourFeature(input) }, }) return {} } export { create }

モデルの追加

モデルをCRUDS関数でラップし、mcpレイヤーを使ってMCPサーバーに追加できます。注:この処理を実行するには、レイヤーにサービスレイヤーと機能レイヤーの両方が必要です(モデルに加えて)。Node in Layersはモデルに自動的にcrudsプロパティを作成するので、これを追加できます。

1 つずつ実行する例を次に示します。(一般的には推奨されませんが、実行可能です)。

// /src/yourDomain/mcp.ts import { McpContext, McpNamespace } from '@node-in-layers/mcp-server' import { Config } from '@node-in-layers/core' import { YourFeaturesLayer } from './features.js' const create = (context: McpContext<Config, YourFeaturesLayer>) => { // Adds your models cruds through features. context.mcp[McpNamespace].addModelCruds( context.features.yourFeature.cruds.Cars ) return {} }

ガスを使って本当に調理できる方法をご紹介します。(超おすすめ)

// /src/yourDomain/mcp.ts import { McpContext, McpNamespace, mcpModels } from '@node-in-layers/mcp-server' import { Config } from '@node-in-layers/core' import { YourFeaturesLayer } from './features.js' const create = (context: McpContext<Config, YourFeaturesLayer>) => { // This automatically adds ALL of your models from features. mcpModels('yourDomain')(context) return {} }

モデルの追加を整理するもう一つの方法は、集中管理されたMCPドメインから行うことです。他のドメインがすべて読み込まれた後、このドメインを最後のドメインとして配置します。

// /src/mcp/mcp.ts import { McpContext, McpNamespace, mcpModels } from '@node-in-layers/mcp-server' import { Config } from '@node-in-layers/core' const create = (context: McpContext<Config>) => { // Add all your models for your whole system in one go. mcpModels('yourDomain')(context) mcpModels('yourDomain2')(context) mcpModels('yourDomain3')(context) mcpModels('yourDomain4')(context) return {} }
-
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.

モデルの定義、CRUD 操作の追加、クライアントとの対話のためのツールを使用して MCP (Model-Control-Protocol) サーバーの作成を簡素化する Node In Layers パッケージ。

  1. 新しいレイヤー
    1. 使用法
      1. 設定
      2. MCPレイヤーの作成
      3. モデルの追加

    Related MCP Servers

    • A
      security
      A
      license
      A
      quality
      A beginner-friendly Model Context Protocol (MCP) server that helps users understand MCP concepts, provides interactive examples, and lists available MCP servers. This server is designed to be a helpful companion for developers working with MCP. Also comes with a huge list of servers you can install.
      Last updated -
      3
      9
      36
      JavaScript
      Apache 2.0
    • -
      security
      A
      license
      -
      quality
      MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.
      Last updated -
      4
      3
      TypeScript
      MIT License
    • -
      security
      -
      license
      -
      quality
      A specialized server that helps users create new Model Context Protocol (MCP) servers by providing tools and templates for scaffolding projects with various capabilities.
      Last updated -
      1
      TypeScript
    • -
      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: k0fzi30a7o