mcp_llm_inferencer

by Sumedh1599

313 downloads Not rated yet

About

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

Explore

- 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.

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

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'

components = inferencer.generate_components("Generate a tool for sentiment analysis.")

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.