> For the complete documentation index, see [llms.txt](https://docs-cn.filswan.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-cn.filswan.com/multichain.storage/developer-quickstart/sdk/python-mcs-sdk/kai-shi.md).

# 开始

## Prerequisites

* [Web3](https://web3py.readthedocs.io/en/stable/) python package
* Polygon Mumbai Testnet Wallet - [Metamask Tutorial](/multichain.storage/mcp-user-guide/setup-metamask.md)
* Polygon Mumbai Testnet Alchemy RPC - [Alchemy Tutorial](https://docs-cn.filswan.com/multichain.storage/developer-quickstart/sdk/python-mcs-sdk/pages/UNtBNqqwgnrbBqCGTaew#alchemypolygontometamaskinstructions-2.createalchemymumbaipolygonrpc)
* [pytest](https://docs.pytest.org/en/7.1.x/) package (for testing purposes)

Mumbai Testnet USDC and MATIC funds are also necessary - [Swan Faucet Tutorial](/kai-fa-zi-yuan/swan-token-contract/acquire-testnet-usdc-and-matic-tokens.md)

## Installation

Install package using pip

```
pip install python-mcs-sdk
```

Or Install the package from [https://github.com/filswan/python-mcs-sdk](https://github.com/filswan/python-mcs-sdk.git).

```
$ git clone https://github.com/filswan/python-mcs-sdk.git
```

Install required packages using pip.

```
pip install -r requirements.txt
```

## Environment Variables

Once you have your Mumbai wallet and RPC URL, store your wallet's private key and the RPC URL.

```
wallet_info = {
  'wallet_address' : <'WALLET_ADDRESS'>
  'private_key' : <'PRIVATE_KEY'>
  'web3_api' : '<'WEB3_API'>
}
```

{% hint style="info" %}
Be careful not to expose this information! \
Revealing your private key to others will give them access to your wallet.
{% endhint %}

## Writing SDK Scripts

To begin writing a script utilizing the SDK, create a new `.py` file. Let's create a file named `demo.py`

At the top of this file, require the necessary packages for the script. (pytest is only necessary if you are running a test)

```
from mcs.api import McsAPI
from mcs.contract import ContractAPI
```

Next, after requiring the SDK, set up the wallet information.

```
wallet_info = {
        'wallet_address' : '*',
        'private_key' : '*',
        'web3_api' : '*',
    }
```

Now we can begin using the SDK methods.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs-cn.filswan.com/multichain.storage/developer-quickstart/sdk/python-mcs-sdk/kai-shi.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
