Tool Generator SDK
No description available
Ask AI about Tool Generator SDK
Powered by Claude Β· Grounded in docs
I know everything about Tool Generator SDK. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
MCP Tool Generator
MCP (Model Context Protocol) Tool Generator is an automated server generator for MCP projects. It uses OpenAPI 3.x-compliant Swagger files to create MCP servers efficiently, streamlining the integration and deployment process with minimal changes.
Installation
Clone the repository:
git clone https://github01.hclpnp.com/SPARC-Development-Lab/mcp_scaffolder.git
cd mcp_scaffolder
Project Structure
MCP/
βββ mcp_tool_generator/
β βββ __init__.py
β βββ client_utils.py
β βββ file_handling_generator.py
β βββ jwt_authentication.py
β βββ model_utils.py
β βββ openapi_utils.py
β βββ output_utils.py
β βββ server_init.py
β βββ wrapper_utils.py
βββ .env
βββ main.py
βββ swagger.json or swagger.yaml
βββ included_endpoints.json
File Description
__init__.pyβ Package initializer.client_utils.pyβ Utilities for client-side operations and interactions.file_handling_generator.pyβ Generates file attachment handler code with validation and encoding support.jwt_authentication.pyβ Generates JWT token verifier code with AWS Secrets Manager integration.model_utils.pyβ Functions for model management and manipulation.openapi_utils.pyβ Helpers for working with OpenAPI specifications and related tasks.output_utils.pyβ Output formatting and processing utilities.server_init.pyβ Server initialization logic and configuration.wrapper_utils.pyβ General-purpose wrapper functions for various utilities..envβ Environment variable definitions for configuration.main.pyβ Entry point script for running the MCP Tool Generator.swagger.json/swagger.yamlβ OpenAPI specification files describing API endpoints.included_endpoints.jsonβ List of API endpoints to include in server generation.
Download Dependencies
Before running the MCP Tool Generator, ensure that Python 3.11.9 is installed on your system. Install all required dependencies as specified in the requirements.txt file.
Use the following command in the shell to install them:
pip install -r requirements.txt
Usage
OPENAPI Compliance Check
Check the compliance of an OpenAPI Swagger file against the OpenAPI 3.0 specification before generating the MCP server. It is recommended to use the 'spectral' package for linting and validating the OpenAPI document to ensure it adheres to the required standards.This helps prevent issues during server generation and ensures best practices are followed.
Environment Setup
Configure the .env file with your LLM (Large Language Model) credentials and any other required environment variables before running the MCP Tool Generator.
Tool Execution
To run the MCP Tool Generator, execute the main.py script with the appropriate command-line arguments as shown below:
python main.py -p <path_to_swagger_file> -o <mcp_server_output_file_name.py> -im <get,put> -od <output_directory_path>
To generate an MCP server for only the endpoints specified in included_endpoints.json, use the following command:
python main.py -p <path_to_swagger_file> -o <mcp_server_output_file_name.py> -iep <included_endpoints_json_file_name.json> -od <output_directory_path>
After Running the Tool
Generated Output Structure
Once the MCP Tool Generator completes execution, your project directory will include the following structure:
MCP/
βββ mcp_tool_generator/
βββ MCPServer_dir/
β βββ client/ # Auto generated Client-related files
β βββ mcpserver.py # Generated MCP server script
β βββ ssl.cert # SSL certificate to be added by user
β βββ ssl.key # SSL key to be added by user
|
βββ .env
βββ main.py
βββ swagger.json or swagger.yaml
βββ included_endpoints.json
SSL certificate generation
Refer - OpenSSL
