Cover image
Try Now
2025-03-21

Biblioteca para autogenerarse el servidor MCP y el código del cliente basado en un esquema YAML especificado

3 years

Works with Finder

1

Github Watches

1

Github Forks

1

Github Stars

AutoMCP

AutoMCP Logo

AutoMCP is a code generator for the Model Context Protocol that automatically creates server and client code based on YAML service definitions.

This is a work in progress. The repo contains artifacts that will be removed when finalized for packaging for npm, pypl, etc.

Please refer to MCP Agent to have an idea of how you could use this in agentic workflows.

Features

  • Generates MCP-compatible server code
  • Generates client libraries for easy service consumption
  • Creates handler stubs for implementing tool functionality
  • Organizes code by service in dedicated directories

Getting Started

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Installation

  1. Clone this repository
  2. Install dependencies:
    npm install
    

Usage

Defining a Service

Create a YAML file in the services/[service-name]/ directory with the following structure:

service:
  name: ServiceName
  version: 1.0.0
  description: Description of your service

tools:
  - name: toolName
    description: Description of what the tool does
    parameters:
      - name: paramName
        type: string
        description: Description of the parameter
    returns:
      type: string
      description: Description of what the tool returns

Generating Code

Run the generator script:

./bin/automcp.sh generate

This will:

  1. Create server code in generated/[service-name]/[service-name]_server.ts
  2. Create client code in generated/[service-name]/[service-name]_client.ts
  3. Create handler stubs in src/custom/[service-name]/[tool-name]Handlers.ts

Implementing Handlers

Edit the generated handler files in src/custom/[service-name]/ to implement your tool functionality.

Using the Generated Clients

import { ServiceNameClient } from "./generated/service-name/service_name_client.js";

async function main() {
  const client = new ServiceNameClient();

  try {
    await client.connect();

    // Call a tool
    const result = await client.toolName({ paramName: "value" });
    console.log(result);
  } finally {
    await client.disconnect();
  }
}

main().catch(console.error);

Example

See the examples/client_example.ts file for a complete example of using the generated clients.

Testing

Use the test script to verify the functionality of your services:

./bin/test-service.sh [service-name]

Temporary Directory Structure (will be improved for packaging)

.
├── bin/                    # Scripts
├── examples/               # Example usage
├── generated/              # Generated code
│   ├── service-name/       # Service-specific generated code
│   │   ├── service_name_server.ts
│   │   └── service_name_client.ts
├── services/               # Service definitions
│   └── service-name/       # Service-specific YAML files
├── src/                    # Source code
│   ├── custom/             # Custom handler implementations
│   │   └── service-name/   # Service-specific handlers
│   │       └── toolHandlers.ts
│   └── generator.ts        # Code generator
└── templates/              # Code templates
    ├── client.ts.ejs       # Client template
    └── server.ts.ejs       # Server template

Future Plans

  • Support for multiple programming languages
  • Add custom typing so schemas do not drift from generated code
  • Integration with existing MCP solutions
  • Implement with prompts and resource mechanisms
  • Enhanced composition mechanisms for complex tool chains

License

MIT

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Beniyam Berhanu
  • Therapist adept at identifying core issues and offering practical advice with images.

  • INFOLAB OPERATIONS 2
  • A medical specialist offering assistance grounded in clinical guidelines. Disclaimer: This is intended for research and is NOT safe for clinical use!

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • OffchainLabs
  • Implementación de la prueba de estaca Ethereum

  • huahuayu
  • Una puerta de enlace de API unificada para integrar múltiples API de explorador de blockchain similar a Esterscan con soporte de protocolo de contexto modelo (MCP) para asistentes de IA.

  • deemkeen
  • Controle su MBOT2 con un combo de potencia: MQTT+MCP+LLM

  • jae-jae
  • Servidor MCP para obtener contenido de la página web con el navegador sin cabeza de dramaturgo.

  • HiveNexus
  • Un bot de chat de IA para equipos pequeños y medianos, que apoyan modelos como Deepseek, Open AI, Claude y Gemini. 专为中小团队设计的 ai 聊天应用 , 支持 Deepseek 、 Open ai 、 Claude 、 Géminis 等模型。

    Reviews

    3 (1)
    Avatar
    user_B8EncOrh
    2025-04-15

    I've been using the Remote MCP Server on Cloudflare by juramaia-ai, and it has greatly improved my workflow. The integration is seamless and the performance is outstanding. I appreciate the reliability and security it offers, making remote management very efficient. Highly recommend to anyone looking for a robust server solution!