MCP Server

MCP Server

A Node In Layers package that simplifies creation of MCP (Model-Control-Protocol) servers with tools for defining models, adding CRUD operations, and interacting with clients.

Category
Visit Server

README

MCP Server - A Node In Layers Package for building MCP Servers

This library adds the ability to easily create MCP servers with Node In Layers.

It has a companion library called '@node-in-layers/mcp-client' which is used for creating MCP clients. These two libraries share the same functions for defining models and tools.

New Layer

This library adds a new layer mcp to the system. It should be placed after the express layer.

Usage

In order to use this library, you must make additions to your config, as well as create and export "mcp" layers from your apps/domains.

Config

you add this app/domain to your config file. You should do this before your apps which will add tools to the MCP server.

You then configure the mcp app/domain with the following:

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,
}

Creating an MCP Layer

You can create an MCP layer by exporting a function from your app/domain that returns a layer.

// /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 }

Adding Models

You can wrap your models with CRUDS functions and add them to the MCP server with the mcp layer. NOTE: In order for this to work your layer must have both a services and a features layer. (In addition to your models.) Node in layers will automatically create a cruds property for you with your models, and you can add them.

Here is an example of doing it one at a time. (Not generally recommended, but doable).

// /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 {}
}

Here is a way that you can really cook with gas. (Highly recommended)

// /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 {}
}

Another way to organize adding models is from a centralized mcp domain. Put this as your very last domain after all your other domains have been loaded.

// /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 {}
}

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured