MCP-DB-Client
Copilot instructions41 starsChanged 6 months agoMITView on GitHub
This is a framework for building Model Context Protocol (MCP) servers from 1C:Enterprise. It consists of two parts: The DLL handles protocol-level concerns (HTTP, JSON-RPC, sessions, security). The BSL module handles business logic (tool handlers, resource data, prompt generation). 2025-03-26 — Streamable HTTP transport, session management via Mcp-Session-Id. Both scripts auto-detect Visual Studio Build Tools and CMake. See TESTING.md for a complete test plan with 18 tests covering all tools, resources, prompts, and security features.
The file
We split this copilot-instructions.md into the rules it gives an agent
12 rules. About 0 are common, 1 is distinctive, and 11 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
11
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
DELETE /mcp — Session termination
- Very specific: line 44
DO NOT use reserved 1C names as local variables (Catalogs, Documents, Metadata, etc.)
- Very specific: line 53
Create a ToolXxx() function that returns a tool definition
- Very specific: line 54
Add it to the RegisterMCPTools() procedure
- Very specific: line 55
Add a handler HandleXxx() in the ToolHandlers region
- Very specific: line 56
Add a dispatch case in ProcessToolCall()
- Very specific: line 60
Add a resource definition in RegisterMCPResources()
- Very specific: line 61
Add a handler HandleReadXxx() in the ResourceHandlers region
- Very specific: line 62
Add a dispatch case in ProcessResourceRead() matching the URI
- Very specific: line 66
Add a prompt definition in RegisterMCPPrompts()
- Very specific: line 67
Add a handler HandlePromptXxx() in the PromptHandlers region
- Very specific: line 68
Add a dispatch case in ProcessPromptGet() matching the name
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
http1c — MCP Server Framework for 1C:Enterprise
Project Overview
This is a framework for building Model Context Protocol (MCP) servers from 1C:Enterprise. It consists of two parts:
- http-1c-dll/ — C++17 native DLL (1C Native API add-in) that handles MCP transport
- http-1c-dp/ — Reference 1C data processor (BSL module) showing how to implement tools, resources, and prompts
The DLL handles protocol-level concerns (HTTP, JSON-RPC, sessions, security). The BSL module handles business logic (tool handlers, resource data, prompt generation).
Architecture
MCP Client ←→ Native DLL (C++ httplib) ←→ 1C:Enterprise (BSL via ExternalEvent)- POST /mcp — JSON-RPC MCP requests
- GET /mcp — SSE notification stream
- DELETE /mcp — Session termination
Key Conventions
C++ (http-1c-dll/src/)
- Build: CMake + MSVC, NMake Makefiles,
/MTstatic CRT,/utf-8 - JSON: nlohmann/json (
json.hpp) - HTTP: cpp-httplib (
httplib.h) - 1C API: Native API headers in
include/(AddInDefBase.h,IMemoryManager.h,types.h,ComponentBase.h) - String conversion:
MB2WCHAR()/WCHAR2MB()for UTF-8 ↔ UTF-16 - Thread safety: Separate mutexes per resource (
toolsMutex,resourcesMutex,sessionMutex, etc.) - Events to 1C:
ExtEvent(u"HttpServer", u"EventName", data) - Method registration:
AddProcedure()/AddFunction()/AddProperty()with EN/RU names - Version: Defined in
version.hasVERSION_SEMVER
BSL (http-1c-dp/http1c/Forms/Form/Ext/Form/Module.bsl)
- Client-side handlers are
&AtClientprocedures (no Async/Await) - Server calls for metadata/computation use
&AtServerfunctions - Component configuration via synchronous property assignments:
Component.PropertyName = Value - Component methods via
BeginCalling<MethodName>withNotifyDescriptioncallbacks - DO NOT use reserved 1C names as local variables (
Catalogs,Documents,Metadata, etc.) - JSON:
JSONReader/JSONWriter+ReadJSON()/WriteJSON() - Error pattern: Try/Except →
SendToolError()/SendResourceError()/SendPromptError() - Tool definitions:
NewTool(),AddToolParam(),AddToolAnnotations(),SetToolOutputSchema() - Resource definitions: Structure with
uri,name,description,mimeType - Prompt definitions: Structure with
name,description,argumentsarray
Adding New Tools
- Create a
ToolXxx()function that returns a tool definition - Add it to the
RegisterMCPTools()procedure - Add a handler
HandleXxx()in the ToolHandlers region - Add a dispatch case in
ProcessToolCall()
Adding New Resources
- Add a resource definition in
RegisterMCPResources() - Add a handler
HandleReadXxx()in the ResourceHandlers region - Add a dispatch case in
ProcessResourceRead()matching the URI
Adding New Prompts
- Add a prompt definition in
RegisterMCPPrompts() - Add a handler
HandlePromptXxx()in the PromptHandlers region - Add a dispatch case in
ProcessPromptGet()matching the name
MCP Protocol Version
2025-03-26 — Streamable HTTP transport, session management via Mcp-Session-Id.
Build Commands
build/build-http1c-dll-release.sh # Build DLL
build/compile-http1c-epf.sh # Compile EPF from XMLBoth scripts auto-detect Visual Studio Build Tools and CMake.
Security
- Origin validation: localhost, 127.0.0.1, [::1], vscode-* only
- Bearer token auth: Optional, set via
AuthTokenproperty - Rate limiting: Token bucket (60 burst, 20/sec)
- Binding: 127.0.0.1 only (not 0.0.0.0)
Testing
See TESTING.md for a complete test plan with 18 tests covering all tools, resources, prompts, and security features.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

