-
Notifications
You must be signed in to change notification settings - Fork 2
CLOUD-16841 Add prompts registration and management to MCP server #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cre8tiv
wants to merge
2
commits into
main
Choose a base branch
from
CLOUD-16841
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+486
−77
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "permissions": { | ||
| "allow": [ | ||
| "Bash(npm run build:*)", | ||
| "WebFetch(domain:github.com)", | ||
| "Bash(npm run lint)", | ||
| "Bash(TRANSPORT_TYPE=stdio node dist/index.js --help)", | ||
| "Bash(tasklist:*)" | ||
| ], | ||
| "deny": [] | ||
| } | ||
| } |
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initial Claude Code file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| This is a **Model Context Protocol (MCP) server** for CData Connect Cloud API integration. It enables AI agents to interact with cloud-connected data sources through SQL queries, metadata introspection, and stored procedure execution. | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ### Build and Development | ||
| - `npm run build` - Compile TypeScript to dist/ | ||
| - `npm run dev` - Start development server with ts-node (default: HTTP transport) | ||
| - `npm run dev:http` - Start development server with HTTP transport | ||
| - `npm run dev:stdio` - Start development server with STDIO transport | ||
| - `npm run watch` - Watch TypeScript files and recompile on changes | ||
| - `npm run clean` - Remove dist/ directory | ||
|
|
||
| ### Production | ||
| - `npm start` - Start compiled server (default: HTTP transport) | ||
| - `npm run start:http` - Start with HTTP transport | ||
| - `npm run start:stdio` - Start with STDIO transport | ||
| - `npm run build-start` - Build then start production server | ||
|
|
||
| ### Code Quality | ||
| - `npm run lint` - Run ESLint with auto-fix | ||
| - `npm run format` - Format code with Prettier | ||
| - `npm run lint:format` - Run both lint and format | ||
|
|
||
| ### Testing and Debugging | ||
| - `npm run inspector` - Launch MCP Inspector web UI | ||
| - `npm run inspector:stdio` - Launch inspector with STDIO transport | ||
| - `npm run inspector:http` - Launch inspector with HTTP transport (requires separate server start) | ||
| - `npm run inspector:cli` - CLI mode inspector with STDIO transport | ||
| - `npm run test:inspector` - Quick automated inspector test | ||
| - `npm run validate:inspector` - Validate inspector configuration | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Core Components | ||
|
|
||
| **Entry Point**: `src/index.ts` | ||
| - Global request ID tracking | ||
| - Environment configuration loading | ||
| - Transport initialization | ||
|
|
||
| **MCP Server**: `src/server/mcpServer.ts` | ||
| - Basic MCP server instance using @modelcontextprotocol/sdk | ||
| - Server name: "CData Connect Cloud" | ||
|
|
||
| **Transport Layer**: `src/transports/` | ||
| - `index.ts` - Transport selection logic (HTTP vs STDIO) | ||
| - `httpTransport.ts` - HTTP server with Express.js endpoints | ||
| - `stdioTransport.ts` - Standard I/O transport for CLI usage | ||
|
|
||
| **Tool Registry**: `src/server/toolRegistry.ts` | ||
| - Registers all MCP tools with the server | ||
| - Handles tool parameter validation using Zod schemas | ||
| - Error handling and response formatting | ||
|
|
||
| ### Tool Categories | ||
|
|
||
| **Data Operations** (`src/tools/query/`): | ||
| - `queryData` - Execute SQL queries with optional parameters | ||
| - `execData` - Execute stored procedures | ||
|
|
||
| **Metadata Operations** (`src/tools/metadata/`): | ||
| - `getCatalogs` - List available connections/catalogs | ||
| - `getSchemas` - List schemas within catalogs | ||
| - `getTables` - List tables within schemas | ||
| - `getColumns` - Get column metadata for tables | ||
| - `getPrimaryKeys` - Retrieve primary key information | ||
| - `getIndexes` - Get index information | ||
| - `getImportedKeys` / `getExportedKeys` - Foreign key relationships | ||
| - `getProcedures` - List stored procedures | ||
| - `getProcedureParameters` - Get procedure parameter information | ||
|
|
||
| ### HTTP Transport Endpoints | ||
|
|
||
| When using HTTP transport (default), the server provides: | ||
| - `/mcp` - Primary MCP endpoint with session management | ||
| - `/direct` - Direct JSON-RPC endpoint without sessions | ||
| - `/.well-known/mc/manifest.json` - MCP discovery manifest | ||
|
|
||
| ### Configuration | ||
|
|
||
| **Environment Variables**: | ||
| - `CDATA_USERNAME` - CData Connect Cloud username (required) | ||
| - `CDATA_PAT` - Personal Access Token (required) | ||
| - `CDATA_API_URL` - API URL (default: https://cloud.cdata.com/api) | ||
| - `TRANSPORT_TYPE` - "http" or "stdio" (default: "http") | ||
| - `PORT` - HTTP server port (default: 3000) | ||
| - `HOST` - HTTP server host (default: localhost) | ||
| - `LOG_ENABLED` - Enable logging (default: false) | ||
| - `LOG_LEVEL` - Log level (default: info) | ||
|
|
||
| **Inspector Configuration**: `mcp-inspector.json` | ||
| - Pre-configured for both STDIO and HTTP transports | ||
| - Used by MCP Inspector for testing and debugging | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| 1. **Environment Setup**: Create `.env` file with required CData credentials | ||
| 2. **Development**: Use `npm run dev` for live development with HTTP transport | ||
| 3. **Testing**: Use `npm run inspector` to test tools with MCP Inspector | ||
| 4. **Code Quality**: Run `npm run lint:format` before commits | ||
| 5. **Build**: Use `npm run build` to compile for production | ||
|
|
||
| ## Key Dependencies | ||
|
|
||
| - `@modelcontextprotocol/sdk` - Core MCP functionality | ||
| - `axios` - HTTP client for CData API requests | ||
| - `express` - HTTP server framework | ||
| - `winston` - Logging framework | ||
| - `zod` - Schema validation for tool parameters | ||
| - `dotenv` - Environment variable management | ||
|
|
||
| ## Transport Modes | ||
|
|
||
| **HTTP Transport** (Default): | ||
| - Better for integration with web-based AI clients | ||
| - Provides REST-like endpoints and MCP protocol endpoints | ||
| - Session management and connection pooling | ||
|
|
||
| **STDIO Transport**: | ||
| - Direct stdin/stdout communication | ||
| - Better for CLI tools and direct process communication | ||
| - Used by Claude Desktop and similar clients |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ const server = new McpServer({ | |
| version: '1.0.5', | ||
| capabilities: { | ||
| tools: {}, | ||
| prompts: {}, | ||
| }, | ||
| }); | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this to help future Claude Code sessions