[UPDATE PRIMITIVE] Rewrite static MCP resources as actionable LLM-oriented guides#113
Merged
data-douser merged 10 commits intomainfrom Mar 9, 2026
Merged
Conversation
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
data-douser
requested changes
Mar 8, 2026
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
data-douser
approved these changes
Mar 8, 2026
Contributor
There was a problem hiding this comment.
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; URIcodeql://learning/getting-started→codeql://server/overview - Language resource content moved from runtime file paths in
language-types.tsto static imports (.mdfiles underserver/src/resources/languages/), eliminatingloadResourceContent()andfsdependencies inlanguage-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 |
server/src/resources/languages/javascript_security_query_guide.md
Outdated
Show resolved
Hide resolved
server/src/resources/languages/javascript_security_query_guide.md
Outdated
Show resolved
Hide resolved
…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>
51a0325 to
0d3f529
Compare
data-douser
reviewed
Mar 9, 2026
server/src/resources/languages/javascript_security_query_guide.md
Outdated
Show resolved
Hide resolved
data-douser
reviewed
Mar 9, 2026
server/src/resources/languages/javascript_security_query_guide.md
Outdated
Show resolved
Hide resolved
…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>
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.
extensions/vscode/test/suite/mcp-resource-e2e.integration.test.ts
Outdated
Show resolved
Hide resolved
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📝 Update Information
Primitive Details
Update Metadata
🎯 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.mdexists but is not registered as a resource. Noserver/tools,server/prompts, orserver/queriesreference 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 andqlttool references copied from thecodeql-development-templaterepo.Updated Behavior
8 static resources with actionable, cross-linked content written for LLM consumers. Resource filenames match their endpoint paths:
codeql://learning/query-basicslearning-query-basics.mdfrom/where/select, common patterns, testing conventionscodeql://learning/test-driven-developmentql-test-driven-development.mdql_tdd_*promptscodeql://patterns/performanceperformance-patterns.mdprofile_codeql_query_from_logsworkflow, CI/CD performance review conceptscodeql://server/overviewserver-overview.mdcodeql://server/promptsserver-prompts.mdcodeql://server/queriesserver-queries.mdcodeql://server/toolsserver-tools.mdcodeql://templates/securitysecurity-templates.mdLanguage-specific resources (
server/src/resources/languages/*.md) cleaned of all template-repo artifacts:qlttool references and broken../../../resources/cli/**relative linksisAdditionalTaintStep→isAdditionalFlowStep)java_ast.mdAll resources cross-reference specific MCP tool names and prompt names for LLM discoverability. Repo-level documentation (
docs/ql-mcp/tools.mdanddocs/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
API Changes
Output Format Changes
Language security query guides now use MCP tool name references instead of broken filesystem links:
🧪 Testing & Validation
Test Coverage Updates
getServerOverview,getServerPrompts,getServerQueries,getServerTools,getTestDrivenDevelopmentValidation Scenarios
codeql://learning/query-basics,codeql://templates/security, andcodeql://patterns/performanceURIs preservedTest Results
codeql_pack_installfailure (credential issue, unrelated)📋 Implementation Details
Files Modified
server/src/tools/codeql-resources.ts— 8 resource registrationsserver/src/lib/resources.ts— 8 static imports + getter functions (alphabetically ordered)server/test/src/lib/resources.test.ts— 8 test casesdocs/ql-mcp/resources.md,docs/ql-mcp/tools.md,docs/ql-mcp/prompts.md,server/README.md.mdfiles inserver/src/resources/rewritten; 3 new.mdfiles created; 2 files renamed to match endpoint pathsjavascript_security_query_guide.md,csharp_security_query_guide.md,python_security_query_guide.md— removed template-repo artifacts,java_ast.md— fixed incomplete sectionCode Changes Summary
getGettingStartedGuide→getServerOverview, etc.)Dependencies
🔍 Quality Improvements
Code Quality Enhancements
server-overview.mdforcodeql://server/overview)docs/ql-mcp/tools.mdanddocs/ql-mcp/prompts.mdnow point to MCP resource files as authoritative sources, eliminating content duplication🔗 References
Related Issues/PRs
🚀 Compatibility & Migration
Backward Compatibility
Breaking Changes
Changes Made:
codeql://learning/getting-startedrenamed tocodeql://server/overviewcodeql://learning/query-basicsURI preserved but file renamed fromquery-basics.mdtolearning-query-basics.mdcodeql://server/queriesnow serves bundled tools queries overview (not QL writing guide — that content moved tocodeql://learning/query-basics)Migration Guide:
resources/readcalls usingcodeql://learning/getting-startedtocodeql://server/overviewcodeql://learning/query-basicsURI is unchanged (QL writing reference)codeql://server/queriesis a new resource for bundled tools queries (PrintAST, PrintCFG, CallGraphFrom, CallGraphTo)codeql://templates/securityandcodeql://patterns/performanceURIs are unchangedAPI Evolution
learning/query-basics,templates/security, andpatterns/performanceURIs preserved👥 Review Guidelines
For Reviewers
docs/ql-mcp/resources.mdupdated with 8-resource table;docs/ql-mcp/tools.mdanddocs/ql-mcp/prompts.mdupdated to reference MCP resource files as authoritative sourcesTesting Instructions
📊 Impact Assessment
AI Assistant Impact
qltreferences, brokenresources/cli/links) that would confuse LLM consumerscodeql://server/overview; bundled tools queries documented atcodeql://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.