Skip to main content

MCP tools reference

The @withfoundry/mcp-server exposes these tools to Cursor (and other MCP clients). All calls use your configured FOUNDRY_API_KEY and the API base URL https://api.withfoundry.ai.

Memory tools

foundry_memory_write

Write one or more entries into a namespace.
ParameterTypeRequiredDescription
namespacestringYesNamespace (e.g. app or user id).
entriesarrayYesItems with content and optional metadata.
entries[].contentstringYesText to store.
entries[].metadataobjectNoJSON for filtering/display.
Returns: { ids: string[] } — created entry ids. Example (as used by Cursor):
“Write to Foundry memory, namespace my-app: ‘We use API keys with prefix key_ in the Authorization header.’”

Semantic search over a namespace.
ParameterTypeRequiredDescription
namespacestringYesNamespace to search.
querystringYesNatural-language query.
limitnumberNoMax results (e.g. 5–20).
metadataFilterobjectNoKey-value filters on metadata.
Returns: Array of { id, content, metadata, score? }. Example:
“Search Foundry memory in my-app for ‘how do we authenticate?’”

foundry_memory_get_context

Get a single context string from semantic search for use in prompts.
ParameterTypeRequiredDescription
namespacestringYesNamespace to search.
querystringYesQuery for ranking.
limitnumberNoMax entries in the context string.
Returns: { text: string, entryIds: string[] }. Example:
“Get Foundry context for namespace my-app with query ‘user preferences and auth’, limit 3.”

Security tools

foundry_security_scan_repo

Start a security scan for a repository.
ParameterTypeRequiredDescription
repoUrlstringYesClone URL (e.g. https://github.com/org/repo).
branchstringNoBranch/ref to scan.
waitForCompletionbooleanNoIf true, wait and return findings.
Returns:
  • Without wait: { scanId, status }.
  • With wait: { scanId, status, findings }.
Example:
“Run a Foundry security scan on this repo” (Cursor may infer repo from workspace.)

foundry_security_get_scan_result

Get status and findings for a scan.
ParameterTypeRequiredDescription
scanIdstringYesId from foundry_security_scan_repo.
Returns: { scanId, status, findings?, error? }. Example:
“Get Foundry scan result for scan_abc123.”

Envelope and errors

The MCP server calls the REST API. API responses use the envelope:
{
  "success": true,
  "data": { ... },
  "meta": { "requestId": "req_..." }
}
On failure, the tool returns the error from data (or a translated message) so Cursor can show or act on it.

Namespace tips in Cursor

  • Use a stable namespace per project or user (e.g. my-app, cursor-user-123).
  • Ask the AI to “search Foundry memory in namespace X for Y” so it uses the right namespace and query.