Sponsored by Deepsite.site

MCP CLI Application

Created By
richard-senior6 months ago
A GO based MCP server for use with AmazonQ or any other MCP capable LLM Agent
Content

MCP CLI Application

This is a CLI application for the Model Context Protocol (MCP) that can be invoked by Amazon Q.

Overview

MCP is an open protocol that standardizes how applications provide context to LLMs. This CLI application implements the MCP protocol to extend Amazon Q's capabilities by providing additional tools and context.

Project Structure

  • /cmd/mcp: Main application entry point
  • /internal: Private application and library code
    • /internal/logger: Logging utilities
    • /internal/processor: MCP request processing logic
  • /pkg: Library code that's ok to use by external applications
  • /api: OpenAPI/Swagger specs, JSON schema files, protocol definition files
  • /configs: Configuration file templates or default configs
  • /test: Additional external test apps and test data

Building and Running

To build the application:

./build.sh

To build and run the application:

./run.sh [options]

Command Line Options

  • --debug: Enable debug logging
  • --input <file>: Input file path (if not provided, stdin will be used)
  • --output <file>: Output file path (if not provided, stdout will be used)

Tools and Features

The MCP application provides several tools that extend Amazon Q's capabilities:

1. Calculator

A calculator tool that can perform basic arithmetic operations.

Example Usage:

./bin/mcp "calculate 2 + 2"

Amazon Q Usage:

Calculate the square root of 144

2. Prompt Registry

A tool to manage and retrieve prompts from a local prompt registry. Prompts are stored in ~/.mcp/prompts directory.

Example Usage:

# List all available prompts
./bin/mcp "list_prompts"

# Get a specific prompt by ID
./bin/mcp "get_prompt my-prompt-id"

Amazon Q Usage:

Show me the available prompts in the prompt registry
Get the prompt with ID 'code-review'

How Amazon Q Uses the Prompt Registry:

Amazon Q can use the prompt registry to access pre-defined prompts for specific tasks. When a user asks Amazon Q to perform a task that matches a stored prompt, Amazon Q can:

  1. Retrieve the prompt template from the registry
  2. Fill in any variables based on the user's request
  3. Use the completed prompt to generate a more accurate and consistent response

This is particularly useful for specialized tasks like code reviews, documentation generation, or domain-specific queries where a carefully crafted prompt can significantly improve the quality of responses.

3. Rule Creator

A tool to create and manage development standard rules for different tools.

Example Usage:

# Create a new rule
./bin/mcp "create_rule amazonq my-rule \"Description of the rule\" \"*.go\" true \"Rule content here\""

# List rules for a specific tool
./bin/mcp "list_rules amazonq"

Amazon Q Usage:

Create a new rule for Amazon Q that enforces proper error handling in Go files
List all the rules for the Cursor tool

4. Rules Processor

A tool to process files against development standard rules.

Example Usage:

# Process a file against rules
./bin/mcp "process_rules /path/to/registry.json /path/to/file.go"

# Get content of a specific rule
./bin/mcp "get_rule_content rule-id /path/to/registry.json"

Amazon Q Usage:

Check if my main.go file follows our development standards
Show me the content of the Go error handling rule

A tool to perform Google searches and return the top results.

Example Usage:

# Search with default number of results (5)
./bin/mcp "googlesearch \"quantum computing advances 2025\""

# Search with specified number of results
./bin/mcp "googlesearch \"quantum computing advances 2025\" 10"

Amazon Q Usage:

Search Google for recent advances in quantum computing
Find the top 10 results for sustainable energy solutions

6. Wikipedia Image

A tool to search for images on Wikipedia.

Example Usage:

# Search for an image with default size
./bin/mcp "wikipediaimage \"Albert Einstein\""

# Search for an image with specified size
./bin/mcp "wikipediaimage \"Albert Einstein\" 800"

Amazon Q Usage:

Find a Wikipedia image of Albert Einstein
Get a large image of the Eiffel Tower from Wikipedia

7. Wikipedia Image Save

A tool to search for images on Wikipedia and save them to disk.

Example Usage:

./bin/mcp "wikipediaimagesave \"Albert Einstein\" 500 /path/to/save/einstein.jpg"

Amazon Q Usage:

Save a Wikipedia image of the Mona Lisa to my desktop
Download a picture of Mount Everest from Wikipedia to my documents folder

Configuration for Amazon Q

To configure Amazon Q to use this MCP application, add the following to your ~/.aws/amazonq/mcp.json file:

{
  "mcpServers": {
    "mcp": {
      "command": "/path/to/mcp",
      "description": "MCP server providing various utility tools",
      "tools": {
        "calculator": {
          "description": "A calculator tool that can perform basic arithmetic operations"
        },
        "prompt_registry": {
          "description": "A tool to manage and retrieve prompts from the prompt registry"
        },
        "rule_creator": {
          "description": "A tool to create and manage development standard rules"
        },
        "rules_processor": {
          "description": "A tool to process files against development standard rules"
        },
        "google_search": {
          "description": "A tool to perform Google searches and return the top results"
        },
        "wikipedia_image": {
          "description": "A tool to search for images on Wikipedia"
        },
        "wikipedia_image_save": {
          "description": "A tool to save Wikipedia images to disk"
        }
      }
    }
  }
}

Development

This project follows the standard Go project layout and coding standards.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

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

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
DeepChatYour AI Partner on Desktop
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
CursorThe AI Code Editor
Serper MCP ServerA Serper MCP Server
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
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.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Amap Maps高德地图官方 MCP Server
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
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.
Playwright McpPlaywright MCP server
ChatWiseThe second fastest AI chatbot™
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
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"
Tavily Mcp
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.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors