mcp-knowledgebase
Provides tools for querying and exploring MySQL databases, including schema discovery, table relationships, and safe read-only query execution with pagination.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-knowledgebasedescribe the users table"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Knowledge Base Server
A lightweight Model Context Protocol (MCP) server for MySQL database querying and schema exploration. This tool enables AI agents to understand database structure and fetch data through a safe, read-only interface.
Features
Schema Discovery: Get complete database schema including tables, columns, data types, and comments
Key Relationships: Understand table relationships through primary keys, foreign keys, and unique keys
Safe Query Execution: Execute SELECT queries with automatic validation and pagination
Table Exploration: Search and describe tables easily
Related MCP server: mysql-mcp
Available Tools
Tool | Description |
| Get complete database schema for all tables |
| Get all keys and relationships for JOIN operations |
| Execute SELECT queries with pagination (read-only) |
| Get detailed information about a specific table |
| List all tables with metadata |
| Search tables and columns by pattern |
Quick Start
1. Install Dependencies
npm install2. Configure Environment
Copy .env.example to .env and update with your database credentials:
DB_HOST=127.0.0.1
DB_PORT=3306
DB_USER=admin
DB_PASSWORD=secret
DB_NAME=ez_ccsd1wy
DB_CONNECTION_LIMIT=10
QUERY_TIMEOUT_MS=30000
MAX_ROWS_PER_PAGE=1003. Run the Server
# Development mode (with auto-reload)
npm run dev
# Production mode
npm start4. Use with Claude/Cline
Add the server to your MCP configuration:
{
"mcpServers": {
"knowledgebase": {
"command": "node",
"args": ["/path/to/knowledgebase/src/index.js"],
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "3306",
"DB_USER": "admin",
"DB_PASSWORD": "secret",
"DB_NAME": "ez_ccsd1wy"
}
}
}
}Usage Examples
Get Database Schema
// Get all tables and their columns
await tools.get_schema()Get Table Relationships
// Understand how tables connect
await tools.get_keys()Execute a Query
// Simple SELECT query with pagination
await tools.raw_query({
query: "SELECT * FROM users WHERE active = 1",
page: 1,
limit: 50
})Describe a Table
// Get detailed table structure
await tools.describe_table({
tableName: "users"
})Search for Tables
// Find tables or columns
await tools.search_tables({
pattern: "user",
type: "all" // or "tables", "columns"
})Security
Read-Only Access: Only SELECT queries are allowed
Query Validation: All queries are validated before execution
Timeout Protection: Queries have a configurable timeout (default 30s)
Pagination: Automatic pagination prevents overwhelming responses
Project Structure
knowledgebase/
├── src/
│ ├── index.js # Main MCP server
│ ├── database.js # Database connection pool
│ └── tools/
│ ├── schema.js # Schema tools
│ └── query.js # Query tools
├── .env # Environment configuration
├── .env.example # Environment template
├── .nvmrc # Node.js version
├── package.json # Dependencies
└── README.md # This fileNode.js Version
This project uses Node.js 20.0.0. Use nvm to manage versions:
nvm useDocumentation
Agent Instructions - Guide for AI agents extending this tool
API Reference - Detailed tool specifications
License
ISC
Available Tools
6 toolsdescribe_tableA
Get detailed information about a specific table including all columns, their types, keys, and comments.
| Name | Required | Description | Default |
|---|---|---|---|
| tableName | Yes | The name of the table to describe |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full burden. It conveys the read-oriented nature and what the result contains (columns, types, keys, comments), but does not disclose potential errors, permission requirements, or any side effects. For a simple describe-style tool this is adequate but not comprehensive.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single well-structured sentence with no filler. It front-loads the action and resource, then lists the specific details returned. Every phrase earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool with one parameter, no output schema, and no annotations, the description explains both what to provide and what will be returned. It omits edge-case behavior such as errors for nonexistent tables, but the information needed to invoke the tool correctly is present.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and the parameter description ('The name of the table to describe') already explains the only input. The tool description adds no additional meaning about parameter format, constraints, or behavior beyond what the schema provides, so the baseline of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific action ('Get detailed information') and a specific resource ('about a specific table'), and enumerates the contents it returns: columns, types, keys, and comments. This clearly distinguishes it from siblings like get_keys (keys only) or get_tables (list tables), so an agent can tell them apart.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context that this tool is for retrieving detailed metadata about a single named table. It does not explicitly name alternatives or state when not to use it, but the scope ('specific table') implies it is not for listing or broad schema retrieval.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_keysA
Get all keys (primary, foreign, unique) for all tables. This helps understand table relationships for JOIN operations. Returns primary keys, foreign keys, unique keys, and a relationships map showing how tables connect. Paginated to prevent token overflow.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (1-indexed). Default: 1 | |
| limit | No | Number of keys per page. Default: 50, Max: 200 | |
| keyType | No | Filter by key type: "primary", "foreign", "unique", or "all". Default: all | all |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the burden. It discloses pagination ('Paginated to prevent token overflow') and describes the return contents (primary/foreign/unique keys and a relationships map). These are genuinely useful behavioral traits beyond the schema. It does not state read-only explicitly, but 'Get' and the content make that reasonably clear.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three concise sentences: purpose, value, and behavioral note. Each sentence earns its place, and key information is front-loaded. No filler or irrelevant detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description explains the return shape (keys and relationships map) despite the lack of an output schema, and flags pagination. It is slightly vague about the scope of 'all tables' and how the relationships map is structured, but for a fairly simple introspection tool this is adequate.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the baseline is 3. The description mentions key types compatible with the keyType enum, but it does not add meaningful parameter details beyond what the schema already documents. No compensation is needed, but also no extra value is contributed.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Get') and resource ('all keys for all tables'), and specifies the key types covered (primary, foreign, unique). It also implies distinctiveness from siblings by mentioning the relationships map for JOINs, which no sibling name suggests.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear usage context: 'This helps understand table relationships for JOIN operations.' This tells the agent when the tool is relevant. However, it does not explicitly mention alternatives or when not to use it, so it stops short of a 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_schemaA
Get the complete database schema for all tables. This includes table names, column names, data types, nullable status, defaults, and comments. Use this to understand the database structure before writing queries. Paginated to prevent token overflow.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (1-indexed). Default: 1 | |
| limit | No | Number of tables per page. Default: 50, Max: 200 | |
| compact | No | Use compact format with abbreviated field names (n, t) to reduce token usage. Default: false |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries the full disclosure burden. It does reveal pagination behavior ('Paginated to prevent token overflow') and lists what data is included, but it does not describe response shape, potential size, or performance implications beyond pagination.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three concise sentences with no filler. It front-loads the core purpose, then the content breakdown, usage guidance, and pagination note. Every sentence contributes useful information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers what the tool returns, why to use it, and pagination behavior, which is sufficient for a read-only schema inspection tool. It lacks explicit differentiation from sibling tools like get_tables and describe_table, but the 'all tables' scope largely handles that.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents page, limit, and compact. The description adds only a general mention of pagination and token overflow, without adding meaning beyond what the parameter descriptions already provide.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states a specific verb and resource: 'Get the complete database schema for all tables.' It enumerates the returned contents (table names, columns, data types, nullable status, defaults, comments), which makes the tool's scope unambiguous and distinguishes it from siblings like get_tables or describe_table.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly says 'Use this to understand the database structure before writing queries,' giving a clear usage context. However, it does not mention alternatives or state when not to use this tool relative to siblings like get_tables or describe_table.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_tablesA
Get a list of all tables in the database with their metadata (type, comment, engine, row count). Paginated to prevent token overflow.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (1-indexed). Default: 1 | |
| limit | No | Number of tables per page. Default: 50, Max: 1000 | |
| compact | No | Use compact format with abbreviated field names (n, t) to reduce token usage. Default: false |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden. It discloses pagination and its rationale ('Paginated to prevent token overflow') and names the fields returned, but it does not explicitly state read-only behavior, return structure beyond field names, or any other side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two short sentences, one for purpose and one for pagination rationale. Every word adds value and the key action is front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple list tool with fully documented optional parameters, the description is adequate. It gives the purpose and return metadata, but without an output schema it could have been slightly more specific about the exact response shape.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema documentation covers 100% of parameters, so the baseline is 3. The description adds only general context about pagination, which loosely maps to page and limit, but does not add meaningful detail beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a clear verb and resource ('Get a list of all tables') and specifies the returned metadata (type, comment, engine, row count). It distinguishes from siblings like describe_table by emphasizing 'all tables', though it does not explicitly contrast with search_tables or get_schema.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives clear context: use this tool when you need a list of all tables and their metadata. It does not explicitly mention when to prefer a sibling like describe_table or search_tables, so it falls short of a 5 but provides enough contextual clarity.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
raw_queryA
Execute a raw SELECT query on the database. This tool provides read-only access with automatic pagination. The query is validated to ensure only SELECT statements are allowed. Results are paginated to prevent overwhelming responses.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (1-indexed). Default: 1 | |
| limit | No | Number of rows per page. Default: 100, Max: 1000 | |
| query | Yes | The SELECT query to execute. Only SELECT statements are allowed. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It usefully reveals that access is read-only, queries are validated to be SELECT-only, and pagination is automatic to bound response size. This gives an agent a solid safety model, though it does not mention authentication, query complexity limits, or exact result shaping.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three short sentences, front-loaded with the core purpose. Each sentence earns its place: the action, the read-only property, and the pagination behavior. No filler or redundant information is present.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a tool of this complexity, the description covers the essential safety behaviors, validation rule, and pagination. The main gap is that it does not specify the return value shape or note any usage exclusions, but the pagination parameters plus the schema give enough for an agent to invoke the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents the meaning of query, page, and limit. The description adds a small amount of context by explaining pagination behavior and the SELECT-only validation, but it does not materially extend the parameter semantics beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb ('Execute'), a specific resource ('a raw SELECT query on the database'), and the boundary of what it does. It is clearly distinguishable from the sibling tools, which retrieve schema metadata or table descriptions rather than execute arbitrary SQL.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance is given for when to use raw_query versus the sibling tools such as search_tables, get_tables, or describe_table. The description implies it is for ad-hoc SELECT queries, but it never states when an agent should prefer it over the structured metadata tools or when one of those alternatives would be more appropriate.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_tablesA
Search for tables or columns by name pattern. Useful for finding specific tables or columns when you don't know the exact name. Paginated to prevent token overflow.
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | Page number for pagination (1-indexed). Default: 1 | |
| type | No | Search type: "tables", "columns", or "all" | all |
| limit | No | Number of results per page. Default: 50, Max: 1000 | |
| compact | No | Use compact format with abbreviated field names to reduce token usage. Default: false | |
| pattern | Yes | The search pattern (supports SQL LIKE wildcards) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It reveals that results are paginated to prevent token overflow, which is useful. However, it does not explicitly state that the operation is read-only, what the returned result structure looks like, or how matches are ordered.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three concise sentences: purpose, usage context, and pagination rationale. Every sentence adds useful information, and the content is front-loaded with the core capability. There is no wasted wording.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The schema covers all parameter semantics, and the description adds the key behavioral concern of pagination and token overflow. It is adequate for an agent to call the tool correctly, though a note about the return format would make it complete given there is no output schema.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the parameters pattern, page, type, limit, and compact are all already documented. The description adds general context about name patterns and pagination, but no additional parameter-level detail beyond what the schema provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description opens with a specific verb ('Search') and resource ('tables or columns'), then qualifies it with a clear scope ('by name pattern'). This accurately captures the tool's capability and distinguishes it from sibling tools like get_tables or describe_table, which are not pattern-search operations.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The phrase 'Useful for finding specific tables or columns when you don't know the exact name' gives a clear usage context and implies this tool is the right choice for fuzzy/pattern-based lookup. It does not explicitly contrast with get_tables or raw_query, but the guidance is not misleading and is sufficient for an agent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
6 tool updates
v1.0.0- First observed
describe_table - First observed
get_keys - First observed
get_schema - First observed
get_tables - First observed
raw_query - First observed
search_tables
TDQS
Scored across 6 tools
Tools mostly target distinct concerns: schema overview, keys, single-table details, table listing, search, and raw query. However, get_schema and describe_table overlap in providing column/key info, which could confuse an agent choosing between them. Overall boundaries are clear enough with careful reading.
Four tools use the get_ prefix (get_schema, get_keys, get_tables), but describe_table and search_tables use different verbs, and raw_query breaks the pattern entirely. The mix of get_, describe_, search_, and raw_ is readable but not consistent. A unified verb_noun convention would improve predictability.
Six tools is a well-scoped count for a database metadata and query server. Each tool covers a distinct aspect of exploration (schema, keys, tables, search, single-table details, raw queries), with no redundant tools. This is within the ideal range.
The toolset covers the main workflows: understanding schema, relationships, discovering tables, and running read-only queries. Minor gaps exist around indexes, views, or row sampling, but these are not critical for a knowledge base. The core surface is complete for navigation and querying.
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Query your org's data in natural language — read-only MCP access to SQL, NoSQL, files & warehouses.
Draxlr's remote MCP server connects AI assistants to your SQL databases and dashboards. Explore schemas, run read-only queries, manage saved queries and dashboards, and export results, all with row-level security so each user sees only their own data.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to inspect and query a MySQL database through safe, structured tools, including schema discovery and read-only queries.989 npmMIT
- AlicenseAqualityDmaintenanceEnables AI agents to query and manage MySQL databases through a structured MCP interface, supporting SQL execution, table inspection, and database operations.913 npmMIT
- FlicenseNot gradedqualityDmaintenanceProvides read-only access to MySQL databases, enabling schema exploration, table inspection, and safe SELECT query execution via MCP.1-
- AlicenseAqualityCmaintenanceSafe MySQL database exploration for AI agents via MCP, enabling read-only queries and schema inspection with three-layer write protection.9MIT