mcp_llm_inferencer

by Sumedh1599

313 downloads
Not rated
GitHub

About

Uses Claude or OpenAI API to convert prompt-mapped input into concrete MCP server components such as tools, resource templates, and prompt handlers.

Details

Author
Sumedh1599
Downloads
313
Categories
AI

- LLM call engine with built-in retry and fallback logic.
- Interchangeable support for Claude and OpenAI APIs.
- Streaming support for Claude Desktop responses.
- Tool and resource response validation before deployment.
- Structured output bundling per component.

Clone the repository, install with pip, and set API keys as environment variables (CLAUDE_API_KEY or OPENAI_API_KEY). Initialize the MCPInferencer class with the desired API type ('claude' or 'openai') and call generate_components(prompt) to produce MCP components. Optionally enable streaming by setting stream=True when using Claude.

mcp_llm_inferencer

Introduction

The mcp_llm_inferencer is an open-source library designed to leverage the power of Large Language Models (LLMs) such as Claude and OpenAI's GPT to convert prompt-mapped inputs into concrete components for MCP servers. These components include tools, resource templates, and prompt handlers, making it a versatile tool for developers working with MCP server environments.

Features

- LLM Call Engine: Efficiently calls LLMs with built-in retry and fallback logic to ensure reliable responses.
- Interchangeable Claude & OpenAI Support: Seamlessly switch between Claude and OpenAI APIs based on your preference or availability.
- Streaming Support for Claude Desktop: Stream responses directly from Claude Desktop, providing real-time feedback.
- Tool and Resource Response Validation: Ensures that the generated tools and resources meet predefined criteria before deployment.
- Structured Output Bundling: Organizes output into structured bundles per component, simplifying integration and use.

Installation Instructions

Prerequisites

- Python 3.6 or higher - An API key from Claude or OpenAI

Installing mcp_llm_inferencer

1. Clone the repository:

    git clone https://github.com/your-repo/mcp_llm_inferencer.git
cd mcp_llm_inferencer

2. Install the package using pip:

    pip install .

3. Set up your API keys as environment variables:
- For Claude:

        export CLAUDE_API_KEY='your-claude-api-key'

- For OpenAI:
        export OPENAI_API_KEY='your-openai-api-key'

Usage Examples

Basic Example

Here is a simple example demonstrating how to use mcp_llm_inferencer with the OpenAI API:

```python
from mcp_llm_inferencer import MCPInferencer

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.