Skip to content

Add MCP server localhost_3030 #200

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions servers/localhost_3030/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/
node_modules/
.gitignore
tsconfig.json
237 changes: 237 additions & 0 deletions servers/localhost_3030/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
# @open-mcp/localhost_3030

## Using the remote server

To use the hosted Streamable HTTP server, add the following to your client config:

```json
{
"mcpServers": {
"localhost_3030": {
"transport": "streamableHttp",
"url": "https://mcp.open-mcp.org/api/server/localhost_3030@latest/mcp"
}
}
}
```

#### Forwarding variables

You can forward "environment" variables to the remote server by including them in the request headers or URL query string (headers take precedence). Just prefix the variable name with `FORWARD_VAR_` like so:

```ini
https://mcp.open-mcp.org/api/server/localhost_3030@latest/mcp?FORWARD_VAR_OPEN_MCP_BASE_URL=https%3A%2F%2Fapi.example.com
```

<Callout title="Security" type="warn">
Sending authentication tokens as forwarded variables is not recommended
</Callout>

## Installing locally

If you want to run the server locally on your own machine instead of using the remote server, first set the environment variables as shell variables:

```bash
API_KEY='...'
```

Then use the OpenMCP config CLI to add the server to your MCP client:

### Claude desktop

```bash
npx @open-mcp/config add localhost_3030 \
~/Library/Application\ Support/Claude/claude_desktop_config.json \
--API_KEY=$API_KEY
```

### Cursor

Run this from the root of your project directory or, to add to all cursor projects, run it from your home directory `~`.

```bash
npx @open-mcp/config add localhost_3030 \
.cursor/mcp.json \
--API_KEY=$API_KEY
```

### Other

```bash
npx @open-mcp/config add localhost_3030 \
/path/to/client/config.json \
--API_KEY=$API_KEY
```

### Manually

If you don't want to use the helper above, add the following to your MCP client config manually:

```json
{
"mcpServers": {
"localhost_3030": {
"command": "npx",
"args": ["-y", "@open-mcp/localhost_3030"],
"env": {"API_KEY":"..."}
}
}
}
```

## Environment variables

- `OPEN_MCP_BASE_URL` - overwrites the base URL of every tool's underlying API request
- `API_KEY` - gets sent to the API provider

## Tools

### expandSchema

Expand the input schema for a tool before calling the tool

**Input schema**

- `toolName` (string)
- `jsonPointers` (array)

### healthcheck

**Environment variables**

- `API_KEY`

**Input schema**

No input parameters

### getmetrics

**Environment variables**

- `API_KEY`

**Input schema**

No input parameters

### snshealthcheck

**Environment variables**

- `API_KEY`

**Input schema**

No input parameters

### reprocessbycorrelation

**Environment variables**

- `API_KEY`

**Input schema**

- `correlations` (array)
- `reprocessing_description` (string)

### reprocessbyapplication

**Environment variables**

- `API_KEY`

**Input schema**

- `reprocessing_date` (string)
- `application_id` (string)
- `reprocessing_description` (string)

### reprocessbypayment

**Environment variables**

- `API_KEY`

**Input schema**

- `payments` (array)
- `reprocessing_description` (string)

### createadjustmentrecord

**Environment variables**

- `API_KEY`

**Input schema**

- `chargeback` (boolean)
- `company_id` (string)
- `workspace_id` (string)
- `application_id` (string)
- `correlation_id` (string)
- `nsu` (string)
- `authorization_code` (string)
- `tid` (string)
- `brand` (string)
- `acquirer` (string)
- `payment_method` (string)
- `installments` (integer)
- `current_installment` (integer)
- `paid_amount` (number)
- `total_invoice_amount` (number)
- `interest_rate` (number)
- `transaction_date` (string)
- `original_date` (string)
- `transaction_type` (string)
- `reference_id` (string)
- `receita_tarifa_servico_b2c` (number)
- `receita_taxa_parcelamento` (number)
- `receita_b2b` (number)
- `receita_aluguel_pos` (number)
- `mdr` (number)
- `anticipation_expenses` (number)
- `tax_expenses` (number)
- `transfer_date` (string)
- `liquid_final_amount` (number)
- `adjustment_origin` (string)
- `adjustment_detail` (string)
- `export_date` (string)
- `nseq_pedido` (string)
- `entity_document` (string)
- `tipo_client_b2c` (string)
- `invoice_count` (integer)
- `capture_date` (string)

### getholidays

**Environment variables**

- `API_KEY`

**Input schema**

- `country` (string)
- `year` (string)

### getforecast

**Environment variables**

- `API_KEY`

**Input schema**

- `payment_id` (string)

### compensatearrangements

**Environment variables**

- `API_KEY`

**Input schema**

No input parameters
36 changes: 36 additions & 0 deletions servers/localhost_3030/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@open-mcp/localhost_3030",
"version": "0.0.1",
"main": "dist/index.js",
"type": "module",
"bin": {
"localhost_3030": "./dist/index.js"
},
"files": [
"dist"
],
"scripts": {
"clean": "rm -rf dist",
"copy-json-schema": "mkdir -p dist/tools && find src/tools -type d -name 'schema-json' -exec sh -c 'mkdir -p dist/tools/$(dirname {} | sed \"s/src\\/tools\\///\") && cp -r {} dist/tools/$(dirname {} | sed \"s/src\\/tools\\///\")/' \\;",
"prebuild": "npm run clean && npm run copy-json-schema",
"build": "tsc && chmod 755 dist/index.js",
"test": "echo \"No test specified\"",
"prepublishOnly": "npm install && npm run build && npm run test"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.9.0",
"@open-mcp/core": "latest",
"zod": "^3.24.2"
},
"devDependencies": {
"@types/node": "^22.14.1",
"typescript": "^5.8.3"
},
"publishConfig": {
"access": "public"
}
}
15 changes: 15 additions & 0 deletions servers/localhost_3030/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export const OPENAPI_URL = "https://s3.filebin.net/filebin/1e49f31a6119c2e9b14f334f770bd537d54a71bb07dde0d1554c3637f2d4f5d8/d910ba2ef878f7db0223a966b81c8b3f3b65027bb39e4431bb05140171eece39?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=7pMj6hGeoKewqmMQILjm%2F20250602%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250602T155302Z&X-Amz-Expires=60&X-Amz-SignedHeaders=host&response-cache-control=max-age%3D60&response-content-disposition=inline%3B%20filename%3D%22openapi.yaml%22&response-content-type=text%2Fplain%3B%20charset%3Dutf-8&X-Amz-Signature=b18d0d3dd278ab9f73ba15a951e3cb837c4a47d093732ca61d92d3ffe44fa91e"
export const SERVER_NAME = "localhost_3030"
export const SERVER_VERSION = "0.0.1"
export const OPERATION_FILES_RELATIVE = [
"./tools/healthcheck/index.js",
"./tools/getmetrics/index.js",
"./tools/snshealthcheck/index.js",
"./tools/reprocessbycorrelation/index.js",
"./tools/reprocessbyapplication/index.js",
"./tools/reprocessbypayment/index.js",
"./tools/createadjustmentrecord/index.js",
"./tools/getholidays/index.js",
"./tools/getforecast/index.js",
"./tools/compensatearrangements/index.js"
]
28 changes: 28 additions & 0 deletions servers/localhost_3030/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env node

const TOOLS_ARG_NAME = "--tools"

function parseCSV(csv: string | undefined) {
if (!csv) {
return undefined
}
const arr = csv
.trim()
.split(",")
.filter((x) => x !== "")
return arr.length > 0 ? arr : undefined
}

import("./server.js").then((module) => {
const args = process.argv.slice(2)
const toolsCSV = args
.find((arg) => arg.startsWith(TOOLS_ARG_NAME))
?.replace(TOOLS_ARG_NAME, "")

const toolNames = parseCSV(toolsCSV)

module.runServer({ toolNames }).catch((error) => {
console.error("Fatal error running server:", error)
process.exit(1)
})
})
33 changes: 33 additions & 0 deletions servers/localhost_3030/src/server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"
import { registerTools } from "@open-mcp/core"
import type { OpenMCPServerTool } from "@open-mcp/core"
import {
SERVER_NAME,
SERVER_VERSION,
OPERATION_FILES_RELATIVE,
} from "./constants.js"

const server = new McpServer({
name: SERVER_NAME,
version: SERVER_VERSION,
})

export async function runServer({ toolNames }: { toolNames?: string[] }) {
try {
const tools: OpenMCPServerTool[] = []
for (const file of OPERATION_FILES_RELATIVE) {
const tool = (await import(file)).default as OpenMCPServerTool
if (!toolNames || toolNames.includes(tool.toolName)) {
tools.push(tool)
}
}
await registerTools(server, tools)
const transport = new StdioServerTransport()
await server.connect(transport)
console.error("MCP Server running on stdio")
} catch (error) {
console.error("Error during initialization:", error)
process.exit(1)
}
}
22 changes: 22 additions & 0 deletions servers/localhost_3030/src/tools/compensatearrangements/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { inputParamsSchema } from "./schema/root.js"
import type { OpenMCPServerTool } from "@open-mcp/core"

const tool: OpenMCPServerTool = {
"toolName": "compensatearrangements",
"toolDescription": "Compensar Arranjos",
"baseUrl": "http://localhost:3030",
"path": "/informational/compensation/compensate",
"method": "post",
"security": [
{
"key": "Authorization",
"value": "Bearer <mcp-env-var>API_KEY</mcp-env-var>",
"in": "header",
"envVarName": "API_KEY"
}
],
"paramsMap": {},
inputParamsSchema
}

export default tool
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "object",
"properties": {},
"required": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { z } from "zod"

export const inputParamsSchema = {}
Loading