jief123/q-cli-mcp-server
If you are the rightful owner of q-cli-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A FastMCP server implementation that allows other AI agents to interact with Amazon Q CLI through the Model Context Protocol (MCP).
q_chat
Execute Q CLI chat commands with AI assistant
q_whoami
Get current Q CLI user information
q_diagnostic
Run Q CLI diagnostic tests
Q CLI MCP Server
A FastMCP server implementation that allows other AI agents to interact with Amazon Q CLI through the Model Context Protocol (MCP).
Features
- q_chat: Execute Q CLI chat commands with AI assistant
- q_whoami: Get current Q CLI user information
- q_diagnostic: Run Q CLI diagnostic tests
Package Structure
q_mcp_server/
āāā q_cli_mcp/ # Main package directory
ā āāā __init__.py # Package initialization
ā āāā server.py # MCP server implementation
āāā pyproject.toml # Package configuration
āāā requirements.txt # Dependencies
āāā add_to_q.sh # Installation script
āāā README.md # This file
Installation
Method 1: Using the installation script
./add_to_q.sh
Method 2: Manual installation
- Install the package dependencies:
uv sync
- Add to Q CLI:
q mcp add q-cli-proxy --command "uvx" --args "--from /path/to/q_mcp_server q-cli-mcp-server"
Verify Installation
q mcp list
q mcp status --name q-cli-proxy
Usage
Running the server directly
# Using uv (in project environment)
uv run q-cli-mcp-server
# Using uvx (isolated environment)
uvx --from . q-cli-mcp-server
Using with Q CLI
Once added to Q CLI, you can use the tools:
q "Use the q_chat tool to ask: What is 1+1?"
q "Use the q_whoami tool to get user information"
q "Use the q_diagnostic tool to run diagnostics"
Implementation Details
The server uses FastMCP with proper subprocess handling for Q CLI commands:
- Non-interactive mode with trusted tools
- Proper stdin/stdout management
- Environment variable handling
- Robust error handling and logging
- Proper Python package structure with entry points
Example Usage
# Call q_chat tool
result = await session.call_tool("q_chat", {"prompt": "1+1"})
# Call q_whoami tool
result = await session.call_tool("q_whoami", {})
# Call q_diagnostic tool
result = await session.call_tool("q_diagnostic", {})
Files
q_cli_mcp/server.py
: Main MCP server implementationq_cli_mcp/__init__.py
: Package initializationpyproject.toml
: Project and dependency configuration with entry pointsrequirements.txt
: Python dependenciesadd_to_q.sh
: Installation script
Configuration
The MCP server configuration is stored in .amazonq/mcp.json
and uses uvx for dependency isolation with proper package entry points.