Init commit
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
PAPERLESS_URL=https://paperless.nerkdesign.com/
|
||||
PAPERLESS_TOKEN=4c55d54776783220375c24bd4701edbae24cec86
|
||||
@@ -0,0 +1,2 @@
|
||||
PAPERLESS_URL=http://paperless.local:8000
|
||||
PAPERLESS_TOKEN=CHANGE_ME
|
||||
@@ -0,0 +1,3 @@
|
||||
# MCP_paperless
|
||||
|
||||
Copier `.env.example` vers `.env`, puis créer le venv et installer `requirements.txt`.
|
||||
@@ -0,0 +1,11 @@
|
||||
import os, requests
|
||||
from dotenv import load_dotenv
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
load_dotenv();mcp=FastMCP("Alfred Paperless");BASE=os.getenv('PAPERLESS_URL','').rstrip('/');TOKEN=os.getenv('PAPERLESS_TOKEN','');H={'Authorization':f'Token {TOKEN}'}
|
||||
@mcp.tool()
|
||||
def search_documents(query:str, limit:int=10):
|
||||
r=requests.get(BASE+'/api/documents/',headers=H,params={'query':query,'page_size':limit},timeout=20);r.raise_for_status();return r.json()
|
||||
@mcp.tool()
|
||||
def get_document(document_id:int):
|
||||
r=requests.get(f'{BASE}/api/documents/{document_id}/',headers=H,timeout=20);r.raise_for_status();return r.json()
|
||||
if __name__=='__main__':mcp.run()
|
||||
@@ -0,0 +1,3 @@
|
||||
mcp>=1.12
|
||||
requests>=2.32
|
||||
python-dotenv>=1.0
|
||||
Reference in New Issue
Block a user