agentleFS
DitriXNewDitriXNew/MCP-DB-Client/.github/copilot-instructions.md

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
  1. Distinctive:

    DELETE /mcp — Session termination

    line 22
  2. Very specific:

    DO NOT use reserved 1C names as local variables (Catalogs, Documents, Metadata, etc.)

    line 44
  3. Very specific:

    Create a ToolXxx() function that returns a tool definition

    line 53
  4. Very specific:

    Add it to the RegisterMCPTools() procedure

    line 54
  5. Very specific:

    Add a handler HandleXxx() in the ToolHandlers region

    line 55
  6. Very specific:

    Add a dispatch case in ProcessToolCall()

    line 56
  7. Very specific:

    Add a resource definition in RegisterMCPResources()

    line 60
  8. Very specific:

    Add a handler HandleReadXxx() in the ResourceHandlers region

    line 61
  9. Very specific:

    Add a dispatch case in ProcessResourceRead() matching the URI

    line 62
  10. Very specific:

    Add a prompt definition in RegisterMCPPrompts()

    line 66
  11. Very specific:

    Add a handler HandlePromptXxx() in the PromptHandlers region

    line 67
  12. Very specific:

    Add a dispatch case in ProcessPromptGet() matching the name

    line 68

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
copilot-instructions.md

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, /MT static 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.h as VERSION_SEMVER

BSL (http-1c-dp/http1c/Forms/Form/Ext/Form/Module.bsl)

  • Client-side handlers are &AtClient procedures (no Async/Await)
  • Server calls for metadata/computation use &AtServer functions
  • Component configuration via synchronous property assignments: Component.PropertyName = Value
  • Component methods via BeginCalling<MethodName> with NotifyDescription callbacks
  • 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, arguments array

Adding New Tools

  1. Create a ToolXxx() function that returns a tool definition
  2. Add it to the RegisterMCPTools() procedure
  3. Add a handler HandleXxx() in the ToolHandlers region
  4. Add a dispatch case in ProcessToolCall()

Adding New Resources

  1. Add a resource definition in RegisterMCPResources()
  2. Add a handler HandleReadXxx() in the ResourceHandlers region
  3. Add a dispatch case in ProcessResourceRead() matching the URI

Adding New Prompts

  1. Add a prompt definition in RegisterMCPPrompts()
  2. Add a handler HandlePromptXxx() in the PromptHandlers region
  3. 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 XML

Both 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 AuthToken property
  • 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.