Docs / API reference

MCP servers API

Updated 2026-11-22. Published by PentestLLM.

Tooling endpoints your security team runs can be enrolled here, after which the shared gateway at https://api.pentestllm.ai/mcp/org advertises their tools to any agent calling it with one of your API keys. Of the six routes at https://api.pentestllm.ai/v1, five enroll a server, list them, read one back, revise it and retire it, and the sixth surfaces what the gateway has recently invoked. A record points at a single Streamable HTTP MCP endpoint published over public https; whatever headers you supply are sealed before storage, resent on each outbound call, and where you give an allowlist only the tools you name are reachable.

List your servers

GET /v1/mcp-servers gives you data, one record per server the shared endpoint draws on. Secrets stay out of what you read: in place of header contents a header_names field lists which keys are on file, leaving anything sensitive write-only.

Register a server

POST /v1/mcp-servers takes the fields below, and a created record comes back with 201:

FieldTypeNotes
namestring, requiredThe tool namespace, surfaced as name__tool: 1 to 32 lowercase letters, digits, _ or -, opening with a letter or digit, with no double underscore and no trailing underscore.
urlstring, requiredA public https URL. Private, loopback, link-local and reserved addresses are declined, the test repeats before each call, and redirects are not followed.
headersobject or nullAs many as 20, resent on each call (an Authorization value, say). Sealed at rest and never read back.
tool_allowlistarray or nullThe tools to advertise; all of them when null.
enabledbooleanWhether the record is live.

One account holds as many as 20 servers. A URL that fails the check answers 400 invalid_url and any other malformed field 400 invalid_request; a name already taken, or a 21st server, answers 409 with name_taken or limit_reached.

Change or remove a server

GET /v1/mcp-servers/{server_id} returns a single record, PATCH /v1/mcp-servers/{server_id} rewrites any mix of the fields above (passing headers discards the stored set in favour of what you send, while null clears every header), and DELETE /v1/mcp-servers/{server_id} retires it. Ask for an id your account does not own and the reply is 404 not_found.

Read recent tool calls

GET /v1/mcp-servers/calls surfaces what the shared endpoint has lately run, latest entry on top. Each row names the moment it fired, which server and which tool, a status of ok, tool_error, failed, denied (its allowlist refused the tool) or blocked (the key’s tool policy did), and the elapsed time. The arguments show for a row only when the calling key is set to keep bodies. Rows come 50 at a time; raise limit to 200, and give server_id to confine the list to one record.

Example

shell
1curl https://api.pentestllm.ai/v1/mcp-servers \
2 -H "Authorization: Bearer sk-ptl-live-…" \
3 -H "Content-Type: application/json" \
4 -d '{"name": "issue-tracker", "url": "https://mcp.example.org/mcp", "enabled": true, "headers": {"Authorization": "Bearer ..."}}'

What returns is the saved record with its id and header_names only, no header value among them. Every route here authenticates with an admin key, created in the console; the shared endpoint itself takes an ordinary API key and turns an admin key away.

Questions

Do the header secrets I store ever come back?

No. Anything under headers is sealed on the way in and travels only to its own server; a read gives back only header_names, telling you which are present without ever exposing a value, and a PATCH replaces the entire collection instead of merging into it.

What kind of URL is accepted?

A public https endpoint, nothing else. A loopback, link-local, private or reserved target is declined with 400 invalid_url, the same test runs again ahead of every outbound call, and no redirect is followed, so an enrolled server cannot afterward be steered toward an internal host.

How do I keep a server from exposing every tool?

List the ones you want in tool_allowlist; leave it null and the gateway passes through everything the server declares. A call to a tool you left off that list lands in GET /v1/mcp-servers/calls marked denied.

Join on TelegramHelp