MCP Server
MCP Server — пакет Node In Layers для построения MCP-серверов
Эта библиотека добавляет возможность легкого создания серверов MCP с помощью Node In Layers.
У него есть сопутствующая библиотека под названием '@node-in-layers/mcp-client', которая используется для создания клиентов MCP. Эти две библиотеки используют одни и те же функции для определения моделей и инструментов.
Новый слой
Эта библиотека добавляет в систему новый слой mcp . Он должен располагаться после слоя express .
Related MCP server: MCP Bone
Использование
Чтобы использовать эту библиотеку, вам необходимо внести дополнения в свою конфигурацию, а также создать и экспортировать слои «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. ПРИМЕЧАНИЕ. Чтобы это работало, ваш слой должен иметь как слой служб, так и слой функций. (В дополнение к вашим моделям.) Узел в слоях автоматически создаст для вас свойство cruds с вашими моделями, и вы сможете добавить их.
Вот пример того, как это сделать по одному за раз. (Обычно не рекомендуется, но выполнимо).
// /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 {}
}This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityFmaintenanceA comprehensive Model Context Protocol server that provides advanced Node.js development tooling for automating project creation, component generation, package management, and documentation with AI-powered assistance.Last updated79MIT
- Alicense-qualityDmaintenanceA Node.js module that provides an MCP Server connecting to MCP Bone online service, allowing users to register other MCP Servers, obtain function calling tools in JSON or XML format, and parse completion text into tool calls.Last updated27MIT
- Alicense-qualityFmaintenanceA configurable server implementation that provides MCP (Model-Controller-Protocol) functionality, supporting both Node.js and Docker environments with automated setup and configuration options.Last updated305MIT
- AlicenseAqualityDmaintenanceA lightweight framework for building and running Model Context Protocol (MCP) servers using FastMCP, providing tools for development, debugging, and server management.Last updated4MIT
Related MCP Connectors
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
MCP (Model Context Protocol) server for Appwrite
A MCP server built for developers enabling Git based project management with project and personal…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Node-In-Layers/mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server