mcp-gateway-host
A dedicated hosting environment designed to implement the Model Context Protocol (MCP), offering developers a streamlined interface for integrating and managing custom operational modules (tools) within an MCP-compliant architecture.
Author

agentico-dev
Quick Info
Actions
Tags
mcp-gateway-host 
This package provides the core server infrastructure for executing Model Context Protocol interactions, presenting a significantly simplified API surface over raw MCP specifications.
Rationale for Existence
At "La Rebelion", our mission is to streamline development workflows via a suite of innovative services. This server component is foundational to that effort.
While MCP is powerful, its initial setup can present friction. We introduce a Facade pattern implementation here to abstract complexity. The operational model is straightforward: define your custom executable logic as 'tools', register them with the MCPServer instance, and then launch the service.
Deployment Procedure
While a dedicated scaffolding utility is planned (analogous to [MCP create server](https://www.npmjs.com/package/@modelcontextprotocol/create-server)), current setup requires following these sequential steps, closely mirroring the official MCP server setup guide:
bash mkdir -p my-service/source cd my-service/ yarn init -y yarn add @modelcontextprotocol/sdk zod zod-to-json-schema yarn add -D @types/node typescript
Essential dependency injection
yarn add @agentico/mcp-server
Ensure your package.json is configured correctly and a tsconfig.json is present.
Initializing the Service
Develop your modules incorporating distinct functionalities, then integrate them into the MCPServer. Below illustrates the creation of a basic response utility named echo:
typescript import { Tool, ToolSchema } from "@agentico/mcp-server";
export class EchoTool extends Tool { toolSchema: ToolSchema = { name: "echo", description: "Reflects the supplied input message back to the caller", schema: { // Defines the expected input signature for the module type: "object", properties: { message: { type: "string" }, }, required: ["message"], }, };
/*
* Core module execution logic. Implement your desired behavior here.
* @param input The data payload, strongly typed by the schema definition.
* @returns A promise resolving to the service's output structure.
/
async execute(input: any): Promise${input.message}
}
]
});
}
}
Next, construct your entry point, typically named index.ts:
typescript
!/usr/bin/env node
import { MCPServer } from '@agentico/mcp-server' import { EchoTool } from "./tools/EchoTool.js";
const myServer = new MCPServer('My MCP Server', '1.0.0');
async function main() { // Module Registration myServer.registerTool("echo", EchoTool); await myServer.run(); }
main().catch((error) => { console.error("Gateway runtime failure:", error); process.exit(1); });
This completes the basic setup for an MCP-compliant execution host. Verification can be performed using clients supporting the protocol, such as Claude Desktop.
Compile the source code using this command:
bash yarn build
The server can then be initiated for testing:
bash yarn start
Alternatively, execute the compiled artifact directly:
node build/index.js
Proceed to engineer your unique modules and services to optimize your operational pipelines.
Adelante, Rebeldes! ✊🏻
Conceptual Blueprint (UML Overview)
- MCPServer: The central registry responsible for housing and dispatching invoked modules.
- Tool: The abstract foundation for all operational units. It mandates the definition of properties and the implementation of the
executemethod, which dictates the module's runtime behavior. - EchoTool: A concrete extension of the
Toolclass, specifying its unique input contract (schema) and initialization procedures. - EchoSchema: The formal data structure contract required for input validation of the
EchoTool. - EchoInput: The strongly-typed representation of data expected by the
EchoToolbased on its schema.
This architectural schema promotes a decoupled, scalable framework for managing protocol handlers via the MCPServer and its specialized Tool derivatives.
Ways to Provide Support
If this utility proves valuable, we welcome support via repository starring, project contributions, or direct sponsorship.
Details on how to financially support the initiative can be found at La Rebelion GitHub Sponsors. Alternatives include digital patronage via buying us a coffee, utilizing PayPal, or acquiring official "La Rebelion" merchandise.
Licensing
This software is distributed under the terms of the MIT License (refer to the LICENSE file for full disclosures).
