Overview
Use the Database MCP server from your ATXP-powered agent to store and retrieve data in a PostgreSQL database. The Database MCP server can be used to:- create tables
- insert data into tables
- retrieve data from tables
Example prompts
- “Create a table called
users
with the columnsid
,name
, andemail
.” - “Insert the following data into the
users
table:1, John Doe, john.doe@example.com
.” - “Retrieve all the data from the
users
table.”
Tools
database_create_database
database_create_database
Creates a new PostgreSQL database. An example would be if you are creating a new application that needs to connect to a database.
Arguments
Accepts no arguments.Returns
Returns a JSON object with the following fields:The status of the database creation operation. Returns “success” when the database is created successfully.
The PostgreSQL connection string for the newly created database. Use this string to connect your application to the database.
database_execute_sql
database_execute_sql
Executes a SQL query against a PostgreSQL database. Examples would be if you want to get a list of tables in the database or if you want to insert a new row into a table.
Arguments
Accepts a JSON object with the following fields:The URL of the database to execute the SQL against.
The SQL to execute.
Returns
Returns a JSON object with the following fields:The status of the SQL execution operation. Returns “success” when the SQL is executed successfully.
The result of the SQL execution.
Usage
1
Define the Database service
Create a reusable service configuration that points to the MCP server and standardizes how you pass arguments and read results. This lets your agent easily interact with the Database tools in a consistent manner.
2
Create an ATXP client
- Using an ATXP account
- Using a Base account
- Using a Solana account
- Using a Worldchain account
- Using a Polygon account
Create a client using an ATXP account by importing the ATXP client SDK and other dependencies.
3
Use the Database service in your agent
Call the Database tool by passing your natural‑language instruction as the argument the
getArguments
method.Read the response using the getResult
method.You should see the result of the database query printed in your console.