MCP ExplorerExplorer

Mcp Api Wrapper

@upgrade-solutionson 9 months ago
1 MIT
FreeCommunity
AI Systems
This project is an example MCP server built as a wrapper of an existing API.

Overview

What is Mcp Api Wrapper

mcp-api-wrapper is an example MCP server that acts as a wrapper around an existing API, allowing registered tools to be accessed by MCP clients.

Use cases

Use cases include automating support ticket creation, integrating with customer service platforms, and enhancing user interaction through MCP-enabled applications.

How to use

To use mcp-api-wrapper, install dependencies with ‘npm install’, build the project using ‘npm run build’, and run the development server with ‘npm run dev’. Connect the MCP server to clients by adding it to the ‘claude_desktop_config.json’ file.

Key features

Key features include the ability to create support tickets, handle various issue types, and provide a structured API interface for MCP clients.

Where to use

mcp-api-wrapper can be used in customer support systems, application development, and any scenario requiring an API wrapper for easier integration with MCP clients.

Content

mcp-api-wrapper

This project is an example Model Context Protocol (MCP) server built as a wrapper of an existing API. In essence, the MCP server is mounted on an endpoint (e.g. /mcp) and registered tools (on the server object) are made available to MCP hosts/clients.

// index.ts
app.post('/mcp', async (req: Request, res: Response) => {
  try {
    const transport: StreamableHTTPServerTransport = new StreamableHTTPServerTransport({
      sessionIdGenerator: undefined,
    });
    await server.connect(transport);
    await transport.handleRequest(req, res, req.body);
    ...

// mcp-server.ts
server.tool(
  'create_ticket',
  'Creates a new support ticket',
  {
    customer_email: z.string().describe('Customer email address'),
    customer_name: z.string().describe('Customer name'),
    issue_message: z.string().describe('Customer message'),
    issue_type: z.enum(['bug', 'feature_request', 'other']).describe('Type of issue'),
  }
  ...

Quick Start

# Install dependencies
npm install

# Build the project
npm run build

# Run the dev server
npm run dev

MCP Client Connection

To connect Claude to the MCP-wrapped API, add the server to the claude_desktop_config.json file.

{
  "mcpServers": {
    "mcp-api-wrapper": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:4000/mcp"
      ]
    }
  }
}

Now you should be able to prompt Claude with a request to create a support ticket and it will execute the action on the API via MCP.

Could you create a ticket for Mark Evans ([email protected])? He’s encountering a bug where the password reset flow is failing.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers