@cmmv/mcp MCP server module for CMMV applications

@cmmv/mcp MCP server module for CMMV applications

cmmv-mcp•bycmmvio

An implementation of the Model Context Protocol server for CMMV applications that exposes decorator-registered tools to large language models over HTTP, SSE, or standard I/O.

License: Not specified•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Registers callable MCP tools on class methods using the @MCPTool decorator, with parameter schemas defined via Zod.
  • •Supports multiple transports: StreamableHTTP, SSE, and standard I/O.
  • •Can run standalone or integrate into an existing CMMV HTTP server, adding MCP routes such as /mcp, /messages, /mcp/health, and /mcp/tools.
  • •Manages multiple concurrent MCP sessions with session ID tracking and includes built-in health check and tools listing endpoints.

BEST FOR

  • •Developers building CMMV applications who want to expose application functionality as tools to LLMs via MCP.
  • •Teams needing to add an MCP endpoint alongside an existing HTTP server on the same port.

ABOUT CMMV-MCP

@cmmv/mcp MCP server module for CMMV applications is cataloged as an MCP server attributed to cmmvio. An implementation of the Model Context Protocol server for CMMV applications that exposes decorator-registered tools to large language models over HTTP, SSE, or standard I/O. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for @cmmv/mcp MCP server module for CMMV applications are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

Which transports does the module support?

It supports transport via HTTP (StreamableHTTP), SSE, or standard I/O.

Can MCP run on the same port as an existing CMMV HTTP server?

Yes, when integrateWithHttp is true the MCP routes are added to the existing HTTP server, for example on the same port.

Upstream README

View this exact version on GitHub

README.md · 47b6661a4b80 · Fetched 2026-11-13 11:31:29 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

CMMV Logo

Contract-Model-Model-View (CMMV)
Building scalable and modular applications using contracts.

NPM Version Package License

Documentation • Report Issue

Description

The @cmmv/mcp module implements the Model Context Protocol (MCP) for CMMV applications, allowing standardized interactions between LLMs (Large Language Models) and your application. MCP provides a structured interface for defining tools usable by AI models in a standard format.

Features

  • LLM Integration: Facilitates bidirectional communication between your application and language models.
  • Flexible Transport: Supports transport via HTTP (StreamableHTTP), SSE, or Standard I/O.
  • API Decorator-Based: Intuitive decorators like @MCPTool to register tools.
  • Validation with Zod: Input schema validation using Zod.
  • Connection Management: Robust implementation for handling multiple concurrent connections.
  • Modern SDK: Uses the latest @modelcontextprotocol/sdk with StreamableHTTPServerTransport.
  • HTTP Server Integration: Can integrate with existing CMMV HTTP server or run standalone.
  • Legacy SSE Support: Maintains compatibility with SSE endpoints (/sse, /messages).
  • Session Management: Support for multiple concurrent MCP sessions with session ID tracking.
  • Health Monitoring: Built-in health check (/mcp/health) and tools listing (/mcp/tools) endpoints.
  • CORS Support: Configurable CORS for cross-origin requests.
  • DNS Rebinding Protection: Configurable DNS rebinding protection for security.
  • Hook Integration: Seamless integration using CMMV's hook system.
  • TypeScript: Full TypeScript support with enhanced type safety.
  • Error Handling: Comprehensive error handling with proper HTTP status codes.

Installation

Install @cmmv/mcp via pnpm:

$ pnpm add @cmmv/mcp

Configuration

Configure the MCP module in your .cmmv.config.cjs or using ConfigSchema:

import { ConfigSchema } from '@cmmv/core';

export const MCPConfig: ConfigSchema = {
  mcp: {
    name: {
      type: 'string',
      required: true,
      default: 'mcp',
    },
    version: {
      type: 'string',
      required: true,
      default: '0.0.1',
    },
    port: {
      type: 'number',
      required: true,
      default: 8765,
    },
    transport: {
      type: 'string',
      required: true,
      default: 'http', // 'http', 'sse' or 'stdio'
    },
    integrateWithHttp: {
      type: 'boolean',
      required: false,
      default: false, // Integrate with existing HTTP server
    },
    jwtSecret: {
      type: 'string',
      required: true,
      default: 'your-secret-key',
    },
    pingInterval: {
      type: 'number',
      required: true,
      default: 30000,
    },
    connectionTimeout: {
      type: 'number',
      required: true,
      default: 300000,
    },
  },
};

Setting Up the Application

Standalone Mode (Default)

In your main file, include the MCPModule and configure your application:

import { Application, Config } from '@cmmv/core';
import { DefaultAdapter, DefaultHTTPModule } from '@cmmv/http';
import { MCPModule } from '@cmmv/mcp';
import { MCPHandlers } from './mcp-handlers';

Config.assign({
    mcp: {
        port: 8766,
        transport: 'http',
        name: 'cmmv-mcp-server',
        version: '1.0.0',
        integrateWithHttp: false, // Standalone mode
    },
});

Application.create({
    httpAdapter: DefaultAdapter,
    modules: [MCPModule],
    providers: [MCPHandlers],
});

Integrated Mode (Same Port as HTTP Server)

To integrate MCP with your existing HTTP server:

import { Application, Config } from '@cmmv/core';
import { DefaultAdapter, DefaultHTTPModule } from '@cmmv/http';
import { MCPModule } from '@cmmv/mcp';
import { MCPHandlers } from './mcp-handlers';

Config.assign({
    mcp: {
        port: 3000, // Same port as your HTTP server
        transport: 'http',
        name: 'cmmv-mcp-server',
        version: '1.0.0',
        integrateWithHttp: true, // Integrate with existing HTTP server
    },
});

Application.create({
    httpAdapter: DefaultAdapter,
    modules: [MCPModule],
    providers: [MCPHandlers],
});

When integrateWithHttp: true, the MCP routes will be added to your existing HTTP server:

  • POST /mcp - StreamableHTTP transport
  • GET /mcp - SSE transport (legacy)
  • POST /messages - Messages endpoint (legacy)
  • GET /mcp/health - Health check
  • GET /mcp/tools - List available tools

Creating MCP Tool Handlers

Use the @MCPTool decorator to register tools callable by LLMs:

import { MCPTool, z } from '@cmmv/mcp';

export class MCPHandlers {
    @MCPTool('greet', {
        name: z.string(),
        age: z.number(),
    })
    public async greet({ name, age }: { name: string; age: number }) {
        return {
            content: `Hello \${name}, you are \${age} years old`,
        };
    }
}

Using the MCP Client

The MCP client can connect to your server using the HTTP endpoint:

curl -X POST http://localhost:8765/mcp \\
  -H "Content-Type: application/json" \\
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "greet",
      "arguments": {
        "name": "John",
        "age": 30
      }
    }
  }'

Health Check

You can check the server health:

curl http://localhost:8765/health

List Available Tools

You can list all available tools:

curl http://localhost:8765/tools

Decorators

@MCPTool(name: string, schema: Record<string, z.ZodSchema>)

Registers a method as an MCP tool with a name and validation schema.

Best Practices

  • Define Schemas Clearly: Use Zod schemas to clearly define parameters for each tool.
  • Provide Meaningful Responses: Return structured and helpful responses for LLMs.
  • Handle Errors Gracefully: Implement robust error handling in your handlers.
  • Security First: Consider using JWT for public endpoints.
  • Performance: Use timeouts and keep handlers lightweight and fast.

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for @cmmv/mcp MCP server module for CMMV applications from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/cmmv-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools