How razorpay/razorpay-mcp-server works
Project type and purpose
• This is a Go-based backend microservice (“Razorpay MCP Server”) implementing the Model Context Protocol (MCP).
• Purpose: expose a set of “tools” (fetch_payment, create_order, etc.) over the MCP protocol (stdio/JSON-RPC transport) that in turn call Razorpay’s REST APIs.
• It is intended to be run as a Docker container or a standalone binary and plugged into AI agents (Claude Desktop, VS Code) as an MCP server.
File structure
• cmd/razorpay-mcp-server
• main.go: application entrypoint, parses flags/env, wires up server
• stdio.go: configures the MCP transport over STDIO
• pkg/mcpgo
• server.go: orchestrates the MCP protocol, request routing
• transport.go: defines transport interfaces (stdio, future HTTP, etc.)
• tool.go: common abstractions for registering tools
• pkg/razorpay
• server.go: high-level Razorpay client setup (credentials, HTTP client)
• orders.go, payments.go, refunds.go, payment_links.go: wrappers around specific REST endpoints
• mock/: in-code test server for unit tests
• pkg/log: centralized logging wrapper
• cmd, pkg directories follow a clear separation of concerns (entrypoint vs. business logic vs. transport vs. external integration)
• Top-level config files: Dockerfile, Makefile, goreleaser.yaml, CI workflows, and Go module files
README for additional insights
• Reinforces that this is an MCP server exposing Razorpay APIs as “tools.”
• Describes usage in Docker, direct Go build, and integration into Claude Desktop or VS Code.
• Calls out required environment variables, flags, and optional config (LOG_FILE, TOOLSETS, READ_ONLY).
Summary
• Layers: Entry/CMD, Transport, Core, Tools, External API, Logging.
• Config/flags as input parameters into the container.
• Break monolithic views into separate logical components so that each package’s role is clear.