MCP Server
mcp-server
MCP Server is a simple server that implements the Model Context Protocol (MCP) to provide a simpler API to interact with the Model Context Protocol.
Why Use This Server?
In "La Rebelion" we are working on a set of tools and services to simplify processes and workflows for a better and more efficient developer experience. This server is part of a set of tools.
MCP is amazing, but it can be a bit confusing to get started. We have create a facade to simplify the process of creating a server that implements the Model Context Protocol. The pattern is simple, you just need to create the tools
with your own logic, register the tools and start the server.
Steps to Create a New Server
In the future we will provide a CLI to create a new server similar to MCP create server, but for now you can follow the steps below based on the official documentation to create a server.
You need to update the package.json
file and create a tsconfig.json
file.
Getting Started
Implement your tools with your custom logic, and register them in the MCPServer. Here is an example of a simple echo
tool:
Create an index.ts
file with the following content:
That's it! You have created a simple server that implements the Model Context Protocol. Test it with Claude Desktop or any other client that supports MCP.
Build the project with the following command:
You can start the server, but has no logic yet, you can test it with the following command:
That's it, start creating your own tools and services to simplify your workflows and processes.
Go Rebels! ✊🏻
UML Diagram
- MCPServer: Registers the tools that will be used by the server.
- Tool: Base class for all tools, containing common properties and methods.
execute
is the method that will be called when the tool is invoked, implement your logic here. - EchoTool: Specific implementation of a tool, extending the Tool class and defining its own schema and initialization logic.
- EchoSchema: Defines the structure of the input for the EchoTool.
- EchoInput: Type definition for the input based on the schema.
This pattern allows for a flexible and extensible way to manage and implement tools using the MCPServer and Tool classes.
Support Us
If you find this useful, please consider supporting us by starring this repository, by contributing to the project or by becoming a sponsor.
You can find more information on how to support us at La Rebelion GitHub Sponsors. Also buying us a coffee, PayPal are great ways to support us or purchasing "La Rebelion" merch.
License
This project is licensed under the MIT License - see the LICENSE file for details.
MCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.