### Example: Fetch Resource Tool (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md A complete example of a Go tool for fetching a resource by ID using the Razorpay MCP server. It includes parameter definition, validation, API call, and response handling. ```go // FetchResource returns a tool that fetches a resource by ID func FetchResource( log *slog.Logger, client *rzpsdk.Client, ) mcpgo.Tool { parameters := []mcpgo.ToolParameter{ mcpgo.WithString( "id", mcpgo.Description("Unique identifier of the resource"), mcpgo.Required(), ), } handler := func( ctx context.Context, r mcpgo.CallToolRequest, ) (*mcpgo.ToolResult, error) { // Create validator and a payload map payload := make(map[string]interface{}) v := NewValidator(&r). ValidateAndAddRequiredString(payload, "id") // Check for validation errors if result, err := validator.HandleErrorsIfAny(); result != nil { return result, err } // Extract validated ID and make API call id := payload["id"].(string) resource, err := client.Resource.Fetch(id, nil, nil) if err != nil { return mcpgo.NewToolResultError( fmt.Sprintf("fetching resource failed: %s", err.Error()))), nil } return mcpgo.NewToolResultJSON(resource) } return mcpgo.NewTool( "fetch_resource", "Fetch a resource from Razorpay by ID", parameters, handler, ) } ``` -------------------------------- ### Local Development Setup (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Instructions for setting up the local development environment for Razorpay MCP Server, including Go installation, dependency management, and setting environment variables for API keys. ```bash # Install dependencies go mod download # Set environment variables export RAZORPAY_KEY_ID=your_key_id export RAZORPAY_KEY_SECRET=your_key_secret ``` -------------------------------- ### MCPGO Usage Example Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/mcpgo/README.md Demonstrates how to create an MCP server, define a tool with parameters, add the tool to the server, and run a stdio transport server. ```go package main import ( "context" "log" "os" "github.com/razorpay/razorpay-mcp-server/mcpgo" ) func main() { // Create a server server := mcpgo.NewServer( "my-server", "1.0.0", mcpgo.WithLogging(), mcpgo.WithToolCapabilities(true), ) // Create a tool tool := mcpgo.NewTool( "my_tool", "Description of my tool", []mcpgo.ToolParameter{ mcpgo.WithString( "param1", mcpgo.Description("Description of param1"), mcpgo.Required(), ), }, func(ctx context.Context, req mcpgo.CallToolRequest) (*mcpgo.ToolResult, error) { // Extract parameter value param1Value, ok := req.Arguments["param1"] if !ok { return mcpgo.NewToolResultError("Missing required parameter: param1"), nil } // Process and return result return mcpgo.NewToolResultText("Result: " + param1Value.(string)), nil }, ) // Add tool to server server.AddTools(tool) // Create and run a stdio server stdioServer, err := mcpgo.NewStdioServer(server) if err != nil { log.Fatalf("Failed to create stdio server: %v", err) } err = stdioServer.Listen(context.Background(), os.Stdin, os.Stdout) if err != nil { log.Fatalf("Server error: %v", err) } } ``` -------------------------------- ### Define MCP Tool Parameters (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md Illustrates how to define parameters for MCP tools using mcpgo helpers. It shows examples for required and optional parameters, specifying their type, name, and description. ```go // Required parameters mcpgo.WithString( "parameter_name", mcpgo.Description("Description of the parameter"), mcpgo.Required(), ) // Optional parameters mcpgo.WithNumber( "amount", mcpgo.Description("Amount in smallest currency unit"), ) ``` -------------------------------- ### GolangCI-Lint Configuration File Example Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md An example snippet showing the structure and purpose of the `.golangci.yaml` file, which configures golangci-lint. It lists various linters and checks used for code quality. ```yaml # .golangci.yaml # Our linting configuration is defined in .golangci.yaml and includes: # - Code style checks (gofmt, goimports) # - Static analysis (gosimple, govet, staticcheck) # - Security checks (gosec) # - Complexity checks (gocyclo) # - And more ``` -------------------------------- ### Install and Run GolangCI-Lint Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Installs the golangci-lint tool and then runs it to perform static analysis, code quality checks, and linting on the Go project. ```bash # Install golangci-lint if you don't have it go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest # Run the linter golangci-lint run ``` -------------------------------- ### Install Node.js on Windows Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Installs Node.js, which includes npm and npx, on Windows using Chocolatey. This is a prerequisite for using the Razorpay MCP Server. ```bash # Install Node.js (which includes npm and npx) using Chocolatey choco install nodejs # Alternatively, download from https://nodejs.org/ ``` -------------------------------- ### Go Payment Fetching Tool Example Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/mcpgo/README.md Illustrates the creation of a payment fetching tool using the Razorpay MCP server package in Go. It defines parameters, handles arguments, fetches payment details via the `rzpsdk.Client`, and returns results or errors. Requires `slog`, `rzpsdk`, and `mcpgo`. ```go import ( "context" "fmt" "log/slog" "github.com/razorpay/razorpay-go" "github.com/mark3labs/mcp-go" ) // FetchPayment returns a tool that fetches payment details using payment_id func FetchPayment( log *slog.Logger, client *rzpsdk.Client, ) mcpgo.Tool { parameters := []mcpgo.ToolParameter{ mcpgo.WithString( "payment_id", mcpgo.Description("payment_id is unique identifier of the payment to be retrieved."), mcpgo.Required(), ), } handler := func( ctx context.Context, r mcpgo.CallToolRequest, ) (*mcpgo.ToolResult, error) { arg, ok := r.Arguments["payment_id"] if !ok { return mcpgo.NewToolResultError( "payment id is a required field"), nil } id, ok := arg.(string) if !ok { return mcpgo.NewToolResultError( "payment id is expected to be a string"), nil } payment, err := client.Payment.Fetch(id, nil, nil) if err != nil { return mcpgo.NewToolResultError( fmt.Sprintf("fetching payment failed: %s", err.Error()))), nil } return mcpgo.NewToolResultJSON(payment) } return mcpgo.NewTool( "fetch_payment", "fetch payment details using payment id.", parameters, handler, ) } ``` -------------------------------- ### Build Razorpay MCP Server Docker Image Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Steps to clone the Razorpay MCP Server repository and build a Docker image locally for deployment or testing. Ensure Docker is installed and running. ```bash # Run the server git clone https://github.com/razorpay/razorpay-mcp-server.git cd razorpay-mcp-server docker build -t razorpay-mcp-server:latest . # Once built, replace 'razorpay/mcp' with 'razorpay-mcp-server:latest' in VS Code configurations. ``` -------------------------------- ### Verify npx Installation Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Verifies that npx is installed and accessible in the system's PATH. ```bash npx --version ``` -------------------------------- ### Go Unit Test Structure for Razorpay Tools Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md Demonstrates the standard pattern for writing unit tests for tools in the Razorpay MCP Server project. It includes defining API paths, mock responses, test cases with request/response data, and running tests using `runToolTest`. ```go func Test_ToolName(t *testing.T) { // Define API path that needs to be mocked apiPathFmt := fmt.Sprintf( "/%s%s/%%s", constants.VERSION_V1, constants.PAYMENT_URL, ) // Define mock responses successResponse := map[string]interface{}{ "id": "resource_123", "amount": float64(1000), "currency": "INR", // Other expected fields } // Define test cases tests := []RazorpayToolTestCase{ { Name: "successful case with all parameters", Request: map[string]interface{}{ "key1": "value1", "key2": float64(1000), // All parameters for a complete request }, MockHttpClient: func() (*http.Client, *httptest.Server) { return mock.NewHTTPClient( mock.Endpoint{ Path: fmt.Sprintf(apiPathFmt, "path_params") // or just apiPath. DO NOT add query params here. Method: "POST", // or "GET" for fetch operations Response: successResponse, }, ) }, ExpectError: false, ExpectedResult: successResponse, }, { Name: "missing required parameter", Request: map[string]interface{}{ // Missing a required parameter }, MockHttpClient: nil, // No HTTP client needed for validation errors ExpectError: true, ExpectedErrMsg: "missing required parameter: param1", }, { Name: "multiple validation errors", Request: map[string]interface{}{ // Missing required parameters and/or including invalid types "optional_param": "invalid_type", // Wrong type for a parameter }, MockHttpClient: nil, // No HTTP client needed for validation errors ExpectError: true, ExpectedErrMsg: "Validation errors:\n- missing required parameter: param1\n- invalid parameter type: optional_param", }, // Additional test cases for other scenarios } // Run the tests for _, tc := range tests { t.Run(tc.Name, func(t *testing.T) { runToolTest(t, tc, ToolFunction, "Resource Name") }) } } ``` -------------------------------- ### GolangCI-Lint Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Instructions for installing and running golangci-lint for code quality checks. It also mentions the configuration file `.golangci.yaml` which defines various static analysis and code style checks. ```bash # Install golangci-lint if you don't have it go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest # Run the linter golangci-lint run ``` -------------------------------- ### Install Node.js on macOS Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Installs Node.js, which includes npm and npx, on macOS using Homebrew. This is a prerequisite for using the Razorpay MCP Server. ```bash # Install Node.js (which includes npm and npx) using Homebrew brew install node # Alternatively, download from https://nodejs.org/ ``` -------------------------------- ### Run Razorpay MCP Server Locally Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Starts the Razorpay MCP Server in development mode using Go. The 'stdio' argument likely indicates the communication interface. ```go go run ./cmd/razorpay-mcp-server/main.go stdio ``` -------------------------------- ### Running the Server Locally Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Command to run the Razorpay MCP Server in development mode. This command starts the server, allowing for local testing and debugging. ```go go run ./cmd/razorpay-mcp-server/main.go stdio ``` -------------------------------- ### Define MCP Tool Structure (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md Provides a template for defining a new tool within the Razorpay MCP server. It outlines the function signature, parameter definition, and handler logic for API interactions. ```go // ToolName returns a tool that [description of what it does] func ToolName( log *slog.Logger, client *rzpsdk.Client, ) mcpgo.Tool { parameters := []mcpgo.ToolParameter{ // Parameters defined here } handler := func( ctx context.Context, r mcpgo.CallToolRequest, ) (*mcpgo.ToolResult, error) { // Parameter validation // API call // Response handling return mcpgo.NewToolResultJSON(response) } return mcpgo.NewTool( "tool_name", "A description of the tool. NOTE: Add any exceptions/rules if relevant for the LLMs.", parameters, handler, ) } ``` -------------------------------- ### Define CreateResource Tool (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md Defines a tool for creating a new resource in Razorpay. It specifies parameters like amount, currency, and description, and includes a handler function to validate input and call the Razorpay client's Create method. This tool is designed to be registered with the MCP server. ```go import ( "context" "fmt" "log/slog" "github.com/razorpay/razorpay-mcp-server/pkg/mcpgo" "github.com/razorpay/razorpay-mcp-server/pkg/rzpsdk" ) // CreateResource returns a tool that creates a new resource func CreateResource( log *slog.Logger, client *rzpsdk.Client, ) mcpgo.Tool { parameters := []mcpgo.ToolParameter{ mcpgo.WithNumber( "amount", mcpgo.Description("Amount in smallest currency unit"), mcpgo.Required(), ), mcpgo.WithString( "currency", mcpgo.Description("Three-letter ISO code for the currency"), mcpgo.Required(), ), mcpgo.WithString( "description", mcpgo.Description("Brief description of the resource"), ), } handler := func( ctx context.Context, r mcpgo.CallToolRequest, ) (*mcpgo.ToolResult, error) { // Create payload map and validator data := make(map[string]interface{}) v := NewValidator(&r). ValidateAndAddRequiredInt(data, "amount"). ValidateAndAddRequiredString(data, "currency"). ValidateAndAddOptionalString(data, "description") // Check for validation errors if result, err := validator.HandleErrorsIfAny(); result != nil { return result, err } // Call the API with validated data resource, err := client.Resource.Create(data, nil) if err != nil { return mcpgo.NewToolResultError( fmt.Sprintf("creating resource failed: %s", err.Error()))), nil } return mcpgo.NewToolResultJSON(resource) } return mcpgo.NewTool( "create_resource", "Create a new resource in Razorpay", parameters, handler, ) } ``` -------------------------------- ### Register Tools in Toolsets (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md Demonstrates how to register tools within the Razorpay MCP Server by organizing them into toolsets based on resource type (e.g., payments, paymentLinks, orders). Each toolset can manage read-only and write tools separately, allowing for read-only mode configurations. ```go // NewToolSets creates and configures all available toolsets func NewToolSets( log *slog.Logger, client *rzpsdk.Client, enabledToolsets []string, readOnly bool, ) (*toolsets.ToolsetGroup, error) { // Create a new toolset group toolsetGroup := toolsets.NewToolsetGroup(readOnly) // Create toolsets payments := toolsets.NewToolset("payments", "Razorpay Payments related tools"). AddReadTools( FetchPayment(log, client), // Add your read-only payment tool here ). AddWriteTools( // Add your write payment tool here ) paymentLinks := toolsets.NewToolset( "payment_links", "Razorpay Payment Links related tools"). AddReadTools( FetchPaymentLink(log, client), // Add your read-only payment link tool here ). AddWriteTools( CreatePaymentLink(log, client), // Add your write payment link tool here ) orders := toolsets.NewToolset("orders", "Razorpay Orders related tools"). AddReadTools( FetchOrder(log, client), // Add your read-only order tool here ). AddWriteTools( CreateOrder(log, client), // Add your write order tool here ) // If adding a new resource type, create a new toolset: /* newResource := toolsets.NewToolset("new_resource", "Razorpay New Resource related tools"). AddReadTools( FetchNewResource(log, client), ). AddWriteTools( CreateNewResource(log, client), ) toolsetGroup.AddToolset(newResource) */ // Add toolsets to the group toolsetGroup.AddToolset(payments) toolsetGroup.AddToolset(paymentLinks) toolsetGroup.AddToolset(orders) return toolsetGroup, nil } ``` -------------------------------- ### Validate MCP Tool Parameters (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/razorpay/README.md Demonstrates parameter validation within an MCP tool handler using a fluent validator pattern. It shows how to validate and add parameters to a payload map, including common pagination and expand parameters. ```go // Create a new validator v := NewValidator(&r) // Create a map for API request parameters payload := make(map[string]interface{}) // Validate and add parameters to the payload with method chaining v.ValidateAndAddRequiredString(payload, "id"). ValidateAndAddOptionalString(payload, "description"). ValidateAndAddRequiredInt(payload, "amount"). ValidateAndAddOptionalInt(payload, "limit") // Validate and add common parameters v.ValidateAndAddPagination(payload). ValidateAndAddExpand(payload) // Check for validation errors if result, err := validator.HandleErrorsIfAny(); result != nil { return result, err } // Proceed with API call using validated parameters in payload ``` -------------------------------- ### Build Razorpay MCP Server from Source Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Instructions to clone the Razorpay MCP Server repository and compile the executable binary directly from the source code. This binary can then be used in VS Code settings. ```bash # Clone the repository git clone https://github.com/razorpay/razorpay-mcp-server.git cd razorpay-mcp-server # Build the binary go build -o razorpay-mcp-server ./cmd/razorpay-mcp-server # Example VS Code configuration for local binary: # { # "razorpay": { # "command": "/path/to/razorpay-mcp-server", # "args": ["stdio","--log-file=/path/to/rzp-mcp.log"], # "env": { # "RAZORPAY_KEY_ID": "", # "RAZORPAY_KEY_SECRET" : "" # } # } # } ``` -------------------------------- ### MCPGO Parameter Helper Functions Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/mcpgo/README.md Provides convenience functions for creating different types of tool parameters, specifying their name, description, and whether they are required. ```go mcpgo.WithString(name, description string, required bool) ``` ```go mcpgo.WithNumber(name, description string, required bool) ``` ```go mcpgo.WithBoolean(name, description string, required bool) ``` ```go mcpgo.WithObject(name, description string, required bool) ``` ```go mcpgo.WithArray(name, description string, required bool) ``` -------------------------------- ### Running Tests (Go) Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Commands for executing tests within the project. Includes running all tests and running tests with coverage reporting, generating an HTML report for analysis. ```go # Run all tests go test ./... # Run tests with coverage go test -coverprofile=coverage.out ./... git tool cover -html=coverage.out ``` -------------------------------- ### Core Development Commands Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Common make commands for running tests, formatting code, linting, building, and running the server locally. These are essential for maintaining code quality and development workflow. ```bash make test make fmt make lint make build make run ``` -------------------------------- ### Run Go Tests with Coverage Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Runs Go tests and generates a coverage profile. The profile can then be visualized as an HTML report. ```go go test -coverprofile=coverage.out ./... go tool cover -html=coverage.out ``` -------------------------------- ### MCPGO Tool Result Helper Functions Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/pkg/mcpgo/README.md Offers utility functions for creating structured results from tool executions, supporting text, JSON data, or error messages. ```go mcpgo.NewToolResultText(text string) ``` ```go mcpgo.NewToolResultJSON(data interface{}) ``` ```go mcpgo.NewToolResultError(text string) ``` -------------------------------- ### Razorpay MCP Server Configuration Options Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Details on the configuration parameters and command-line flags required or supported by the Razorpay MCP Server for customization and operation. ```APIDOC Server Configuration: Environment Variables: - RAZORPAY_KEY_ID: Your Razorpay API key ID (Required). - RAZORPAY_KEY_SECRET: Your Razorpay API key secret (Required). - LOG_FILE (optional): Path to log file for server logs. Defaults to './logs'. - TOOLSETS (optional): Comma-separated list of toolsets to enable. Defaults to 'all'. - READ_ONLY (optional): Run server in read-only mode. Defaults to false. Command Line Flags: - --key or -k: Your Razorpay API key ID. - --secret or -s: Your Razorpay API key secret. - --log-file or -l: Path to log file. Overrides LOG_FILE environment variable. - --toolsets or -t: Comma-separated list of toolsets to enable. Overrides TOOLSETS environment variable. - --read-only: Run server in read-only mode. Overrides READ_ONLY environment variable. Debugging: - Use standard Go debugging tools. - Log files can be specified using the --log-file flag. ``` -------------------------------- ### Run Go Tests Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Executes all tests within the project's Go modules. This is essential for verifying code correctness. ```go go test ./... ``` -------------------------------- ### Cursor MCP Server Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Configuration snippet for integrating Razorpay MCP Server with Cursor. It specifies the command to run the remote server and environment variables for authentication. ```json { "mcpServers": { "rzp-sse-mcp-server": { "command": "npx", "args": [ "mcp-remote", "https://mcp.razorpay.com/sse", "--header", "Authorization:${AUTH_HEADER}" ], "env": { "AUTH_HEADER": "Bearer " } } } } ``` -------------------------------- ### VS Code MCP Server Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Configuration for the Razorpay MCP Server within VS Code settings, specifying input prompts for credentials and server execution details using a Docker image. ```json { "mcp": { "inputs": [ { "type": "promptString", "id": "razorpay_key_id", "description": "Razorpay Key ID", "password": false }, { "type": "promptString", "id": "razorpay_key_secret", "description": "Razorpay Key Secret", "password": true } ], "servers": { "razorpay": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "RAZORPAY_KEY_ID", "-e", "RAZORPAY_KEY_SECRET", "razorpay/mcp" ], "env": { "RAZORPAY_KEY_ID": "${input:razorpay_key_id}", "RAZORPAY_KEY_SECRET": "${input:razorpay_key_secret}" } } } } } ``` -------------------------------- ### Fork-Based Git Workflow Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Steps for contributing to the project using a fork-based Git workflow. This includes cloning the repository, setting up remotes, creating branches, committing changes, and syncing with the upstream repository. ```bash git clone https://github.com/YOUR-USERNAME/razorpay-mcp-server.git cd razorpay-mcp-server git remote add upstream https://github.com/razorpay/razorpay-mcp-server.git git checkout -b username/feature git commit -m "[type]: description of the change" git fetch upstream git rebase upstream/main git push origin username/feature ``` -------------------------------- ### Claude Desktop MCP Server Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Configuration snippet for integrating Razorpay MCP Server with Claude Desktop. It specifies the command to run the remote server and the authorization header. ```json { "mcpServers": { "rzp-sse-mcp-server": { "command": "npx", "args": [ "mcp-remote", "https://mcp.razorpay.com/sse", "--header", "Authorization: Bearer " ] } } } ``` -------------------------------- ### Set Environment Variables for Razorpay Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Sets the necessary environment variables for authenticating with the Razorpay API. Replace placeholders with your actual keys. ```bash export RAZORPAY_KEY_ID=your_key_id export RAZORPAY_KEY_SECRET=your_key_secret ``` -------------------------------- ### VS Code Local MCP Server Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Configure VS Code to use the Razorpay MCP server via Docker. This JSON snippet specifies the server command and environment variables for authentication, similar to the Claude Desktop configuration. ```JSON { "mcpServers": { "razorpay-mcp-server": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "RAZORPAY_KEY_ID", "-e", "RAZORPAY_KEY_SECRET", "razorpay/mcp" ], "env": { "RAZORPAY_KEY_ID": "your_razorpay_key_id", "RAZORPAY_KEY_SECRET": "your_razorpay_key_secret" } } } } ``` -------------------------------- ### Claude Desktop Local MCP Server Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Configure Claude Desktop to use the Razorpay MCP server via Docker. This JSON snippet specifies the server command and environment variables for authentication. ```JSON { "mcpServers": { "razorpay-mcp-server": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "RAZORPAY_KEY_ID", "-e", "RAZORPAY_KEY_SECRET", "razorpay/mcp" ], "env": { "RAZORPAY_KEY_ID": "your_razorpay_key_id", "RAZORPAY_KEY_SECRET": "your_razorpay_key_secret" } } } } ``` -------------------------------- ### Razorpay Instant Settlement API Operations Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md API operations for managing instant settlements in Razorpay. This allows creating instant settlements and fetching lists or specific details of instant settlements. ```APIDOC Razorpay Instant Settlement APIs: create_instant_settlement - Create an instant settlement. - Related: fetch_all_instant_settlements, fetch_instant_settlement_with_id fetch_all_instant_settlements - Fetch all instant settlements. - Related: create_instant_settlement, fetch_instant_settlement_with_id fetch_instant_settlement_with_id - Fetch instant settlement with ID. - Related: create_instant_settlement, fetch_all_instant_settlements ``` -------------------------------- ### Razorpay Order Operations API Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Manages Razorpay orders, including creation, fetching details, listing all orders, updating order information, and retrieving payments associated with an order. ```APIDOC Order Operations: - create_order Description: Creates a new order in Razorpay. API Reference: https://razorpay.com/docs/api/orders/create/ - fetch_order Description: Fetches details for a specific order using its ID. Parameters: - order_id: The unique identifier for the order. API Reference: https://razorpay.com/docs/api/orders/fetch-with-id - fetch_all_orders Description: Retrieves a list of all created orders, with support for filtering. API Reference: https://razorpay.com/docs/api/orders/fetch-all - update_order Description: Updates an existing order. Parameters: - order_id: The unique identifier for the order. - updated_fields: Fields to be updated (e.g., amount, currency). API Reference: https://razorpay.com/docs/api/orders/update - fetch_order_payments Description: Retrieves all payments associated with a specific order. Parameters: - order_id: The unique identifier for the order. API Reference: https://razorpay.com/docs/api/orders/fetch-payments/ ``` -------------------------------- ### Commit Message Format Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/CONTRIBUTING.md Defines the standard format for Git commit messages, specifying types like chore, feat, fix, ref, and test, along with a descriptive message. This ensures consistency and clarity in the commit history. ```bash git commit -m "[type]: description of the change" Where type is one of: - chore: for tasks like adding linter config, GitHub Actions, addressing PR review comments, etc. - feat: for adding new features like a new fetch_payment tool - fix: for bug fixes - ref: for code refactoring - test: for adding UTs or E2Es Example: git commit -m "feat: add payment verification tool" ``` -------------------------------- ### Razorpay QR Code Operations API Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Manages Razorpay QR codes, including creation, fetching QR codes by ID or customer ID, and listing all generated QR codes. ```APIDOC QR Code Operations: - create_qr_code Description: Creates a new QR code. API Reference: https://razorpay.com/docs/api/qr-codes/create/ - fetch_qr_code Description: Fetches details for a specific QR code using its ID. Parameters: - qr_id: The unique identifier for the QR code. API Reference: https://razorpay.com/docs/api/qr-codes/fetch-with-id/ - fetch_all_qr_codes Description: Retrieves a list of all generated QR codes. API Reference: https://razorpay.com/docs/api/qr-codes/fetch-all/ - fetch_qr_codes_by_customer_id Description: Fetches QR codes associated with a specific customer ID. Parameters: - customer_id: The ID of the customer whose QR codes are to be fetched. API Reference: https://razorpay.com/docs/api/qr-codes/fetch-customer-id/ ``` -------------------------------- ### Razorpay Payment Link Operations API Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Enables the creation, retrieval, and management of Razorpay payment links. Supports standard payment links, UPI-specific links, sending links via SMS/email, and updating existing links. ```APIDOC Payment Link Operations: - create_payment_link Description: Creates a new standard payment link. API Reference: https://razorpay.com/docs/api/payments/payment-links/create-standard - create_payment_link_upi Description: Creates a new payment link specifically for UPI transactions. API Reference: https://razorpay.com/docs/api/payments/payment-links/create-upi - fetch_all_payment_links Description: Retrieves a list of all created payment links. API Reference: https://razorpay.com/docs/api/payments/payment-links/fetch-all-standard - fetch_payment_link Description: Fetches details for a specific payment link using its ID. Parameters: - payment_link_id: The unique identifier for the payment link. API Reference: https://razorpay.com/docs/api/payments/payment-links/fetch-id-standard/ - send_payment_link Description: Resends a payment link to the customer via SMS or email. Parameters: - payment_link_id: The unique identifier for the payment link. API Reference: https://razorpay.com/docs/api/payments/payment-links/resend - update_payment_link Description: Updates an existing standard payment link. Parameters: - payment_link_id: The unique identifier for the payment link. - updated_fields: Fields to be updated (e.g., amount, description). API Reference: https://razorpay.com/docs/api/payments/payment-links/update-standard ``` -------------------------------- ### VS Code Remote MCP Server Configuration Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Configure VS Code to connect to the Razorpay Remote MCP Server using a merchant token for authentication. This JSON snippet defines the MCP server settings within VS Code's `settings.json` file. ```JSON { "mcp": { "inputs": [ { "type": "promptString", "id": "merchant_token", "description": "Razorpay Merchant Token", "password": true } ], "servers": { "razorpay-remote": { "command": "npx", "args": [ "mcp-remote", "https://mcp.razorpay.com/sse", "--header", "Authorization: Bearer ${input:merchant_token}" ] } } } } ``` -------------------------------- ### Razorpay Refund Operations API Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Handles refund transactions within Razorpay. This includes creating refunds, fetching refund details by ID, listing all refunds, updating refund notes, and retrieving specific or multiple refunds for a payment. ```APIDOC Refund Operations: - create_refund Description: Creates a new refund for a payment. API Reference: https://razorpay.com/docs/api/refunds/create-instant/ - fetch_refund Description: Fetches details for a specific refund using its ID. Parameters: - refund_id: The unique identifier for the refund. API Reference: https://razorpay.com/docs/api/refunds/fetch-with-id/ - fetch_all_refunds Description: Retrieves a list of all refunds, with support for filtering. API Reference: https://razorpay.com/docs/api/refunds/fetch-all - update_refund Description: Updates the 'notes' field of an existing refund. Parameters: - refund_id: The unique identifier for the refund. - notes: A key-value map for additional notes. API Reference: https://razorpay.com/docs/api/refunds/update/ - fetch_multiple_refunds_for_payment Description: Retrieves all refunds associated with a given payment ID. Parameters: - payment_id: The ID of the payment for which to fetch refunds. API Reference: https://razorpay.com/docs/api/refunds/fetch-multiple-refund-payment/ - fetch_specific_refund_for_payment Description: Fetches a specific refund for a given payment ID. Parameters: - payment_id: The ID of the payment. - refund_id: The specific refund ID to fetch. API Reference: https://razorpay.com/docs/api/refunds/fetch-specific-refund-payment/ ``` -------------------------------- ### Razorpay Payment Operations API Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Provides API endpoints for managing Razorpay payments. This includes changing payment status, fetching payment details, retrieving card information, listing all payments with filtering, and updating payment notes. ```APIDOC Payment Operations: - capture_payment Description: Changes the payment status from authorized to captured. API Reference: https://razorpay.com/docs/api/payments/capture - fetch_payment Description: Fetches payment details using the payment ID. Parameters: - payment_id: The unique identifier for the payment. API Reference: https://razorpay.com/docs/api/payments/fetch-with-id - fetch_payment_card_details Description: Retrieves card details associated with a specific payment. API Reference: https://razorpay.com/docs/api/payments/fetch-payment-expanded-card - fetch_all_payments Description: Fetches a list of all payments, supporting filtering and pagination. API Reference: https://razorpay.com/docs/api/payments/fetch-all-payments - update_payment Description: Updates the 'notes' field of an existing payment. Parameters: - payment_id: The unique identifier for the payment. - notes: A key-value map for additional notes. API Reference: https://razorpay.com/docs/api/payments/update ``` -------------------------------- ### Generate Razorpay Merchant Token Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md Command to generate a merchant token for authenticating with the Remote MCP Server. This involves base64 encoding your Razorpay API Key and API Secret. ```Bash echo : | base64 ``` -------------------------------- ### Razorpay QR Code API Operations Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md API operations for managing QR Codes within the Razorpay ecosystem. These methods allow fetching QR codes by payment ID, fetching payments associated with a QR code, and closing a QR code. ```APIDOC Razorpay QR Code APIs: fetch_qr_codes_by_payment_id - Fetch QR Codes with Payment ID. - Related: fetch_payments_for_qr_code fetch_payments_for_qr_code - Fetch Payments for a QR Code. - Related: fetch_qr_codes_by_payment_id close_qr_code - Closes a QR Code. ``` -------------------------------- ### Razorpay Settlement API Operations Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md API operations for managing settlements in Razorpay. This includes fetching all settlements, fetching settlement details by ID, and retrieving settlement reconciliation reports. ```APIDOC Razorpay Settlement APIs: fetch_all_settlements - Fetch all settlements. - Related: fetch_settlement_with_id, fetch_settlement_recon_details fetch_settlement_with_id - Fetch settlement details. - Related: fetch_all_settlements, fetch_settlement_recon_details fetch_settlement_recon_details - Fetch settlement reconciliation report. - Related: fetch_all_settlements, fetch_settlement_with_id ``` -------------------------------- ### Razorpay Payout API Operations Source: https://github.com/razorpay/razorpay-mcp-server/blob/main/README.md API operations for managing payouts in Razorpay. These methods enable fetching all payout details, including account numbers, and fetching specific payout details by ID. ```APIDOC Razorpay Payout APIs: fetch_all_payouts - Fetch all payout details with A/c number. - Related: fetch_payout_by_id fetch_payout_by_id - Fetch the payout details with payout ID. - Related: fetch_all_payouts ```