Provides tools for interacting with Apache OFBiz REST API endpoints, enabling retrieval of product information and other business data from OFBiz instances.
MCP Server for REST APIs
This project provides a prototype implementation of an MCP server that:
exposes specific tools,
receives requests from an MCP client (usually hosted in a generative AI application such as Claude Desktop),
forwards those requests to a remote backend via RESTful API endpoints,
is implemented using the Anthropic SDK for TypeScript.
The server enables generative AI applications to interact with remote systems that expose REST API endpoints, such as Apache OFBiz and Moqui.
The server is implemented in two versions, one that runs as a local MCP server (stdio transport) and one that runs as a remote MCP server (Streamable HTTP transport).
The project is implemented in TypeScript, uses the Anthropic TypeScript SDK, and requires:
Node.js
npm
Table of Contents
Features
The project includes two alternative MCP servers:
Local MCP server (
src/server.ts
) — communicates with the MCP client via stdio transport.Remote MCP server (
src/server-remote.ts
) — communicates with the MCP client via MCP Streamable HTTP transport.
The servers are modular and dynamically discover MCP tools contained in the tools
directory.
Each tool is defined and implemented in its own file. For example, the sample tool tools/findProductById.ts
invokes an endpoint in Apache OFBiz to retrieve product information for a given ID. This works with an out-of-the-box (OOTB) OFBiz instance with the rest-api
plugin installed.
Configuration
Server configuration is managed via config/config.json
, which defines:
BACKEND_API_BASE
— the base URL for backend REST API callsBACKEND_API_AUTH
- the URL to get the OFBiz APIs access tokenBACKEND_AUTH_TOKEN
— the token used to authorize backend API callsSERVER_PORT
— the port on which the MCP server listens for client connections (required only for the remote server)
The authorization token for the OFBiz API can be easily generated and set up by running the script:
update_token.sh <user> <password>
This script retrieves a JWT for an OOTB OFBiz instance (e.g., https://demo-stable.ofbiz.apache.org/rest/auth/token
).
Project Structure
Build the Project
Test the Local MCP Server
You can test the local MCP server with Claude Desktop.
Edit or create the Claude Desktop configuration file:
Add your local MCP server configuration:
After updating the configuration file, launch Claude Desktop and try the following sample prompts:
"Can you provide some information about the product WG-1111?"
"Can you provide some information about a product?"
(Claude will ask for a product ID before invoking the tool.)"Can you compare two products?"
(Claude will ask for two product IDs, invoke the tool twice, and then compare the results.)
Test the Remote MCP Server
Start the server:
You can test the local MCP server with Claude Desktop.
Edit or create the Claude Desktop configuration file:
Add your local MCP server configuration:
Inspect the MCP servers
You can use Anthropic’s Inspector to easily test interactions with the local and remote MCP servers. You can do this also when a remote server is executed in your local host or private network, without requiring valid certificates or deploying the server on a publicly accessible host.
Run (and install) the Inspector with:
This will open a browser window ready to test your MCP servers.