@baruchiro/paperless-mcp 0.0.0-test1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ # Changesets
2
+
3
+ Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4
+ with multi-package repos, or single-package repos to help you version and publish your code. You can
5
+ find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6
+
7
+ We have a quick list of common questions to get you started engaging with this project in
8
+ [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
@@ -0,0 +1,11 @@
1
+ {
2
+ "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3
+ "changelog": "@changesets/cli/changelog",
4
+ "commit": false,
5
+ "fixed": [],
6
+ "linked": [],
7
+ "access": "restricted",
8
+ "baseBranch": "main",
9
+ "updateInternalDependencies": "patch",
10
+ "ignore": []
11
+ }
@@ -0,0 +1,13 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # HTTP Transport Mode for MCP Server
7
+
8
+ - The MCP server can run in HTTP mode using the `--http` CLI flag.
9
+ - When `--http` is set, the entrypoint [src/index.ts](mdc:src/index.ts) starts an Express server and exposes the MCP API at `/mcp`.
10
+ - Each POST to `/mcp` creates a new `McpServer` and `StreamableHTTPServerTransport` for stateless, isolated handling.
11
+ - The HTTP port can be set with `--port` (default: 3000).
12
+ - Express must be installed as a dependency for HTTP mode.
13
+ - If `--http` is not set, the server runs in stdio mode as before.
@@ -0,0 +1,18 @@
1
+ ---
2
+ description: Ensuring all API and tool response types are defined and reused from a dedicated types file for consistency and maintainability.
3
+ globs:
4
+ alwaysApply: false
5
+ ---
6
+ # Type Usage and Expectations
7
+
8
+ - All core logic is implemented in TypeScript (.ts files), as described in [README.md](mdc:README.md).
9
+ - Type safety is enforced throughout the codebase, especially for:
10
+ - API responses (e.g., from PaperlessAPI)
11
+ - Tool callback signatures (see [src/tools/tags.ts](mdc:src/tools/tags.ts))
12
+ - Server interactions using `@modelcontextprotocol/sdk` types (e.g., `CallToolResult`)
13
+ - Types for API responses should be defined in a dedicated file (e.g., `src/api/types.ts`), and imported where needed for clarity and maintainability.
14
+ - When defining tools, always use the correct callback signature and return types as required by the SDK.
15
+ - Prefer explicit type annotations for function arguments and return values, especially for exported functions and tool handlers.
16
+ - Use Zod schemas for runtime validation of tool arguments where applicable.
17
+
18
+ This ensures robust type checking and predictable behavior across the MCP server implementation.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description:
3
+ globs:
4
+ alwaysApply: true
5
+ ---
6
+ # TypeScript MCP Server Migration
7
+
8
+ - The main entrypoint is [src/index.ts](mdc:src/index.ts), which starts an MCP server for Paperless-NGX using the @modelcontextprotocol/sdk package.
9
+ - All core logic is now in TypeScript; all main files in src/ use the .ts extension.
10
+ - The MCP server is started using `McpServer` and `StdioServerTransport` from the SDK, with `await server.connect(transport)`.
11
+ - The project can be run directly in TypeScript using the npm script: `npm run start -- <baseUrl> <token>` (see [package.json](mdc:package.json)).
12
+ - Node.js types are provided by @types/node in devDependencies.
package/.dockerignore ADDED
@@ -0,0 +1,2 @@
1
+ node_modules
2
+ build
@@ -0,0 +1,15 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [baruchiro] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4
+ patreon: # Replace with a single Patreon username
5
+ open_collective: # Replace with a single Open Collective username
6
+ ko_fi: # Replace with a single Ko-fi username
7
+ tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8
+ community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9
+ liberapay: # Replace with a single Liberapay username
10
+ issuehunt: # Replace with a single IssueHunt username
11
+ lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12
+ polar: # Replace with a single Polar username
13
+ buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14
+ thanks_dev: # Replace with a single thanks.dev username
15
+ custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
@@ -0,0 +1,57 @@
1
+ name: Docker Publish
2
+ on:
3
+ workflow_call:
4
+ inputs:
5
+ versionTag:
6
+ required: false
7
+ type: string
8
+ pull_request:
9
+ branches:
10
+ - master
11
+ - main
12
+
13
+ jobs:
14
+ build-and-push:
15
+ runs-on: ubuntu-latest
16
+ permissions:
17
+ contents: read
18
+ packages: write
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Docker Buildx
22
+ uses: docker/setup-buildx-action@v3
23
+ - name: Log in to GitHub Container Registry
24
+ uses: docker/login-action@v3
25
+ with:
26
+ registry: ghcr.io
27
+ username: ${{ github.actor }}
28
+ password: ${{ secrets.GITHUB_TOKEN }}
29
+ - name: Set semver and latest tags if release
30
+ id: tagmeta
31
+ run: |
32
+ if [ "${{ github.event_name }}" = "workflow_call" ]; then
33
+ echo "SEMVER=type=semver,pattern=${{ inputs.versionTag }}" >> $GITHUB_OUTPUT
34
+ echo "LATEST=type=raw,value=latest" >> $GITHUB_OUTPUT
35
+ else
36
+ echo "SEMVER=" >> $GITHUB_OUTPUT
37
+ echo "LATEST=" >> $GITHUB_OUTPUT
38
+ fi
39
+ - name: Extract Docker metadata
40
+ id: meta
41
+ uses: docker/metadata-action@v5
42
+ with:
43
+ images: ghcr.io/${{ github.actor }}/${{ github.repository }}
44
+ tags: |
45
+ type=ref,event=branch
46
+ type=ref,event=pr
47
+ type=sha
48
+ ${{ steps.tagmeta.outputs.SEMVER }}
49
+ ${{ steps.tagmeta.outputs.LATEST }}
50
+ - name: Build and push Docker image
51
+ uses: docker/build-push-action@v6
52
+ with:
53
+ context: .
54
+ file: ./Dockerfile
55
+ push: true
56
+ tags: ${{ steps.meta.outputs.tags }}
57
+ labels: ${{ steps.meta.outputs.labels }}
@@ -0,0 +1,40 @@
1
+ name: Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ release:
10
+ runs-on: ubuntu-latest
11
+ outputs:
12
+ hasChangesets: ${{ steps.changesets.outputs.hasChangesets }}
13
+ versionTag: ${{ steps.version.outputs.VERSION }}
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+ - name: Setup Node.js
17
+ uses: actions/setup-node@v3
18
+ with:
19
+ node-version: 20
20
+ - name: Install dependencies
21
+ run: npm ci
22
+ - name: Create Release Pull Request
23
+ id: changesets
24
+ uses: changesets/action@v1
25
+ with:
26
+ publish: npm publish
27
+ env:
28
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29
+ - name: Extract version from publishedPackages
30
+ id: version
31
+ run: |
32
+ echo "VERSION=$(echo '${{ steps.changesets.outputs.publishedPackages }}' | jq -r '.[0].version')" >> $GITHUB_OUTPUT
33
+
34
+ docker-publish:
35
+ needs: release
36
+ if: needs.release.outputs.hasChangesets == 'false'
37
+ uses: ./.github/workflows/docker-publish.yml
38
+ with:
39
+ versionTag: ${{ needs.release.outputs.versionTag }}
40
+ secrets: inherit
@@ -0,0 +1,5 @@
1
+ # Code of Conduct
2
+
3
+ All participants are expected to uphold a respectful and inclusive environment. Harassment or discrimination of any kind will not be tolerated.
4
+
5
+ If you experience or witness unacceptable behavior, please report it by opening an issue or contacting the maintainer directly.
@@ -0,0 +1,17 @@
1
+ # Contributing to paperless-mcp
2
+
3
+ Thank you for your interest in contributing!
4
+
5
+ ## How to Contribute
6
+ - Fork the repository
7
+ - Create a new branch for your feature or bugfix
8
+ - Make your changes
9
+ - Open a pull request with a clear description
10
+
11
+ ## Reporting Issues
12
+ - Please use GitHub Issues for bug reports and feature requests
13
+ - Include as much detail as possible
14
+
15
+ ## Code Style
16
+ - Use TypeScript for all new code
17
+ - Follow existing code patterns
package/Dockerfile ADDED
@@ -0,0 +1,19 @@
1
+ # Builder stage
2
+ FROM node:20-slim AS builder
3
+ WORKDIR /app
4
+ COPY package.json package-lock.json ./
5
+ RUN npm ci
6
+ COPY . .
7
+ RUN npm run build
8
+
9
+ # Production stage
10
+ FROM node:20-slim AS production
11
+
12
+ WORKDIR /app
13
+ COPY --from=builder /app/build .
14
+ COPY --from=builder /app/node_modules ./node_modules
15
+ COPY --from=builder /app/package.json ./package.json
16
+ COPY --from=builder /app/package-lock.json ./package-lock.json
17
+
18
+ EXPOSE 3000
19
+ ENTRYPOINT [ "node", "index.js", "--http", "--port", "3000" ]
package/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ ISC License
2
+
3
+ Copyright (c) 2024 Baruch Odem
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.