legit-prv-mcp
MCP server for Legit Security that answers questions about security issues, Actions, inventory, posture, and platform usage across one or multiple tenants.
README
legit-prv-mcp
MCP server for Legit Security tenants. Answers questions about security issues, Actions (root-cause remediation groups), inventory, posture and platform usage, across one or several tenants.
Node 20+, TypeScript, stdio transport.
Setup
npm install
cp .env.template .env && chmod 600 .env # then fill in BASE_URL + TOKEN
npm run probe # smoke test over a real MCP session
Get a token from Legit: Settings → API → Generate Token. A Read token is enough for every read tool.
.env
One block per tenant, discovered by scanning for LEGIT_TENANT_*_BASE_URL:
LEGIT_TENANT_ACME_BASE_URL=https://acme.legitsecurity.co
LEGIT_TENANT_ACME_TOKEN=...
LEGIT_TENANT_ACME_ALIASES=acme,acme corp
LEGIT_TENANT_ACME_ALLOW_WRITES=false
LEGIT_DEFAULT_TENANT=acme
See .env.example for every option.
Wiring it into Claude Code
{
"mcpServers": {
"legit": {
"command": "npx",
"args": ["tsx", "/Users/you/projects/legit-prv-mcp/src/index.ts"],
"cwd": "/Users/you/projects/legit-prv-mcp"
}
}
}
cwd matters: it is how the server finds .env. Tokens stay in the file rather than in the MCP config.
Tools
| Tool | API | What it answers |
|---|---|---|
list_tenants |
config | Which tenants are configured, their aliases, whether writes are on |
ping_tenant |
both | Is the tenant reachable, what can this token actually do |
search_issues |
GraphQL | Issue lists by severity, status, type, CVE, score, repo, product unit, Action, assignment |
get_issue |
REST v1.0 | One issue in full: description, remediation, CWEs, evidence, comments, ticketing |
count_issues |
GraphQL | Counts, optionally grouped by severity / type / status / assignee / product unit / SLA rule |
issues_trend |
GraphQL | Open-issue backlog over time, by severity |
search_actions |
GraphQL | Actions ranked by risk reduction: what to fix first |
get_action |
GraphQL | One Action: root cause, fix, affected assets, member issues |
Writes (update_issue_status, assign_issue, comment_on_issue, tag_issue, create_jira_ticket) are planned for the next phase and gated per tenant.
Commands
npm run typecheck
npm run probe # spawn the server as a client would, call tools
npm run probe -- search_issues '{"severities":["Critical"],"limit":3}'
npm run check-schema # verify every GraphQL field against the snapshot
npm run check-schema -- --live # also execute each query against the tenant
npm run generate-rest-params # regenerate REST param allowlist from legit-docs
npm run generate-graph-schema # regenerate the GraphQL schema snapshot
Why two APIs
REST is published, versioned and documented, so it is preferred wherever it can answer. But it cannot answer everything:
- Actions do not exist in REST. Only an
actionIdfilter on issues. Actions areissueGroupson the GraphQL BFF. - REST has no aggregation. No group-by, no trend.
GET /api/v2.0/issuesomits the issue title, which makes it unusable for listing.
So: GraphQL for issue search, counts, trends and Actions; REST for single-issue detail and (later) all writes.
Gotchas
Measured against a live tenant. Each one is enforced or worked around in code.
- REST silently ignores unknown query params and returns the full unfiltered set.
?titleSearch=zzzznopeon/api/v1.0/issuesreturned all 4826 issues instead of 0, becausetitleSearchonly exists on v2.0. An agent would report that as "the issues matching your search".RestClientvalidates every param againstsrc/generated/rest-params.ts, generated from the OpenAPI specs, and refuses to send an unknown one. - REST and GraphQL use different issue ids. REST accepts only the
prettyId(988044EDEE); GraphQL'sidis a GUID and 404s on REST. Always quoteprettyId. - GraphQL introspection is disabled in production (
HC0046). The schema comes from a committed snapshot generated from the frontend's checked-in codegen output, not from__schema. - Rate limits are 5/sec, 300/min, 5000/hour per token, advertised in
X-RateLimit-*. A per-tenant limiter queues requests rather than discovering the ceiling as a 429 mid-answer. - Aggregation resolvers have two different shapes.
issuesCountGroupedBySeverityand…ByTypeare collection segments needingitems { };…ByStatus,…ByAssignee,…ByProductUnit,…BySlaRulereturn plain arrays. Selecting the wrong one is a hard 400. openIssuesTrendtakes bucket lists, not a window:startDates/endDatesas[String!], formattedMM/DD/YYYY HH:mm:ss. ISO-8601 fails with an opaque "Unexpected Execution Error".GraphIssue.assignedUserNameexists in the schema but its resolver throws. UseassignedUser { … }.issueGroups.repositoriescombined withorder:throws. Each works alone. UseminimalRepositories.- v1.0 list endpoints paginate in headers,
X-PaginationandLink: rel="next", not in the body.
Security
- Tokens are read from
.envonly, never logged, never returned, and redacted from every error path (src/lib/redact.ts)..envis gitignored. - Read-only by default. Write tools require
LEGIT_TENANT_<KEY>_ALLOW_WRITES=trueplus a Read & Write token, and fail closed with an explanation otherwise. - One tenant per call. No cross-tenant fan-out, and a per-tenant client and cache namespace, so results cannot blend two customers.
- Issue titles, descriptions, comments and dependency names come from customer source control and are attacker-influenceable. Tool output is framed as untrusted data, never instructions.
- Every result reports
totalCount,returnedandtruncated, so a partial page is never mistaken for the whole answer.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.