MCP server

With the MongoDB MCP Server tools, an AI agent works on TeselaDB.

Every node has a Model Context Protocol server. It has the database tools of MongoDB MCP Server with the same names and arguments: find, aggregate, count, insert-many, update-many, delete-many, create-index, collection-indexes, collection-schema and the rest.

Requirements

  • An API key created with teseladb admin apikey create for a user with the roles the agent needs.
  • Access from the MCP client to port 27080 of a node.

Two ways to connect

  • Streamable HTTP at https://<node>:27080/mcp, with an API key in Authorization: Bearer.
  • stdio with teseladb mcp, which forwards to the HTTP port. The credential goes in the TESELADB_API_KEY environment variable, never in the arguments.
JSON
{
  "mcpServers": {
    "teseladb": {
      "command": "teseladb",
      "args": ["mcp", "--uri", "https://node-01:27080"],
      "env": { "TESELADB_API_KEY": "tdb_…" }
    }
  }
}

Read-only by default

The MCP server starts read-only: the tools that write are not available until you turn them on with the mcpOptions cluster parameter. aggregate rejects $out and $merge. The audit log records every call, and each tool checks the privileges of the equivalent command with the key's roles before it runs.

Check

The MCP client lists the tools of the server. In the default mode, only the ones that read appear.

Common problems

  • The client does not see the tools that write because the server starts read-only. Turn them on with the mcpOptions cluster parameter.
  • aggregate refuses a pipeline with $out or $merge, which the MCP server does not accept.

See also