Skip to main content
Glama
mcp-data-agent-kit

mcp-data-agent-kit

by tekun
README.md
# MCP Data Agent in 7 days

**An MCP server for your API plus a small data agent on top of it, shipped in 7 days for a fixed 2,500 USDC.**

Your users and your team already ask questions your API can answer: *what moved, how deep is the book, is this token like the ones that rugged?* An [MCP](https://modelcontextprotocol.io) server turns your API into tools that Claude, Cursor, ChatGPT connectors and any MCP-capable agent can call. A data agent on top answers those questions in plain language, with the numbers it used.

This repository is the working template we start every build from. It wraps **public** APIs (Polymarket, GeckoTerminal) and a public Solana launch dataset so you can run it today, with no keys.

```
$ python demo/agent_demo.py
[   0.4s] mcp     connected to mcp-data-agent-kit v0.1.0 (protocol 2025-06-18); tools: search_markets, market_snapshot, price_history, token_pools, risk_context
[   0.4s] ask     Which Polymarket markets on 'fed december' are most traded right now, and how deep is the top book?
[   0.4s] tool    search_markets({"query": "fed december", "limit": 3})
[   2.1s] tool    market_snapshot({"market": "3215008"})
[   2.9s] answer  ... Book on YES: bid 0.935 / ask 0.936 (spread 0.001); within 2c of mid there is $196.4k bid and $277.6k ask ...
...
[   7.4s] done    3 questions, 5 tool calls, 7.4s total
```

Full output of a real run: [`demo/sample_output/answers.md`](demo/sample_output/answers.md), [`run.log`](demo/sample_output/run.log) and the raw MCP traffic in [`mcp_transcript.jsonl`](demo/sample_output/mcp_transcript.jsonl).

---

## The offer

| | |
|---|---|
| **Price** | **2,500 USDC fixed.** 50% upfront, 50% on acceptance. Paid on Solana or Base. |
| **Time** | **7 days** from spec sign-off to handover. |
| **For** | Funded teams with an API or dataset: prediction-market tools, Solana trading and launch products, DeFi protocols, data startups. |
| **You keep** | All code in your repo, MIT or your licence. IP transfers on final payment. |

### Scope (what is included)
1. **MCP server for your API**: 5 to 8 read-only tools designed around the questions your users ask, not one tool per endpoint. Typed input schemas, clear descriptions, helpful errors.
2. **Polite data layer**: rate limiting per host, retries with backoff, short-TTL caching, request logging. Your API keys stay in your environment, never in the code.
3. **Data agent**: a script or small service that answers a fixed set of questions (we agree on 3 to 5) by calling the tools, and writes answers plus a call log.
4. **Hook-up guides**: Claude Desktop, Claude Code, Cursor, and a remote (HTTP) deployment option if you want to offer it to your users.
5. **Tests**: protocol tests offline plus a live smoke test against your staging API.
6. **Handover**: a 30-minute walkthrough recording, README, and 14 days of bug-fix cover.

### Not included
Write actions such as placing orders, moving funds or signing transactions (possible as a separate, reviewed scope). Custody of keys or seed phrases. Trading signals or advice. Model/API costs (yours, at cost).

### Timeline
| Day | Milestone |
|---|---|
| 0 | One-page spec: tools, questions, acceptance criteria. 50% invoice. |
| 1–2 | Tools wrapping your API, running locally against staging. |
| 3–4 | Agent answers the agreed questions; you review real outputs. |
| 5–6 | Tests, rate limits, docs, Claude/Cursor setup, optional remote deploy. |
| 7 | Handover call and recording. Acceptance, 50% invoice. |

### How to start
Send one paragraph to **X [@HoneyloftStudio](https://x.com/HoneyloftStudio)**: what your API does, a link to its docs, and three questions your users ask. Within 24 hours you get a fixed spec and a 90-second demo running on your public endpoints.

---

## What is in this template

| Tool | Source | What it answers |
|---|---|---|
| `search_markets` | Polymarket Gamma `public-search` | Most-traded active markets on a topic, with prices, 24h volume and liquidity. |
| `market_snapshot` | Gamma + CLOB `/book` | One market's state and live order-book depth (USD within 2c and 5c of mid). |
| `price_history` | CLOB `/prices-history` | First-outcome price path with first/last/min/max/change and a sampled series. |
| `token_pools` | GeckoTerminal v2 | A Solana token's price, FDV and top pools (liquidity, 24h volume, 1h buys/sells). |
| `risk_context` | [memelaunch_v1](https://github.com/tekun/memelaunch) + GeckoTerminal | Historical base rates for launches like this one (by launchpad and liquidity bucket), plus the token's own record and red flags if it is in the dataset. |

All tools are read-only (`readOnlyHint: true`), need no API key, and stay well inside public rate limits (GeckoTerminal: one call per 2.2 s per process; Polymarket: one per 0.3 s; 60 s cache).

### Layout
```
mcp_data_agent/
  http.py      polite GET client: per-host rate limit, retries, TTL cache (stdlib only)
  tools.py     tool functions + JSON schemas; no MCP code, reusable from REST/bots/tests
  server.py    MCP stdio transport (JSON-RPC 2.0, protocol 2025-06-18 / 2025-03-26 / 2024-11-05)
demo/
  agent_demo.py         MCP client + 3-question agent, writes demo/sample_output/
  sample_output/        answers.md, run.log, mcp_transcript.jsonl from a live run
docs/VIDEO-SCRIPT.md    90-second demo script
tests/test_server.py    offline protocol tests
```

## Run it

Python 3.10+. No dependencies.

```bash
python -m unittest discover -s tests   # offline tests
python demo/agent_demo.py              # live demo, 3 questions, ~10 s
python demo/agent_demo.py --query "bitcoin" --mint <SOLANA_MINT>
```

The first `risk_context` call downloads the 1.4 MB memelaunch dataset to `~/.cache/mcp-data-agent-kit/` (or set `MEMELAUNCH_CSV` to a local copy).

### Use it from Claude Code
```bash
claude mcp add data-agent -- python -m mcp_data_agent.server
```
Run it from the repo root, or set `PYTHONPATH` to the repo path with `-e PYTHONPATH=/absolute/path`.

### Use it from Claude Desktop / Cursor
```json
{
  "mcpServers": {
    "data-agent": {
      "command": "python",
      "args": ["-m", "mcp_data_agent.server"],
      "env": { "PYTHONPATH": "/absolute/path/to/mcp-data-agent-kit" }
    }
  }
}
```

### Official SDK
The default transport is a small stdlib implementation of the MCP stdio transport, so the server runs with nothing to install. `python -m mcp_data_agent.server --sdk` serves the same tools through the official Python SDK's `FastMCP` (`pip install "mcp<2"`) and falls back to the stdlib transport if the SDK is missing. Client builds use whichever your stack prefers; remote deployments use the SDK's Streamable HTTP transport.

## Honest notes
- `risk_context` reports what happened to past launches. It is not a prediction, a score you should trade on, or advice. The dataset covers 5,417 graduations from 16 Oct to 30 Nov 2026; 24-hour outcomes exist for 262 of them.
- The demo agent's planner is deterministic so it runs without an LLM key. In a client build the same server is driven by Claude or your own agent framework.
- The `--sdk` path is provided for convenience and was not exercised in the published demo run; the stdlib transport was.

## Licence
MIT. Data from Polymarket and GeckoTerminal is subject to their terms; memelaunch_v1 is CC BY 4.0.