A lot of my day used to go on answering questions, not writing features. “Which investors have we talked to about this company?” “What did this startup report last quarter?” “Who do we know at that fund?” Each takes thirty seconds to answer and longer than that to get back into whatever I was doing.
So I built an MCP server and let Claude answer them. MCP (Model Context Protocol) lets an assistant call tools you define. Now the business team asks Claude directly. This is what I ran into building it.
Small tools, all read-only
The easy version would be one tool, run_query(sql), plus a system prompt asking the model to be careful. I didn’t want to rely on the model being careful, so the first version offered 17 fixed tools over our REST API, like core_list_investors, core_get_startup and core_get_startup_reportings. Each had a typed input and did one thing.
None of the tools can write anything. The worst a bad call can do is return a wrong answer, and a person reads the answer before doing anything with it.
Problem 1: asking for too much
An investor record has dozens of fields: addresses, flags, timestamps, related records. If you send all of that back for “who are our fintech investors?”, you fill the model’s context with things it won’t use, and the answer gets worse.
Every tool takes an optional list of fields and returns only those:
function project<T extends Record<string, unknown>>(rows: T[], fields?: string[]) {
if (!fields?.length) return rows.map(defaultView); // a small default set
return rows.map((r) => Object.fromEntries(fields.filter((f) => f in r).map((f) => [f, r[f]])));
}
If the model doesn’t ask for anything specific, it gets a short default set instead of the full record. It saves tokens, and with less for the model to misread, the answers are better too.
Problem 2: guessing field names
Ask how much a round has raised and in one afternoon you’ll see the model ask for total_amount_raised, raised_amount and current_amount, none of which exist. Rejecting the call meant an apology from the model, another guess, and a few wasted round trips.
So the server keeps a short list of common guesses for each resource and maps them to the real names:
const SYNONYMS: Record<string, string> = {
total_amount_raised: "amount_committed", raised_amount: "amount_committed",
current_amount: "amount_committed", "startup.name": "startup_name",
};
function normalizeFields(fields: string[], allowed: Set<string>) {
const mapped = fields.map((f) => SYNONYMS[f] ?? f);
return { ok: mapped.filter((f) => allowed.has(f)), unknown: mapped.filter((f) => !allowed.has(f)) };
}
Field names it still doesn’t recognise aren’t an error either. The response just includes a note listing the fields that do exist, so the model can correct itself on the next try.
Problem 3: not knowing when to stop
Read-only isn’t the same as harmless. A vague question can still ask for every row in a table. So every query, whichever tool it came through, runs with the same limits:
- at most 5,000 rows
- at most 20 seconds
- its own service account, with a short-lived token the server refreshes itself, so it can only see what it was built to see
When a limit is hit, the model gets a plain message like “too many rows, add a filter” and narrows the question, which is what a person would do too.
Version two: two tools instead of seventeen
The fixed tools had a problem that got worse every month: the backend kept growing and the MCP server didn’t. A new field meant a new release of the server, and a question nobody had planned for meant a new tool.
When our new backend shipped with a GraphQL API, I replaced all 17 with two:
export const graphqlQueryCfg = {
description: "Run a READ-ONLY GraphQL query against core data. Call core_graphql_schema first " +
"if unsure of the field names. Results cap at 5000 rows; request only the fields you need.",
inputSchema: {
query: z.string(),
variables: z.record(z.any()).optional(),
},
annotations: { readOnlyHint: true },
};
The second tool, core_graphql_schema, takes no input at all and returns a short guide: the entry points, the filters, and example queries for the questions people actually ask.
This solved the staleness problem: anything the backend adds to its schema can be queried the same day, with no change to the MCP server. It also took care of problems 1 and 2, because choosing fields is just how GraphQL works, and the guide shows the model the real names before it starts guessing. The limits moved into the backend’s GraphQL view, so they apply to every query whichever way it arrives.
The other thing I’d tell anyone building one of these: fewer tools with fewer inputs work better. A tool with two inputs is hard to call wrong. Seventeen tools with five optional parameters each gave the model a lot of ways to pick almost the right one.
Where to put the warning
The server also has a semantic search over email, notes and decks. Semantic search always returns its closest matches, even when nothing really matches, so it’s a bad way to answer “have we ever emailed this person?”. The tool’s parameter docs said so. The model still used it for exactly that, and when I checked a real batch of those questions, 43% of the “no” answers were wrong.
The model reads a tool’s top-level description when choosing a tool, and the parameter descriptions only after it has chosen. So I moved the warning into the first lines of the description, and added an exact email-thread query to GraphQL whose “no” can be trusted.
What people actually use it for
The questions that used to come to me, and plenty that never would have. A brief on an investor before a call, with every email, note and meeting in one timeline. “Have we ever emailed anyone at this firm?” How much we hold in a company and at what valuation, or a fund’s latest NAV by share class. A first draft of a follow-up that picks up an investor’s history with us. And a few people have it run a brief every morning: the wires that came in, amounts raised per investor, and news across the portfolio.
What’s next
Every tool call is logged with the question behind it, so the questions the server can’t answer yet are the list of what to build next. The schema guide is still written by hand. It’s a list of examples rather than a contract, so it can’t break anything when it falls behind, but generating the common queries from what people actually ask would be better.