Skip to main content
Glama

MCP JavaScript Server

by davlgd

Servidor MCP - SDK de JavaScript

Este es un SDK de JavaScript no oficial para el Protocolo de Contexto de Modelo .

Uso

Importa el paquete a tu proyecto:

npm install mcp-js-server

Crea archivos para definir las indicaciones, los recursos y las herramientas del servidor.

Indicaciones

// prompts.js export const prompts = { hello_world: { description: 'A simple prompt that says hello.', arguments: [], messages: [{ role: 'assistant', content: { type: 'text', text: 'Hello, world!' } }] } };

Recursos

// resources.js export const resources = { apiReference: { uri: 'https://api.example.com/openapi.json', mimeType: 'application/json' } };

Herramientas

// tools.js export const tools = { simple_tool: { description: 'A simple tool', handler: async () => new Date().toLocaleString(), schema: { type: 'object', properties: {}, required: [] } }, complex_tool: { description: 'A complex tool', handler: async ({ param1, param2 }) => { return `param1: ${param1}, param2: ${param2}`; }, schema: { type: 'object', properties: { param1: { type: 'string' }, param2: { type: 'string' } }, required: ['param1', 'param2'] } } };

Servidor

Luego crea una instancia de servidor con el siguiente código:

// server.js import { MCP } from 'mcp-server'; import { tools } from './tools.js'; import { prompts } from './prompts.js'; import { resources } from './resources.js'; const infos = { name: 'mcp-demo-server', version: '0.1.0' }; const server = new MCP(infos, prompts, resources, tools);

Depuración

Puede encontrar registros del servidor en el directorio de registros del sistema de su usuario:

Linux: ~/.local/share/logs macOS: ~/Library/Logs Windows: %USERPROFILE%\AppData\Local\Logs
-
security - not tested
A
license - permissive license
-
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.

Un SDK de JavaScript no oficial para crear servidores personalizados para el Protocolo de Contexto de Modelo, que permite la definición de indicaciones, recursos y herramientas para interacciones personalizadas.

  1. Uso
    1. Indicaciones
    2. Recursos
    3. Herramientas
    4. Servidor
    5. Depuración

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server built with Express.js that provides cryptographic tools including key pair generation, shared secret derivation, and message encryption/decryption.
    Last updated -
    160
    JavaScript
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol server that provides a scalable backend solution for efficient interaction with Medusa's data models through the JavaScript SDK.
    Last updated -
    246
    1
    TypeScript
    MIT License
  • -
    security
    A
    license
    -
    quality
    A demonstration server that implements the Model Context Protocol (MCP) SDK, providing tools and endpoints for server-sent events and message handling.
    Last updated -
    27
    TypeScript
    MIT License
  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server that provides greeting tools, resources, and prompts, demonstrating client-server interaction using TypeScript.
    Last updated -
    TypeScript

View all related MCP servers

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/davlgd/mcp-js-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server