{"id":50754966,"url":"https://github.com/mathieubuisson/ps2mcp","last_synced_at":"2026-06-11T04:01:29.402Z","repository":{"id":361877002,"uuid":"1255044970","full_name":"MathieuBuisson/ps2mcp","owner":"MathieuBuisson","description":"ps2mcp is a code generator. It takes a PowerShell module as input and outputs a production-ready MCP server.","archived":false,"fork":false,"pushed_at":"2026-06-01T15:39:35.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T17:23:01.749Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MathieuBuisson.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-05-31T10:32:01.000Z","updated_at":"2026-06-01T15:59:05.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/MathieuBuisson/ps2mcp","commit_stats":null,"previous_names":["mathieubuisson/ps2mcp"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/MathieuBuisson/ps2mcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuBuisson%2Fps2mcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuBuisson%2Fps2mcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuBuisson%2Fps2mcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuBuisson%2Fps2mcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MathieuBuisson","download_url":"https://codeload.github.com/MathieuBuisson/ps2mcp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MathieuBuisson%2Fps2mcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34181555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-11T04:01:27.210Z","updated_at":"2026-06-11T04:01:29.383Z","avatar_url":"https://github.com/MathieuBuisson.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ps2mcp\n\n`ps2mcp` is a compiler-style CLI that turns an existing PowerShell module into a runnable [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server package. Point it at a local `.psd1` or `.psm1`, pick a target language, and get back a generated MCP server that exposes every exported command as a typed, schema-validated tool.\n\nThe compiler is a development-time artifact. The generated MCP server is the runtime artifact your agent client talks to.\n\n## Status\n\nPre-v1, in active design and implementation. See [ai-generated/project_plan.md](ai-generated/project_plan.md) for the current phase.\n\n## Why\n\nWrapping a PowerShell module as an MCP server by hand means manually mapping every parameter type to JSON Schema, handling validation attributes, managing `pwsh` invocation, serializing output, and dealing with secrets. `ps2mcp` eliminates that wrapper layer so existing PowerShell automation can be exposed to agents without per-module hand-written code.\n\n## What It Does\n\n- Analyzes a local PowerShell module (script or binary) via a hybrid introspection pipeline:\n  - AST parsing for `.psm1` / `.ps1`\n  - Out-of-process `pwsh` metadata inspection for binary modules\n- Builds a language-agnostic intermediate representation of the module's tool surface.\n- Emits a runnable MCP server package for one target per invocation:\n  - **TypeScript** — `index.ts`, `package.json`, `tsconfig.json` (TS source only, runs on a current Node.js LTS with native TypeScript execution).\n  - **Python** — `server.py`, `pyproject.toml`.\n- Bundles the source PowerShell module into the generated package so the generated runtime is self-contained and immune to drift from globally installed modules.\n- Emits a deterministic `manifest.json` used by `ps2mcp verify` for schema-drift detection in CI.\n\n## Supported Platforms\n\n- Compiler: Windows, Linux, macOS (Native AOT single-file binary).\n- Generated runtime hosts: any OS with `pwsh` 7.x installed.\n- `pwsh` 7.x is required on both the host running `ps2mcp` and the host running the generated server.\n\n## Build From Source\n\nRelease artifacts will be published per OS as standalone binaries (no .NET runtime required). Until v1 ships, build from source:\n\n- Install the .NET 10 SDK selected by [global.json](global.json).\n- Install `pwsh` 7.x.\n- On Windows, install the Native AOT toolchain via Visual Studio Build Tools or Visual Studio with **Desktop development with C++**.\n\nValidate the local development baseline:\n\n```bash\ngit clone https://github.com/your-org/ps2mcp.git\ncd ps2mcp\ndotnet restore ./ps2mcp.slnx\ndotnet format --verify-no-changes ./ps2mcp.slnx --no-restore\ndotnet test ./ps2mcp.slnx --no-restore\ndotnet publish src/Ps2Mcp.Cli -c Release -r \u003crid\u003e --self-contained\n```\n\nReplace `\u003crid\u003e` with `win-x64`, `linux-x64`, `osx-arm64`, etc.\n\n## Usage\n\nLong and short option forms are equivalent: `--help` / `-h`, `--version` / `-v`, `--target` / `-t`, and `--out` / `-o`.\n\nShow CLI help:\n\n```bash\nps2mcp --help\n```\n\nShow the compiler version:\n\n```bash\nps2mcp -v\n```\n\nGenerate a TypeScript MCP server:\n\n```bash\nps2mcp build ./MyModule.psd1 --target typescript --out ./dist-ts\n```\n\nGenerate a Python MCP server:\n\n```bash\nps2mcp build ./MyModule.psd1 --target python --out ./dist-py\n```\n\nVerify that committed generated artifacts match the current PowerShell source (for CI build gates):\n\n```bash\nps2mcp verify ./MyModule.psd1 --target typescript --out ./dist-ts\n```\n\n### Exit Codes\n\n| Code | Meaning |\n|------|---------|\n| `0` | Success |\n| `1` | Fatal usage, analysis, generation, or validation error |\n| `2` | Verification drift detected |\n\n## Generated Package Layout\n\n```text\n\u003cout\u003e/\n├── package.json | pyproject.toml\n├── tsconfig.json            # TypeScript target only\n├── manifest.json\n└── src/\n    ├── index.ts | server.py\n    └── modules/\n        └── \u003cModuleName\u003e/\n            ├── \u003cModuleName\u003e.psd1\n            └── \u003cModuleName\u003e.psm1\n```\n\n## Runtime Behavior\n\nThe generated server registers one MCP tool per exported PowerShell command. Each tool call:\n\n1. Validates input arguments against the generated schema.\n2. Optionally dot-sources a user-provided bootstrap profile (see below).\n3. Spawns `pwsh -NoProfile -NonInteractive -Command ...`.\n4. `Import-Module -Force`s the bundled module via a path relative to the generated runtime.\n5. Invokes the target command and serializes results with `ConvertTo-Json -Depth 4` (overridable per tool).\n6. Returns a structured success or structured error to the MCP client.\n\nThe runtime is stateless between calls in v1 and uses `stdio` transport.\n\n### Bootstrap Profile\n\nEnd users can supply a PowerShell profile to establish ambient context (for example, authentication) without modifying the source module. In the MCP client config:\n\n```json\n{\n  \"mcpServers\": {\n    \"my-infra-tools\": {\n      \"command\": \"node\",\n      \"args\": [\n        \"./dist-ts/src/index.ts\",\n        \"--profile\", \"C:/Users/me/mcp-auth-profile.ps1\"\n      ],\n      \"env\": {\n        \"AZURE_CLIENT_SECRET\": \"...\"\n      }\n    }\n  }\n}\n```\n\n### Security\n\n- `SecureString` parameters are converted inside `pwsh` and never appear in logs, error payloads, or schema examples.\n- Audit logs record that a secure parameter was supplied, never its content.\n- Generated runtimes avoid web service dependencies and remain auditable.\n\n## Documentation\n\n- Full specification: [ai-generated/ps2mcp-specification.md](ai-generated/ps2mcp-specification.md)\n- Implementation plan: [ai-generated/project_plan.md](ai-generated/project_plan.md)\n- Discovery report: [ai-generated/ps2mcp-discovery-report.md](ai-generated/ps2mcp-discovery-report.md)\n\n## License\n\nSee [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieubuisson%2Fps2mcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathieubuisson%2Fps2mcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieubuisson%2Fps2mcp/lists"}