Skip to content

audibleblink/mcpmap

Repository files navigation

mcpmap

A command-line tool for interacting with Model Context Protocol (MCP) servers.

Features

  • Multiple Transport Support: Connect to MCP servers using SSE (Server-Sent Events) or Streamable-HTTP transport
  • Authentication Support: Bearer token authentication for secure MCP servers
  • Proxy Support: Route HTTP requests through an HTTP proxy server
  • Smart Type Conversion: Automatically convert CLI parameters to correct types based on tool schemas
  • Tool Execution: Execute tools on MCP servers with typed parameters
  • Resource Listing: List available resources, tools, and prompts
  • Tab Completion: Smart tab completion for tool names and parameters
  • File-based Caching: Caches server metadata for faster tab completion and offline access

Caching

mcpmap includes a file-based cache system that significantly improves performance, especially for tab completion operations.

Cache Behavior

  • Automatic Caching: Server metadata (tools, resources, prompts) is automatically cached after first access
  • Fast Tab Completion: Tab completion uses cached data when available, falling back to live server queries
  • Platform-specific Locations: Cache files are stored in OS-appropriate directories:
    • Linux/macOS: $XDG_CACHE_HOME/mcpmap or ~/.cache/mcpmap
    • Windows: %LOCALAPPDATA%\mcpmap\cache

Installation

go build -o mcpmap

Examples

Basic Usage

# Connect to a local MCP server and list all tools
mcpmap --sse=http://localhost:3000 list tools

# Execute a file reading tool with tab completion
mcpmap --sse=http://localhost:3000 exec read_file --param path=/etc/hosts

# List resources with JSON output
mcpmap --sse=http://localhost:3000 list resources --json

Advanced Usage

# Use HTTP transport with a proxy server
mcpmap --http=http://localhost:8080 --proxy=http://proxy.example.com:8080 list tools

# Connect to an authenticated MCP server
mcpmap --sse=https://mcp.sentry.dev/sse --token=your-bearer-token list tools

# Execute a tool with multiple typed parameters
mcpmap --sse=http://localhost:3000 exec process_data \
  --param input_file="/path/to/data.csv" \
  --param batch_size=1000 \
  --param parallel=true \
  --param options='{"format":"json","compress":true}'

Type Conversion

mcpmap automatically converts CLI parameters to their expected types based on the tool's JSON schema:

Type CLI Input Examples Converted To Notes
string hello, "hello world" string Handles quoted strings
integer 42, -10 int64 Rejects decimals
number 3.14, -0.5, 42 float64 Accepts integers
boolean true, yes, 1, on bool Case-insensitive
array [1,2,3], a,b,c []any JSON or CSV format
object {"key":"value"} map[string]any JSON required

Error Handling

When type conversion fails, mcpmap provides helpful error messages:

$ mcpmap exec search --param limit=abc
Error: parameter "limit" (type: integer): cannot convert "abc"
Hint: Use whole numbers like 42 or -10

$ mcpmap exec toggle --param enabled=maybe
Error: parameter "enabled" (type: boolean): cannot convert "maybe"
Hint: Use true/false, yes/no, 1/0, or on/off

About

List Resources, Tools, and Prompts. Execute Tools.

Resources

Stars

Watchers

Forks

Languages