Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MCP REST Utilities

Shared REST API utilities for building Model Context Protocol (MCP) servers.

Features

  • RestClient: HTTP client with automatic retries, timeout handling, and error management
  • RestToolFactory: Factory pattern for creating and executing MCP tools
  • Type-safe configuration: TypeScript interfaces for REST tool definitions
  • Error handling: Unified error handling across all servers

Installation

From GitHub

npm install git+https://github.com/munch-group/mcp-rest-utils.git

From source

git clone https://github.com/munch-group/mcp-rest-utils.git
cd mcp-rest-utils
npm install
npm run build

Usage

import { RestClient, RestToolFactory } from "@mcp/rest-utils";

// Create a REST client
const client = new RestClient({
  baseUrl: "https://api.example.com",
  defaultHeaders: { "Content-Type": "application/json" },
  timeout: 30000,
  retries: 3,
});

// Define tools
const tools = [{
  name: "get_data",
  description: "Get data from API",
  method: "GET",
  endpoint: (args) => `/data/${args.id}`,
  inputSchema: { /* ... */ },
}];

// Create tool factory and execute
const factory = new RestToolFactory(client);
const result = await factory.executeTool(tools[0], { id: "123" });

Building

npm run build

License

ISC

About

Shared REST API utilities for building MCP servers

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages