You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 43b445b
Browse filesBrowse the repository at this point in the historyBrowse files
This interface is provided for agents, e.g. ``Claude Code`` and ``Codex``,
6
6
which mainly utilizes the "tool" concept applied in most agent frameworks.
7
-
After connecting these tools to an agent, users can invoke DiffPy
7
+
After connecting these tools to an agent, users can invoke ``DiffPy``
8
8
functionalities and automate PDF refinements through conversation.
9
9
10
-
After you have installed ``diffpy.apps``, the next step is to connect it to
11
-
your local agent. ``diffpy.apps`` server should be able to connect to any
12
-
Desktop agent that supports the MCP (Model Context Protocol), and we have provided
13
-
instructions for :ref:`connect_claude_desktop` and :ref:`connect_chatgpt_desktop` below.
14
-
15
10
.. _mcp_setup:
16
11
17
12
Setup
18
13
-----
19
14
20
-
.. _connect_claude_desktop:
15
+
After you have installed ``diffpy.apps``, the next step is to connect it to
16
+
your local agent. The configurations are required for the first time only.
21
17
22
-
Connect to Claude Desktop
23
-
~~~~~~~~~~~~~~~~~~~~~~~~~
24
-
1. Copy the path to the conda executable. There are many commands available,
25
-
here are two examples
18
+
``diffpy.apps`` communicates with the agent through the
19
+
MCP (Model Context Protocol), and thus can be configured for any agents
20
+
that support the MCP. Here we provide the setup instructions for ``Claude``
21
+
agent and ``ChatGPT`` agent.
22
+
23
+
.. _connect_claude:
24
+
25
+
For Claude User
26
+
~~~~~~~~~~~~~~~~
27
+
28
+
How to connect to Claude Code Terminal
29
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
30
+
1. Install ``Claude Code`` terminal.
31
+
32
+
2. Copy the path to the ``conda`` executable. There are many commands available,
33
+
and here are two examples:
26
34
27
35
.. code-block:: bash
28
36
29
37
whereis conda # linux or macOS terminal
30
38
where.exe conda # windows powershell
31
39
32
-
2. Install ``Claude Desktop`` (hereafter referred to as ``Claude``).
33
-
3. Open ``Claude`` and open "Settings".
34
-
4. Navigate to the "Developer" section.
35
-
5. In the "Local MCP servers" region, click "Edit Config" and Open the configuration file. It's name should be ``claude_desktop_config.json``.
40
+
3. Replace ``<path/to/conda>`` with the path to your ``conda`` executable and ``<conda_env_name>`` with the name of your conda environment, then run the following command:
41
+
42
+
.. code-block:: bash
43
+
44
+
claude mcp add --scope local diffpy-apps -- \
45
+
<path/to/conda> run --no-capture-output -n <conda_env_name> \
The ``claude mcp add`` command saves the server configuration according to the
51
+
scope you specify:
52
+
53
+
``--scope local`` adds it to the project-specific section of
54
+
``~/.claude.json``.
55
+
56
+
``--scope project`` adds it to the project's ``.mcp.json``.
57
+
58
+
``--scope user`` adds it to the top-level configuration in
59
+
``~/.claude.json``.
60
+
61
+
The default scope is ``local``.
62
+
63
+
64
+
.. note::
65
+
66
+
``diffpy.apps`` MCP server is launched by ``conda`` instead of the commonly
67
+
used ``uv`` because one of ``diffpy.apps`` core dependencies, ``diffpy.srreal`` is
68
+
better managed via ``conda``
69
+
70
+
71
+
4. Restart the ``Claude CLI``
72
+
5. Run the following command in the conversation with ``Claude CLI`` to verify the connection:
73
+
74
+
.. code-block:: bash
75
+
76
+
/mcp
77
+
78
+
6. Check :ref:`agent_example` to see how to use it to perform PDF refinement.
79
+
80
+
7. To remove the configuration, run the following command in the the terminal:
81
+
82
+
.. code-block:: bash
83
+
84
+
claude mcp remove "diffpy-apps" -s local
85
+
86
+
replace ``local`` with the actual scope you used when adding the configuration.
87
+
88
+
89
+
How to connect to Claude Desktop
90
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
91
+
1. Install ``Claude Code`` Desktop.
92
+
2. Open ``Claude Desktop`` and open "Settings".
93
+
3. Navigate to the "Developer" section.
94
+
4. In the "Local MCP servers" region, click "Edit Config" and Open the configuration file. Its name should be ``claude_desktop_config.json``.
36
95
37
96
.. Figure:: img/claude_edit_config.png
38
97
:align:center
39
98
40
-
Figure 1: Screenshot of "Edit Config" in ``Claude``.
99
+
Figure 1: Screenshot of "Edit Config" in ``Claude Desktop``.
100
+
101
+
5. Copy the path to the conda executable. There are many commands available,
102
+
here are two examples
103
+
104
+
.. code-block:: bash
105
+
106
+
whereis conda # linux or macOS terminal
107
+
where.exe conda # windows powershell
41
108
42
-
6. Add the following configuration, and replace ``</path/to/conda>`` with the path to your conda executable and ``<conda_env_name>`` with the name of your conda environment.
109
+
110
+
3. Replace ``<path/to/conda>`` with the path to your ``conda`` executable and ``<conda_env_name>`` with the name of your conda environment, then add the configuration as shown below.
8. Go to the same "Local MCP servers" section and verify that the
@@ -116,22 +183,29 @@ would look like this:
116
183
117
184
Figure 2: Screenshot of active ``diffpy.apps`` server in ``Claude``.
118
185
186
+
9. Check :ref:`agent_example` to see how to use it to perform PDF refinement.
119
187
120
-
.. _connect_chatgpt_desktop:
188
+
10. To remove the configuration, remove the added block from the configuration file.
121
189
122
-
Connect to ChatGPT Desktop
123
-
~~~~~~~~~~~~~~~~~~~~~~~~~~
124
-
1. Copy the path to the conda executable. There are many commands available,
190
+
.. _connect_chatgpt:
191
+
192
+
For ChatGPT users
193
+
~~~~~~~~~~~~~~~~~
194
+
195
+
1. Install the Desktop version or Terminal version of ``ChatGPT``.
196
+
197
+
2. Open the configuration file ``~/.codex/config.toml``.
198
+
199
+
3. Copy the path to the conda executable. There are many commands available,
125
200
here are two examples
126
201
127
202
.. code-block:: bash
128
203
129
204
whereis conda # linux or macOS terminal
130
205
where.exe conda # windows powershell
131
206
132
-
1. Install ``ChatGPT Desktop`` (hereafter referred to as ``ChatGPT``).
133
-
2. Open ``~/.codex/config.toml``.
134
-
3. Add the following configuration, and replace ``<path/to/python>`` with the path to the Python executable in your conda environment.
207
+
208
+
4. Replace ``<path/to/conda>`` with the path to your ``conda`` executable and ``<conda_env_name>`` with the name of your conda environment, then add the configuration as shown below.
0 commit comments