Skip to content

[UPDATE PRIMITIVE] Rewrite static MCP resources as actionable LLM-oriented guides#113

Merged
data-douser merged 10 commits intomainfrom
copilot/rewrite-mcp-resources-guides
Mar 9, 2026
Merged

[UPDATE PRIMITIVE] Rewrite static MCP resources as actionable LLM-oriented guides#113
data-douser merged 10 commits intomainfrom
copilot/rewrite-mcp-resources-guides

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

📝 Update Information

Primitive Details

  • Type: Resource
  • Name: All static MCP resources (8 static + language-specific resources)
  • Update Category: Feature Enhancement

⚠️ CRITICAL: PR SCOPE VALIDATION

  • ONLY server implementation files are included
  • NO temporary or output files are included
  • NO unrelated configuration files are included
  • ALL existing tests continue to pass
  • NEW functionality is properly tested

  • Impact Scope: Moderate — resource content, URIs, registration, and language resource delivery changed; no tool or prompt logic modified

Update Metadata

  • Breaking Changes: Yes — two resource URIs renamed, one URI repurposed (see below)
  • API Compatibility: Changed (URI renames + new URIs)
  • Performance Impact: Neutral

🎯 Changes Description

Current Behavior

Static MCP resources contain placeholder-quality content: a generic "what is CodeQL" blurb, a 15-line QL snippet, 2 security examples, and 2 trivial performance patterns. ql-test-driven-development.md exists but is not registered as a resource. No server/tools, server/prompts, or server/queries reference resources exist. Resource filenames do not match their endpoint paths. Repo-level docs (docs/ql-mcp/tools.md, docs/ql-mcp/prompts.md) duplicate content that should have a single authoritative source. Language-specific resource files contain broken relative links to ../../../resources/cli/** paths and qlt tool references copied from the codeql-development-template repo.

Updated Behavior

8 static resources with actionable, cross-linked content written for LLM consumers. Resource filenames match their endpoint paths:

URI File Content
codeql://learning/query-basics learning-query-basics.md QL query writing reference: syntax, metadata, from/where/select, common patterns, testing conventions
codeql://learning/test-driven-development ql-test-driven-development.md TDD theory, AST value, cross-links to ql_tdd_* prompts
codeql://patterns/performance performance-patterns.md profile_codeql_query_from_logs workflow, CI/CD performance review concepts
codeql://server/overview server-overview.md Primary onboarding guide — tools, prompts, resources, workflows
codeql://server/prompts server-prompts.md Complete prompt reference (all 11 prompts)
codeql://server/queries server-queries.md Overview of bundled tools queries (PrintAST, PrintCFG, CallGraphFrom, CallGraphTo) with language support matrix
codeql://server/tools server-tools.md Complete default tool reference (38 tools, no monitoring tools)
codeql://templates/security security-templates.md Multi-language templates, v2 taint tracking, source/sink/sanitizer patterns

Language-specific resources (server/src/resources/languages/*.md) cleaned of all template-repo artifacts:

  • Removed all qlt tool references and broken ../../../resources/cli/** relative links
  • Replaced "CLI References" sections with MCP tool name references
  • Fixed deprecated v1 API references (isAdditionalTaintStepisAdditionalFlowStep)
  • Fixed incomplete "Example AST Hierarchy" in java_ast.md

All resources cross-reference specific MCP tool names and prompt names for LLM discoverability. Repo-level documentation (docs/ql-mcp/tools.md and docs/ql-mcp/prompts.md) now points to the MCP resource files as the authoritative source, eliminating content duplication.

Motivation

Resources are consumed by LLMs via resources/read. The previous content provided no guidance on the MCP server's capabilities, tools, prompts, or workflows. After PR #111 ensured resources are actually available in VSIX bundles, the content needed to match. Language resource files contained broken references copied from another repository that would confuse LLM consumers.

🔄 Before vs. After Comparison

Functionality Changes

URI Changes:
BEFORE                              → AFTER
codeql://learning/getting-started   → codeql://server/overview    (renamed, file: server-overview.md)
codeql://learning/query-basics      → codeql://learning/query-basics (kept, file: learning-query-basics.md)
(not registered)                    → codeql://server/queries     (new — bundled tools queries overview)
(not registered)                    → codeql://server/prompts     (new)
(not registered)                    → codeql://server/tools       (new)
(not registered)                    → codeql://learning/test-driven-development (new registration)
codeql://templates/security         → (unchanged)
codeql://patterns/performance       → (unchanged)

File Renames:
getting-started.md        → server-overview.md
query-basics.md           → learning-query-basics.md
(new)                     → server-queries.md
(new)                     → server-prompts.md
(new)                     → server-tools.md

API Changes

// BEFORE: 4 resources, 4 getter functions
import { getGettingStartedGuide, getQueryBasicsGuide, getSecurityTemplates, getPerformancePatterns } from '../lib/resources';

// AFTER: 8 resources, 8 getter functions (alphabetically ordered)
import { getLearningQueryBasics, getPerformancePatterns, getSecurityTemplates,
  getServerOverview, getServerPrompts, getServerQueries, getServerTools,
  getTestDrivenDevelopment } from '../lib/resources';

Output Format Changes

Language security query guides now use MCP tool name references instead of broken filesystem links:

// BEFORE (broken relative links from template repo):
## CLI References
- [qlt query generate new-query](../../../resources/cli/qlt/qlt_query_generate_new-query.prompt.md)
- [codeql query format](../../../resources/cli/codeql/codeql_query_format.prompt.md)

// AFTER (MCP tool name references):
## MCP Tools for Query Development
- `codeql_query_format` — automatically format CodeQL source code files
- `codeql_query_compile` — compile and validate CodeQL queries

🧪 Testing & Validation

Test Coverage Updates

  • Existing Tests: All 930 tests pass (46 files)
  • New Test Cases: Tests for getServerOverview, getServerPrompts, getServerQueries, getServerTools, getTestDrivenDevelopment
  • Regression Tests: Existing resource getter tests updated for renamed functions and passing
  • Edge Case Tests: N/A — resources are static string returns

Validation Scenarios

  1. Backward Compatibility: codeql://learning/query-basics, codeql://templates/security, and codeql://patterns/performance URIs preserved
  2. New Functionality: 4 new resource endpoints return non-empty markdown content
  3. Error Handling: N/A — resources are static string returns
  4. Performance: Neutral — same static import mechanism

Test Results

  • Unit Tests: All pass (930/930)
  • Integration Tests: Pre-existing codeql_pack_install failure (credential issue, unrelated)

📋 Implementation Details

Files Modified

  • Core Implementation: server/src/tools/codeql-resources.ts — 8 resource registrations
  • Supporting Libraries: server/src/lib/resources.ts — 8 static imports + getter functions (alphabetically ordered)
  • Tests: server/test/src/lib/resources.test.ts — 8 test cases
  • Documentation: docs/ql-mcp/resources.md, docs/ql-mcp/tools.md, docs/ql-mcp/prompts.md, server/README.md
  • Resources: 5 .md files in server/src/resources/ rewritten; 3 new .md files created; 2 files renamed to match endpoint paths
  • Language Resources: javascript_security_query_guide.md, csharp_security_query_guide.md, python_security_query_guide.md — removed template-repo artifacts, java_ast.md — fixed incomplete section

Code Changes Summary

  • Algorithm Improvements: N/A — resources are static content
  • Error Handling: N/A
  • Type Safety: Getter functions renamed for clarity (getGettingStartedGuidegetServerOverview, etc.)
  • Input Validation: N/A
  • Output Format: All resources now cross-reference tool/prompt names; language resources use MCP tool name references instead of broken filesystem links

Dependencies

  • No New Dependencies: Update uses existing dependencies only

🔍 Quality Improvements

Code Quality Enhancements

  • Readability: Resource filenames match endpoint paths (e.g., server-overview.md for codeql://server/overview)
  • Maintainability: docs/ql-mcp/tools.md and docs/ql-mcp/prompts.md now point to MCP resource files as authoritative sources, eliminating content duplication
  • Testability: Each resource getter has a dedicated test
  • Reusability: N/A

🔗 References

Related Issues/PRs

🚀 Compatibility & Migration

Backward Compatibility

  • Fully Compatible: No breaking changes
  • Breaking Changes: Changes that break existing usage (detailed below)

Breaking Changes

Changes Made:

  • codeql://learning/getting-started renamed to codeql://server/overview
  • codeql://learning/query-basics URI preserved but file renamed from query-basics.md to learning-query-basics.md
  • codeql://server/queries now serves bundled tools queries overview (not QL writing guide — that content moved to codeql://learning/query-basics)

Migration Guide:

  • Update any resources/read calls using codeql://learning/getting-started to codeql://server/overview
  • codeql://learning/query-basics URI is unchanged (QL writing reference)
  • codeql://server/queries is a new resource for bundled tools queries (PrintAST, PrintCFG, CallGraphFrom, CallGraphTo)
  • codeql://templates/security and codeql://patterns/performance URIs are unchanged

API Evolution

  • Improved Responses: Richer, cross-linked resource content
  • Better Error Messages: N/A
  • Maintained Contracts: learning/query-basics, templates/security, and patterns/performance URIs preserved

👥 Review Guidelines

For Reviewers

  • ⚠️ SCOPE COMPLIANCE: PR contains only server implementation files and repo-level docs
  • ⚠️ BACKWARD COMPATIBILITY: URI renames and file renames are intentional (issue requirement + review feedback)
  • Functionality: 8 resources register and return non-empty markdown
  • Test Coverage: 930 tests pass
  • Documentation: docs/ql-mcp/resources.md updated with 8-resource table; docs/ql-mcp/tools.md and docs/ql-mcp/prompts.md updated to reference MCP resource files as authoritative sources

Testing Instructions

npm run build-and-test    # from repo root
cd server && npm test     # unit tests only

📊 Impact Assessment

AI Assistant Impact

  • Enhanced Accuracy: Resources now explain which tools/prompts to use and when; language resources no longer contain broken links or references to non-existent tools
  • Better Coverage: 8 resources (up from 4) covering tools, prompts, bundled queries, TDD, and workflows
  • Improved Reliability: Removed template-repo artifacts (qlt references, broken resources/cli/ links) that would confuse LLM consumers
  • Enhanced User Experience: LLMs can orient themselves on first connection via codeql://server/overview; bundled tools queries documented at codeql://server/queries

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI linked an issue Mar 8, 2026 that may be closed by this pull request
9 tasks
Copilot AI changed the title [WIP] Rewrite static MCP resources for LLM consumers [UPDATE PRIMITIVE] Rewrite static MCP resources as actionable LLM-oriented guides Mar 8, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@data-douser data-douser marked this pull request as ready for review March 8, 2026 22:32
@data-douser data-douser requested review from a team and enyil as code owners March 8, 2026 22:32
Copilot AI review requested due to automatic review settings March 8, 2026 22:32
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the CodeQL Development MCP Server's static resources from 4 to 8, rewriting all content as actionable, cross-linked LLM-oriented guides. It builds on PR #111 (which fixed build-time embedding) by providing substantive content for the now-working resource endpoints. The main structural changes are URI renames, file renames, three new resource files, and migration of language AST/security resource content from runtime filesystem reads to static imports embedded at build time.

Changes:

  • 8 static resources (up from 4): rewritten content + new server/overview, server/prompts, server/queries, learning/test-driven-development; URI codeql://learning/getting-startedcodeql://server/overview
  • Language resource content moved from runtime file paths in language-types.ts to static imports (.md files under server/src/resources/languages/), eliminating loadResourceContent() and fs dependencies in language-resources.ts
  • New E2E integration test (mcp-resource-e2e.integration.test.ts) verifying all resources return non-empty, non-fallback content; repo-level docs updated to point to MCP resource files as authoritative sources

Reviewed changes

Copilot reviewed 39 out of 41 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
server/src/lib/resources.ts Replaces old getter functions with 8 new getters using static imports
server/src/tools/codeql-resources.ts Registers all 8 static resources with updated URIs and descriptions
server/src/types/language-types.ts Replaces file path strings with static .md imports for all language resources
server/src/resources/language-resources.ts Removes loadResourceContent/fs in favor of pre-loaded content from language-types.ts
server/src/resources/learning-query-basics.md New comprehensive QL query writing reference
server/src/resources/server-overview.md New primary onboarding guide for LLM clients
server/src/resources/server-prompts.md New complete prompt reference
server/src/resources/server-queries.md New bundled tools queries overview (PrintAST, PrintCFG, etc.)
server/src/resources/server-tools.md New complete tool reference (38 tools)
server/src/resources/ql-test-driven-development.md Rewritten TDD conceptual overview (was detailed step-by-step guide)
server/src/resources/performance-patterns.md Rewritten to focus on profiling tools workflow
server/src/resources/security-templates.md Expanded with multi-language templates and v2 taint tracking API
server/src/resources/getting-started.md Deleted (replaced by server-overview.md)
server/src/resources/query-basics.md Deleted (replaced by learning-query-basics.md)
server/src/resources/languages/*.md New language-specific AST/security .md files (previously were .prompt.md under ql/)
server/test/src/lib/resources.test.ts Updated to test all 8 getter functions
server/test/src/resources/language-resources.test.ts Removes fs mock, adds content handler tests
extensions/vscode/test/suite/mcp-resource-e2e.integration.test.ts New E2E integration test for resource endpoints
extensions/vscode/esbuild.config.js Adds new integration test file to build
docs/ql-mcp/resources.md Updated resource table to reflect 8 resources
docs/ql-mcp/tools.md Delegates to server-tools.md as authoritative source
docs/ql-mcp/prompts.md Delegates to server-prompts.md as authoritative source
server/README.md Updated resource descriptions

Copilot AI and others added 3 commits March 8, 2026 18:17
…name URIs, add new resources

- Rewrite getting-started.md as MCP server orientation guide (codeql://server/overview)
- Rewrite query-basics.md as practical query writing reference (codeql://server/queries)
- Rewrite security-templates.md with multi-language templates and TDD workflow
- Rewrite performance-patterns.md with profiling tool focus
- Create server-prompts.md (codeql://server/prompts) with complete prompt reference
- Create server-tools.md (codeql://server/tools) with complete default tool reference
- Rewrite ql-test-driven-development.md as TDD theory overview with cross-links
- Register ql-test-driven-development.md as MCP resource (codeql://learning/test-driven-development)
- Update resources.ts with new imports and getters
- Update codeql-resources.ts with new URIs and 7 resource registrations
- Update resources.test.ts with tests for new resources
- Update docs/ql-mcp/resources.md and server/README.md

Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…phen)

Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>

Migrate language-specific MCP resources

Address review feedback: rename files to match endpoint paths, split query-basics into learning and server resources, update docs to point to authoritative sources

- Rename getting-started.md → server-overview.md to match codeql://server/overview
- Rename query-basics.md → learning-query-basics.md for codeql://learning/query-basics
- Create server-queries.md for codeql://server/queries (PrintAST, PrintCFG, CallGraphFrom, CallGraphTo overview)
- Update docs/ql-mcp/tools.md to point to server-tools.md as authoritative source
- Update docs/ql-mcp/prompts.md to point to server-prompts.md as authoritative source
- Update resources.ts, codeql-resources.ts, tests, cross-references, and docs for 8 total resources

Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
@data-douser data-douser force-pushed the copilot/rewrite-mcp-resources-guides branch from 51a0325 to 0d3f529 Compare March 9, 2026 00:21
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 39 out of 41 changed files in this pull request and generated 7 comments.

…rt order, fix java_ast and README

- Remove qlt and broken ../resources/cli/ links from javascript, csharp, python security guides
- Replace CLI References sections with MCP tool name references
- Fix isAdditionalTaintStep → isAdditionalFlowStep in csharp guide (v2 API)
- Fix alphabetical import order in resources.ts
- Fix incomplete Example AST Hierarchy in java_ast.md with actual hierarchy
- Remove ql from README language AST references list

Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
data-douser and others added 2 commits March 9, 2026 04:49
This commit migrates the ".github/skills/**" content for agent skills
that are not specific to this repository. Converts, consolidates, and
migrates such skills as refactored MCP server resources.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 58 out of 60 changed files in this pull request and generated 5 comments.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 58 out of 60 changed files in this pull request and generated 1 comment.

@data-douser data-douser merged commit bb2cc42 into main Mar 9, 2026
21 checks passed
@data-douser data-douser deleted the copilot/rewrite-mcp-resources-guides branch March 9, 2026 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rewrite static MCP resources to be actionable guides for LLM consumers

3 participants