Sponsored by Deepsite.site

mcp_prompt_mapper

Created By
Sumedh15998 months ago
Generates optimal Claude/OpenAI-ready prompts to build each part of the MCP server (resources, tools, prompts) from the input generated by `mcp_input_analyzer`.
Content

mcp_prompt_mapper

Introduction

mcp_prompt_mapper is an open-source library designed to generate optimal prompts tailored for Claude, Grok, and OpenAI APIs. It transforms input from mcp_input_analyzer into structured, efficient prompts that can be used to build various parts of the MCP server, including resources, tools, and additional prompts.

Features

  • Prompt Templating: Generate custom templates for creating resources and tools.
  • Custom Output Formats: Supports both YAML and JSON formatted outputs optimized for Claude.
  • Cross-API Compatibility: Works seamlessly with Claude, Grok, and OpenAI APIs.
  • Schema-aware Auto-complete Prompts: Ensure prompts are schema-compliant using auto-completion features.
  • Streaming Input Parsing: Efficiently parse streaming inputs directly in Claude Desktop.

Installation Instructions

To install mcp_prompt_mapper, you can use pip:

pip install mcp_prompt_mapper

Alternatively, if you prefer to install from the source, clone this repository and run setup.py:

git clone https://github.com/your-repo/mcp_prompt_mapper.git
cd mcp_prompt_mapper
python setup.py install

Usage Examples

Basic Example

Here is a simple example of how to use mcp_prompt_mapper with default settings.

from mcp_prompt_mapper import PromptMapper

# Initialize the PromptMapper
prompt_mapper = PromptMapper()

# Sample input from mcp_input_analyzer
input_data = {
    "resource_type": "database",
    "tool_name": "sql_query_tool"
}

# Generate prompts
prompts = prompt_mapper.generate_prompts(input_data)

print(prompts)

Advanced Example with Custom Output Format

This example demonstrates how to generate prompts in YAML format.

from mcp_prompt_mapper import PromptMapper

# Initialize the PromptMapper with YAML output format
prompt_mapper = PromptMapper(output_format='yaml')

# Sample input from mcp_input_analyzer
input_data = {
    "resource_type": "api_gateway",
    "tool_name": "http_request_tool"
}

# Generate prompts
prompts = prompt_mapper.generate_prompts(input_data)

print(prompts)

Streaming Input Example

Here's how you can handle streaming input for Claude Desktop.

from mcp_prompt_mapper import PromptMapper

# Initialize the PromptMapper with YAML output format
prompt_mapper = PromptMapper(output_format='yaml')

# Simulate streaming input
streaming_input = [
    {"resource_type": "database", "tool_name": "sql_query_tool"},
    {"resource_type": "api_gateway", "tool_name": "http_request_tool"}
]

for data in streaming_input:
    prompts = prompt_mapper.generate_prompts(data)
    print(prompts)

API Documentation

Class PromptMapper

  • Initialization

    • __init__(self, output_format='json'): Initializes the PromptMapper instance. Accepts an optional output_format parameter that defaults to 'json'. Supported values are 'json' and 'yaml'.
  • Method generate_prompts

    • generate_prompts(self, input_data): Takes a dictionary of input data and generates prompts based on the provided schema. Returns the generated prompts in the specified output format.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Ensure you replace `"https://github.com/your-repo/mcp_prompt_mapper.git"` with the actual URL of your repository if it's different. Additionally, ensure that any other paths or references are correctly updated to match your project setup.


## ⚠️ Development Status

This library is currently in early development. Some tests may be failing with the following issues:


Contributions to fix these issues are welcome! Please submit a pull request if you have a solution.
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
CursorThe AI Code Editor
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Amap Maps高德地图官方 MCP Server
DeepChatYour AI Partner on Desktop
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Serper MCP ServerA Serper MCP Server
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Playwright McpPlaywright MCP server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.