Skip to main content
Glama
passasooz

Genspark Custom MCP Bridge

by passasooz
README.md
# genspark-custom-mcp

`genspark-custom-mcp` is a local MCP bridge for Genspark.

It runs as a STDIO server, which is the format Genspark expects, and proxies requests to an upstream MCP server exposed over HTTP/SSE. The first practical preset is Meta Ads, but the code is intentionally generic so the same bridge can be pointed at other MCP servers in the future.

## What it does

- Genspark talks to this repo over STDIO.
- This process connects to the upstream MCP server over `streamable-http` or `sse`.
- `tools/list` and `tools/call` are forwarded to the upstream server.

## Configuration

Set these environment variables before starting the bridge:

- `UPSTREAM_MCP_URL` or `META_MCP_URL`: upstream MCP endpoint
- `UPSTREAM_MCP_NAME` or `META_MCP_NAME`: display name for logs
- `UPSTREAM_TRANSPORT`: `auto`, `streamable-http`, or `sse`
- `UPSTREAM_BEARER_TOKEN`, `UPSTREAM_AUTH_TOKEN`, `META_ADS_ACCESS_TOKEN`, or `META_ACCESS_TOKEN`: bearer token
- `UPSTREAM_API_KEY`: API key forwarded as `X-Api-Key`
- `UPSTREAM_AUTH_HEADER_NAME` and `UPSTREAM_AUTH_HEADER_VALUE`: custom auth header pair
- `UPSTREAM_HEADERS_JSON`: extra headers as JSON

Example:

```bash
export UPSTREAM_MCP_URL="https://example.com/mcp"
export UPSTREAM_TRANSPORT="auto"
export UPSTREAM_BEARER_TOKEN="your-token"
npm start
```

## Genspark setup

- Build command: `npm install`
- Start command: `npm start`

## Meta Ads preset

If you are using the Meta Ads MCP from the guide, set the upstream URL and the Meta token in the environment, then start the bridge locally or inside the Genspark sandbox.