#Filesystem MCP Server Node.js server implementing Model Context Protocol (MCP) for filesystem operations.
Features Read/write files Create/list/delete directories Move files/directories Search files Get file metadata Note: The server will only allow operations within directories specified via args.
A Model Context Protocol (MCP) server that provides read-only access to PostgreSQL databases for AI assistants and other MCP clients.
```bash npm install -g postgresql-mcp-server ```
```bash
git clone
The server requires a PostgreSQL connection string via the DATABASE_URL
environment variable:
```bash export DATABASE_URL=”postgresql://username:password@hostname:port/database” ```
postgresql://user:pass@host:port/dbname
postgresql://user:pass@host:port/dbname?sslmode=require
postgres://user:pass@host:port/dbname
Add to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
```json { “mcpServers”: { “postgresql”: { “command”: “postgresql-mcp-server”, “env”: { “DATABASE_URL”: “postgresql://username:password@hostname:port/database” } } } } ```
The server implements the standard MCP protocol and can be used with any compatible client.
postgresql://database-schema
Complete database schema with all tables and columns in JSON format.
postgresql://table-list
Simple list of all tables in the database.
execute_sql
Execute read-only SQL queries against the database.
Parameters:
query
(string, required): The SQL query to executelimit
(number, optional): Maximum rows to return (default: 100, max: 1000)Example: ```sql SELECT * FROM users WHERE created_at > ‘2024-01-01’ ```
get_table_info
Get detailed information about a specific table.
Parameters:
tableName
(string, required): Name of the table to analyzeReturns:
analyze_data
Generate common data analysis queries for a table.
Parameters:
tableName
(string, required): Name of the table to analyzeanalysisType
(enum, required): Type of analysis
summary
: Basic row counts and statisticsdistribution
: Value distribution for first columnnulls
: Null value analysis across columnsduplicates
: Duplicate row detectiontrends
: Time-based trend analysis (requires date/timestamp columns)search_tables
Search for tables and columns matching a pattern.
Parameters:
pattern
(string, required): Search pattern (supports wildcards)searchType
(enum, optional): What to search for
tables
: Search table names onlycolumns
: Search column names onlyboth
: Search both tables and columns (default)This server implements several security measures:
```bash
git clone
```bash npm run dev ```
```bash npm run build ```
```bash
npm test
npm run test:coverage
npm run lint ```
``` src/ ├── index.ts # Main server entry point ├── database.ts # Database connection and query management ├── validation.ts # Environment validation ├── logging.ts # Logging utility ├── tools/ │ ├── index.ts # Tools handler │ ├── execute-sql.ts # SQL execution tool │ ├── get-table-info.ts # Table information tool │ ├── analyze-data.ts # Data analysis tool │ └── search-tables.ts # Search tool └── resources/ ├── index.ts # Resources handler ├── database-schema.ts # Schema resource └── table-list.ts # Table list resource
tests/ # Test files ├── database.test.ts ├── tools/ └── resources/ ```
```sql – Get recent users SELECT * FROM users WHERE created_at > ‘2024-01-01’ LIMIT 10;
– Count records by status SELECT status, COUNT(*) FROM orders GROUP BY status;
– Find top products SELECT product_name, SUM(quantity) as total_sold FROM order_items GROUP BY product_name ORDER BY total_sold DESC LIMIT 5; ```
user
, order
, product
email
, created_at
, status
DATABASE_URL
is correct?sslmode=require
to your connection string?sslmode=disable
limit
parameter to reduce result set sizeMIT License - see LICENSE file for details. ```
```plaintext file=”.env.example”
DATABASE_URL=postgresql://username:password@hostname:port/database
DEBUG=true