Skip to content

Instantly share code, notes, and snippets.

@jimmypocock
Created May 2, 2025 20:41
Show Gist options
  • Save jimmypocock/7a4f303902f41b804bd170f24d2742b8 to your computer and use it in GitHub Desktop.
Save jimmypocock/7a4f303902f41b804bd170f24d2742b8 to your computer and use it in GitHub Desktop.
[PROMPT TEMPLATE] Create an MCP
You are an experienced software architect tasked with creating a Model Context Protocol (MCP) for an AI assistant that interacts with an existing API. This MCP will be open to the public, so security is a critical concern. Your goal is to provide a solid foundation for building this MCP while ensuring it adheres to security best practices and doesn't expose sensitive information.
Here is the relevant information for creating the MCP:
4. API Documentation:
<api_documentation>{{API_DOCUMENTATION}}</api_documentation>
1. API Type:
<api_type>{{JSON_OR_GRAPHQL}}</api_type>
2. MCP Purpose:
<mcp_purpose>{{PURPOSE}}</mcp_purpose>
3. Application Description:
<app_description>{{APP_DESCRIPTION}}</app_description>
5. Security Requirements:
<security_requirements>{{SECURITY_REQUIREMENTS}}</security_requirements>
6. Schemas:
<schemas>{{SCHEMAS}}</schemas>
Your task is to create a comprehensive MCP that can be pushed to a public GitHub repository and used by developers to connect to the application's existing API. Follow these steps to create the MCP:
1. Analyze the app description and API documentation to understand the system's architecture and existing endpoints.
2. Review the security requirements to ensure the MCP adheres to necessary safeguards.
3. Examine the provided schemas to understand the data structure for relevant entities.
4. Design the MCP structure, including input validation and authentication/authorization checks.
5. Implement security measures such as strong authentication, rate limiting, input sanitization, and proper error handling.
6. Restrict data access to only necessary operations and implement field-level permissions if using GraphQL.
7. Implement logging and monitoring for auditing and alerting purposes.
8. Write comprehensive tests, including unit tests, integration tests, and security tests.
9. Document the MCP thoroughly, including usage instructions, available operations, and security best practices.
10. Implement a versioning system for future updates and backwards compatibility.
Throughout the implementation process, prioritize security and adhere to all provided security requirements and best practices for public-facing APIs.
Before providing the final MCP implementation details, work inside <mcp_planning> tags in your thinking block to:
1. Break down the API documentation and schemas into key components.
2. List out potential security vulnerabilities and how to address them.
3. Outline the MCP structure before implementation.
4. Consider potential challenges and ensure all requirements are met.
5. Pay special attention to making the MCP suitable for public GitHub deployment and easy for other developers to understand and use.
After completing your thought process, provide the MCP implementation details in the following format:
<mcp_implementation>
1. High-level overview of the MCP structure and connection to the API:
[Provide a clear, concise explanation of the MCP's architecture and how it interfaces with the existing API]
2. Code snippets for key components:
[Include relevant code snippets for critical parts of the MCP, such as authentication middleware, main MCP methods, etc.]
3. Explanation of security measures implemented:
[Detail the security features incorporated into the MCP and how they protect against potential vulnerabilities]
4. Sample queries and mutations:
[Provide examples of how to use the MCP for its intended purpose, including any necessary authentication steps]
5. Recommendations for additional security measures or efficiency improvements:
[Suggest any further enhancements that could strengthen the MCP's security or performance]
</mcp_implementation>
Remember to make your MCP implementation thorough, well-documented, and suitable for public deployment on GitHub. Ensure that all security considerations are addressed, and the code follows best practices for open-source projects.
Your final output should consist only of the MCP implementation details and should not duplicate or rehash any of the work you did in the planning section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment