Overview
Your tool code runs in an isolated V8 runtime with a 64 MB memory limit. There is no file system access, norequire(), no import, and no access to the Node.js standard library. Instead, MCPCore injects a curated set of globals:
sdk.http() — HTTP requests
Make outbound HTTP requests to any external API or service. Each HTTP request has a 10-second timeout and a 10 MB response size limit, with a maximum of 5 redirects.
Response methods
Example — GET with auth
Example — POST with JSON body
sdk.db() — Database queries
Connect to a relational database and run queries. sdk.db() is powered by Knex.js under the hood — a battle-tested SQL query builder for Node.js. If you’re familiar with Knex, the API will feel natural. MCPCore wraps it with a simplified interface for the most common operations.
Always store connection credentials as secrets and reference them as
env.*. Never hardcode passwords in tool code.db.select(table, where?)
Fetch rows from a table, optionally filtered by column values.
db.insert(table, data)
Insert a single row and return the inserted record.
db.update(table, data, where)
Update rows matching the where condition.
db.delete(table, where)
Delete rows matching the where condition.
db.query(sql, values?)
Run a raw parameterised SQL query for complex operations.
sdk.lodash — Utility functions
A subset of Lodash is available for data manipulation.
params — Tool inputs
params is a plain object containing the values the AI passed when calling the tool. The keys are the parameter names you defined in the tool schema.
env — Secrets
env contains the encrypted secrets you stored in the server’s Secrets tab. Reference them by their key name:
env is read-only. Values are strings. See Secrets for how to create and manage them.
console — Structured logging
Log messages from your tool code. All output is captured and visible in the Traffic Logs dashboard.
Log output is truncated at 10 KB per entry. For large payloads, log a summary rather than the full object.